summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHomu <homu@barosl.com>2015-10-26 12:55:14 +0900
committerHomu <homu@barosl.com>2015-10-26 12:55:14 +0900
commit5a690bb1e3b1df49c1ad9e3b791f5f9b02c8169f (patch)
treeb29417310e159cc4773a1635efa57077f86b36a0
parent95c4a01fa72fe37ca692045b02ca8cb5c3b55233 (diff)
parent7df03e65bfbfc6e72eac6a8c726fb936d7eee8b5 (diff)
downloadbundler-5a690bb1e3b1df49c1ad9e3b791f5f9b02c8169f.tar.gz
Auto merge of #4072 - bundler:rubygems-gemdeps-warn, r=indirect
Warn if RUBYGEMS_GEMDEPS env. variable is set Closes #3656.
-rw-r--r--lib/bundler/cli.rb7
-rw-r--r--spec/bundler/cli_spec.rb16
2 files changed, 23 insertions, 0 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 921cd1e68b..138ce5d7b5 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -29,6 +29,13 @@ module Bundler
self.options ||= {}
Bundler.ui = UI::Shell.new(options)
Bundler.ui.level = "debug" if options["verbose"]
+
+ if ENV["RUBYGEMS_GEMDEPS"] && !ENV["RUBYGEMS_GEMDEPS"].empty?
+ Bundler.ui.warn(
+ "The RUBYGEMS_GEMDEPS environment variable is set. This enables RubyGems' " \
+ "experimental Gemfile mode, which may conflict with Bundler and cause unexpected errors. " \
+ "To remove this warning, unset RUBYGEMS_GEMDEPS.", :wrap => true)
+ end
end
check_unknown_options!(:except => [:config, :exec])
diff --git a/spec/bundler/cli_spec.rb b/spec/bundler/cli_spec.rb
index 1d5ee7b072..a2f87e45fa 100644
--- a/spec/bundler/cli_spec.rb
+++ b/spec/bundler/cli_spec.rb
@@ -37,4 +37,20 @@ describe "bundle executable" do
should_be_installed "rack 1.0.0"
end
end
+
+ context "when ENV['RUBYGEMS_GEMDEPS'] is set" do
+ it "displays a warning" do
+ gemfile bundled_app("Gemfile"), <<-G
+ source "file://#{gem_repo1}"
+ gem 'rack'
+ G
+
+ bundle :install, :env => { "RUBYGEMS_GEMDEPS" => "foo" }
+ expect(out).to include("RUBYGEMS_GEMDEPS")
+ expect(out).to include("conflict with Bundler")
+
+ bundle :install, :env => { "RUBYGEMS_GEMDEPS" => "" }
+ expect(out).not_to include("RUBYGEMS_GEMDEPS")
+ end
+ end
end