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

Commit

Permalink
Calling bundle add with cache_all as true, it caches the newly added …
Browse files Browse the repository at this point in the history
…gems
  • Loading branch information
andrehjr committed Oct 25, 2019
1 parent 27a01a5 commit b685388
Show file tree
Hide file tree
Showing 2 changed files with 11 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? && !Bundler.frozen_bundle?
end

def inject_dependencies
Expand Down
10 changes: 10 additions & 0 deletions spec/commands/add_spec.rb
Expand Up @@ -239,4 +239,14 @@
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_all is true" do
it "caches all new dependencies added for the specified gem" do
bundle "config set cache_all true"
bundle! :package

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 b685388

Please sign in to comment.