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

Make 'bundle add' cache newly added gems when needed #7393

Merged
1 commit merged into from Nov 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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