summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2015-06-30 11:13:33 -0700
committerSamuel E. Giddins <segiddins@segiddins.me>2015-07-16 16:53:04 -0700
commit6a37ba47860415cd37bac24d3c24d8f7ddee5887 (patch)
tree0aed41890caa7831393991c6d755d787a717f86c
parentdebb282df11aebf1dabab9f48a7a4e088093e2e2 (diff)
downloadbundler-6a37ba47860415cd37bac24d3c24d8f7ddee5887.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/config.rb2
-rw-r--r--lib/bundler/cli/install.rb2
-rw-r--r--lib/bundler/settings.rb2
-rw-r--r--spec/commands/clean_spec.rb16
-rw-r--r--spec/commands/config_spec.rb8
-rw-r--r--spec/commands/exec_spec.rb7
-rw-r--r--spec/other/platform_spec.rb16
-rw-r--r--spec/runtime/executable_spec.rb14
8 files changed, 40 insertions, 27 deletions
diff --git a/lib/bundler/cli/config.rb b/lib/bundler/cli/config.rb
index 444c304ec3..74a7f13660 100644
--- a/lib/bundler/cli/config.rb
+++ b/lib/bundler/cli/config.rb
@@ -49,7 +49,6 @@ module Bundler
new_value = args.join(" ")
locations = Bundler.settings.locations(name)
-
if name == "path.system" and Bundler.settings[:path] and new_value == "true"
Bundler.ui.warn "`path` is already configured, so it will be unset."
Bundler.settings.set_local("path", nil)
@@ -60,7 +59,6 @@ module Bundler
Bundler.settings.set_global("path.system", nil)
end
-
if scope == "global"
if locations[:local]
Bundler.ui.info "Your application has set #{name} to #{locations[:local].inspect}. " \
diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb
index 4770a7e0fe..d54112f7ab 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 73037d830e..873cad17cc 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -163,7 +163,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 dcc9b32fc8..e2655d098c 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 eab709390e..3ec41c5157 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 1ca160e241..92f8c69a24 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 6426b58f2e..79c09573a6 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")}"
diff --git a/spec/runtime/executable_spec.rb b/spec/runtime/executable_spec.rb
index 57a0266c58..0362259287 100644
--- a/spec/runtime/executable_spec.rb
+++ b/spec/runtime/executable_spec.rb
@@ -43,7 +43,7 @@ describe "Running bin/* commands" do
bundle "install"
bundle "binstubs rack"
- expect(File.open("bin/rackup").gets).to eq("#!/usr/bin/env #{RbConfig::CONFIG['ruby_install_name']}\n")
+ expect(File.open("bin/rackup").gets).to eq("#!/usr/bin/env #{RbConfig::CONFIG["ruby_install_name"]}\n")
end
it "allows the name of the shebang executable to be specified" do
@@ -68,22 +68,22 @@ describe "Running bin/* commands" do
it "works with gems in path" do
build_lib "rack", :path => lib_path("rack") do |s|
- s.executables = 'rackup'
+ s.executables = "rackup"
end
gemfile <<-G
- gem "rack", :path => "#{lib_path('rack')}"
+ gem "rack", :path => "#{lib_path("rack")}"
G
bundle "install"
bundle "binstubs rack"
- build_gem 'rack', '2.0', :to_system => true do |s|
- s.executables = 'rackup'
+ build_gem "rack", "2.0", :to_system => true do |s|
+ s.executables = "rackup"
end
gembin "rackup"
- expect(out).to eq('1.0')
+ expect(out).to eq("1.0")
end
it "don't bundle da bundla" do
@@ -150,7 +150,7 @@ describe "Running bin/* commands" do
bundle "install"
bundle "binstubs rack --path bin/"
- File.open(bundled_app("bin/rackup"), 'wb') do |file|
+ File.open(bundled_app("bin/rackup"), "wb") do |file|
file.print "OMG"
end