Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Auto merge of #4072 - bundler:rubygems-gemdeps-warn, r=indirect
Browse files Browse the repository at this point in the history
Warn if RUBYGEMS_GEMDEPS env. variable is set

Closes #3656.
  • Loading branch information
homu committed Oct 26, 2015
2 parents 95c4a01 + 7df03e6 commit 5a690bb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/bundler/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ def initialize(*args)
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])
Expand Down
16 changes: 16 additions & 0 deletions spec/bundler/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,20 @@
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

0 comments on commit 5a690bb

Please sign in to comment.