diff options
author | Agis Anastasopoulos <agis.anast@gmail.com> | 2015-10-25 12:19:14 +0200 |
---|---|---|
committer | Agis Anastasopoulos <agis.anast@gmail.com> | 2015-10-25 13:08:25 +0200 |
commit | 7df03e65bfbfc6e72eac6a8c726fb936d7eee8b5 (patch) | |
tree | 35b08e29afb9b99e97703d1c065aa2342be0c72a | |
parent | 0c459df96d11a917a37fb23262099700abed261f (diff) | |
download | bundler-7df03e65bfbfc6e72eac6a8c726fb936d7eee8b5.tar.gz |
Warn if RUBYGEMS_GEMDEPS env. variable is setrubygems-gemdeps-warn
Closes #3656.
-rw-r--r-- | lib/bundler/cli.rb | 7 | ||||
-rw-r--r-- | spec/bundler/cli_spec.rb | 16 |
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 |