Skip to content
This repository was archived by the owner on Apr 14, 2021. It is now read-only.
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/bundler/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ def check
"Specify the number of jobs to run in parallel"
method_option "local", :type => :boolean, :banner =>
"Do not attempt to fetch gems remotely and use the gem cache instead"
method_option "no-cache", :type => :boolean, :banner =>
"Don't update the existing gem cache."
method_option "cache", :type => :boolean, :banner =>
"Update the existing gem cache."
method_option "no-prune", :type => :boolean, :banner =>
"Don't remove stale gems from the cache."
method_option "path", :type => :string, :banner =>
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/cli/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def run
definition = Bundler.definition
definition.validate_ruby!
Installer.install(Bundler.root, definition, options)
Bundler.load.cache if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.settings[:frozen]
Bundler.load.cache if Bundler.app_cache.exist? && options["cache"] && !Bundler.settings[:frozen]

Bundler.ui.confirm "Bundle complete! #{dependencies_count_for(definition)}, #{gems_installed_for(definition)}."
confirm_without_groups
Expand Down
9 changes: 4 additions & 5 deletions man/bundle-install.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ bundle-install(1) -- Install the dependencies specified in your Gemfile
[--gemfile=GEMFILE]
[--jobs=NUMBER]
[--local] [--deployment]
[--no-cache]
[--cache]
[--no-prune]
[--path PATH] [--system]
[--quiet]
Expand Down Expand Up @@ -81,10 +81,9 @@ update process below under [CONSERVATIVE UPDATING][].
Installs the gems specified in the bundle to the system's Rubygems location.
This overrides any previous [remembered][REMEMBERED OPTIONS] use of `--path`.

* `--no-cache`:
Do not update the cache in `vendor/cache` with the newly bundled gems. This
does not remove any gems in the cache but keeps the newly bundled gems from
being cached during the install.
* `--cache`:
Update the cache in `vendor/cache` with the newly bundled gems during the
install.

* `--no-prune`:
Don't remove stale gems from the cache when the installation finishes.
Expand Down
12 changes: 6 additions & 6 deletions spec/cache/gems_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@

it "re-caches during install" do
cached_gem("rack-1.0.0").rmtree
bundle :install
bundle :install, :cache => true
expect(out).to include("Updating files in vendor/cache")
expect(cached_gem("rack-1.0.0")).to exist
end
Expand All @@ -180,7 +180,7 @@
end

it "adds new gems and dependencies" do
install_gemfile <<-G
install_gemfile <<-G, :cache => true
source "file://#{gem_repo2}"
gem "rails"
G
Expand All @@ -189,7 +189,7 @@
end

it "removes .gems for removed gems and dependencies" do
install_gemfile <<-G
install_gemfile <<-G, :cache => true
source "file://#{gem_repo2}"
gem "rack"
G
Expand All @@ -201,7 +201,7 @@
it "removes .gems when gem changes to git source" do
build_git "rack"

install_gemfile <<-G
install_gemfile <<-G, :cache => true
source "file://#{gem_repo2}"
gem "rack", :git => "#{lib_path("rack-1.0")}"
gem "actionpack"
Expand All @@ -214,7 +214,7 @@

it "doesn't remove gems that are for another platform" do
simulate_platform "java" do
install_gemfile <<-G
install_gemfile <<-G, :cache => true
source "file://#{gem_repo1}"
gem "platform_specific"
G
Expand All @@ -224,7 +224,7 @@
end

simulate_new_machine
install_gemfile <<-G
install_gemfile <<-G, :cache => true
source "file://#{gem_repo1}"
gem "platform_specific"
G
Expand Down
17 changes: 15 additions & 2 deletions spec/commands/package_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,29 @@
end
end

it "does not update the cache if --no-cache is passed" do
it "does not update the cache if --cache is not passed" do
gemfile <<-G
source "file://#{gem_repo1}"
gem "rack"
G
bundled_app("vendor/cache").mkpath
expect(bundled_app("vendor/cache").children).to be_empty

bundle "install --no-cache"
bundle "install"
expect(bundled_app("vendor/cache").children).to be_empty
end

it "updates the cache if --cache is passed" do
gemfile <<-G
source "file://#{gem_repo1}"
gem "rack"
G
bundled_app("vendor/cache").mkpath
expect(bundled_app("vendor/cache").children).to be_empty

bundle "install --cache"
expect(bundled_app("vendor/cache").children).not_to be_empty
end

end
end