diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index b1a19f5530f..7d9d9d949c0 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -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 => diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb index 4d6715120b9..e88c0935387 100644 --- a/lib/bundler/cli/install.rb +++ b/lib/bundler/cli/install.rb @@ -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 diff --git a/man/bundle-install.ronn b/man/bundle-install.ronn index e9706b51bd3..0af3fb67083 100644 --- a/man/bundle-install.ronn +++ b/man/bundle-install.ronn @@ -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] @@ -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. diff --git a/spec/cache/gems_spec.rb b/spec/cache/gems_spec.rb index b70f62743a9..bee02ace95e 100644 --- a/spec/cache/gems_spec.rb +++ b/spec/cache/gems_spec.rb @@ -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 @@ -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 @@ -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 @@ -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" @@ -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 @@ -224,7 +224,7 @@ end simulate_new_machine - install_gemfile <<-G + install_gemfile <<-G, :cache => true source "file://#{gem_repo1}" gem "platform_specific" G diff --git a/spec/commands/package_spec.rb b/spec/commands/package_spec.rb index d87ebc56bf9..f72868cb2a0 100644 --- a/spec/commands/package_spec.rb +++ b/spec/commands/package_spec.rb @@ -125,7 +125,7 @@ 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" @@ -133,8 +133,21 @@ 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