diff options
author | Andre Arko <andre@arko.net> | 2015-06-30 11:13:33 -0700 |
---|---|---|
committer | Stefan Lance <stefan@lances.net> | 2015-07-01 18:57:09 -0500 |
commit | d70a4a809156e677ad93fb5ff916a995e5fd64b0 (patch) | |
tree | ba76f10b58c4857ea85a0692c8c93774b3b65a5a | |
parent | 91d23ea3ee62868946d872b6b112ad62307af458 (diff) | |
download | bundler-d70a4a809156e677ad93fb5ff916a995e5fd64b0.tar.gz |
update clean spec to explicitly call --system
- Change more clean specs to explicitly use --system
- Fix failing platform.rb specs by adding --system
- Previously, `install_gemfile` and `bundle :install` installed gems
to the system gem path by default (when given no flags). This caused
some of the specs to fail, since the default installation path and
the `default_bundle_path` have changed. So, we needed to add the `system`
flag to the install commands in certain specs and change the
expected output to include the `system_gem_path`.
- Fix failing spec re: conflicting path configs
-rw-r--r-- | lib/bundler/cli/install.rb | 2 | ||||
-rw-r--r-- | lib/bundler/settings.rb | 2 | ||||
-rw-r--r-- | spec/commands/clean_spec.rb | 16 | ||||
-rw-r--r-- | spec/commands/config_spec.rb | 8 | ||||
-rw-r--r-- | spec/commands/exec_spec.rb | 7 | ||||
-rw-r--r-- | spec/other/platform_spec.rb | 16 |
6 files changed, 33 insertions, 18 deletions
diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb index a612b78dc9..1a4c6e548d 100644 --- a/lib/bundler/cli/install.rb +++ b/lib/bundler/cli/install.rb @@ -82,7 +82,7 @@ module Bundler options[:system] = true end - Bundler.settings[:path] = nil if options[:system] + Bundler.settings[:path] = Bundler.rubygems.gem_dir if options[:system] Bundler.settings[:path] = "vendor/bundle" if options[:deployment] Bundler.settings[:path] = options["path"] if options["path"] Bundler.settings[:path] ||= "bundle" if options["standalone"] diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index 4e5aedb537..d3aa8f5233 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -136,7 +136,7 @@ module Bundler return path if path && !@local_config.key?(key) if path = self[:path] - "#{path}/#{Bundler.ruby_scope}" + path == Bundler.rubygems.gem_dir ? path : "#{path}/#{Bundler.ruby_scope}" else File.join(@root, Bundler.ruby_scope) end diff --git a/spec/commands/clean_spec.rb b/spec/commands/clean_spec.rb index 14b9226844..9222e5a505 100644 --- a/spec/commands/clean_spec.rb +++ b/spec/commands/clean_spec.rb @@ -324,15 +324,17 @@ describe "bundle clean" do gem "thin" gem "rack" G - bundle :install + bundle "install --system" + sys_exec "gem list" + expect(out).to include("rack (1.0.0)") + expect(out).to include("thin (1.0)") gemfile <<-G source "file://#{gem_repo1}" gem "rack" G - bundle :install - + bundle "install --system" sys_exec "gem list" expect(out).to include("rack (1.0.0)") expect(out).to include("thin (1.0)") @@ -423,7 +425,7 @@ describe "bundle clean" do gem "foo" G - bundle "install" + bundle "install --system" update_repo2 do build_gem 'foo', '1.0.1' @@ -441,14 +443,14 @@ describe "bundle clean" do gem "foo" gem "rack" G - bundle :install + bundle "install --system" gemfile <<-G source "file://#{gem_repo1}" gem "rack" G - bundle :install + bundle "install --system" bundle "clean --force" expect(out).to include("Removing foo (1.0)") @@ -501,7 +503,7 @@ describe "bundle clean" do gem "bindir" G - bundle :install + bundle "install --system" bundle "clean --force" diff --git a/spec/commands/config_spec.rb b/spec/commands/config_spec.rb index 239ec67e0a..01d33ab10a 100644 --- a/spec/commands/config_spec.rb +++ b/spec/commands/config_spec.rb @@ -289,7 +289,9 @@ E describe "setting `path` when `path.system` is already set" do it "should print a warning and remove the `path.system` setting" do bundle "config path.system true" - bundle "config path 'some/path/'" + # Note that if a path is used that does not include the installed gems, + # we'll get an error when we pass _any_ command to `run` below. + bundle "config path #{default_bundle_path}" expect(out).to include("`path.system` is already configured") run "puts Bundler.settings['path.system'] == nil" @@ -299,7 +301,9 @@ E describe "setting `path.system` when `path` is already set" do it "should print a warning and remove the `path` setting" do - bundle "config path 'some/path/'" + # Here, the path does not matter, since the option gets overwritten + # when we set `path.system`. We could choose 'any/path/'. + bundle "config path #{default_bundle_path}" bundle "config path.system true" expect(out).to include("`path` is already configured") diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb index 47e9629a63..5487e1eca0 100644 --- a/spec/commands/exec_spec.rb +++ b/spec/commands/exec_spec.rb @@ -114,13 +114,16 @@ describe "bundle exec" do end end - install_gemfile <<-G + # We added :system => true here and in the block below, since the + # (old default) system gem directory was implicitly used in previous + # versions of Bundler. + install_gemfile <<-G, :system => true source "file://#{gem_repo1}" gem "rack", "0.9.1" G Dir.chdir bundled_app2 do - install_gemfile bundled_app2('Gemfile'), <<-G + install_gemfile bundled_app2('Gemfile'), <<-G, :system => true source "file://#{gem_repo2}" gem "rack_two", "1.0.0" G diff --git a/spec/other/platform_spec.rb b/spec/other/platform_spec.rb index 86216df2a7..d7e183150f 100644 --- a/spec/other/platform_spec.rb +++ b/spec/other/platform_spec.rb @@ -540,7 +540,7 @@ G context "bundle show" do before do - install_gemfile <<-G + install_gemfile <<-G, :system => true source "file://#{gem_repo1}" gem "rails" G @@ -555,7 +555,7 @@ G G bundle "show rails" - expect(out).to eq(default_bundle_path('gems', 'rails-2.3.2').to_s) + expect(out).to eq(system_gem_path('gems', 'rails-2.3.2').to_s) end it "prints path if ruby version is correct for any engine" do @@ -568,7 +568,13 @@ G G bundle "show rails" - expect(out).to eq(default_bundle_path('gems', 'rails-2.3.2').to_s) + # Previously, gems had been installed to the system gem path, + # since `bundle install` (see the `before` block above) used + # the system gem path by default. + + # Also, the default_bundle_path used to be the system gem path, + # so we now expect the system_gem_path below. + expect(out).to eq(system_gem_path('gems', 'rails-2.3.2').to_s) end end @@ -868,7 +874,7 @@ G context "bundle console" do before do - install_gemfile <<-G + install_gemfile <<-G, :system => true source "file://#{gem_repo1}" gem "rack" gem "activesupport", :group => :test @@ -1104,7 +1110,7 @@ G build_git "foo", :path => lib_path("foo") end - install_gemfile <<-G + install_gemfile <<-G, :system => true source "file://#{gem_repo2}" gem "activesupport", "2.3.5" gem "foo", :git => "#{lib_path('foo')}" |