Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Make bundle add caches newly added gems when needed.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrehjr committed Nov 4, 2019
1 parent 27a01a5 commit 293ad80
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/bundler/cli/add.rb
Expand Up @@ -21,6 +21,7 @@ def run

def perform_bundle_install
Installer.install(Bundler.root, Bundler.definition)
Bundler.load.cache if Bundler.app_cache.exist?
end

def inject_dependencies
Expand Down
9 changes: 9 additions & 0 deletions spec/commands/add_spec.rb
Expand Up @@ -239,4 +239,13 @@
expect(err).not_to include("You may also need to change the version requirement specified in the Gemfile if it's too restrictive")
end
end

describe "when a gem is added and cache exists" do
it "caches all new dependencies added for the specified gem" do
bundle! :cache

bundle "add 'rack' --version=1.0.0"
expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
end
end
end

0 comments on commit 293ad80

Please sign in to comment.