diff options
author | James Wen <jrw2175@columbia.edu> | 2016-02-15 01:54:18 -0500 |
---|---|---|
committer | James Wen <jrw2175@columbia.edu> | 2016-02-15 12:17:50 -0500 |
commit | 32b641ad34e7f5ebc92c52f436fd449c95fdde86 (patch) | |
tree | a5c814ab41a809124cb0cc809e590d79cca5947e | |
parent | 6678cd7320af97a07a1777c3c994862f017a748b (diff) | |
download | bundler-32b641ad34e7f5ebc92c52f436fd449c95fdde86.tar.gz |
Add error with message/explanation for `bundle outdated` in a frozen state
- (frozen state ex. after `bundle install --deployment`)
- closes #4287
-rw-r--r-- | lib/bundler/cli/outdated.rb | 14 | ||||
-rw-r--r-- | spec/commands/outdated_spec.rb | 22 |
2 files changed, 36 insertions, 0 deletions
diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb index f2354465be..1535b2c4bf 100644 --- a/lib/bundler/cli/outdated.rb +++ b/lib/bundler/cli/outdated.rb @@ -10,6 +10,8 @@ module Bundler end def run + check_for_deployment_mode + sources = Array(options[:source]) gems.each do |gem_name| @@ -109,5 +111,17 @@ module Bundler exit 1 end end + + private + + def check_for_deployment_mode + if Bundler.settings[:frozen] + error_message = "You are trying to check outdated gems in deployment mode. " \ + "Run `bundle outdated` elsewhere.\n" \ + "\nIf this is a development machine, remove the #{Bundler.default_gemfile} freeze" \ + "\nby running `bundle install --no-deployment`." + raise ProductionError, error_message + end + end end end diff --git a/spec/commands/outdated_spec.rb b/spec/commands/outdated_spec.rb index dcdb21ae66..b4895659db 100644 --- a/spec/commands/outdated_spec.rb +++ b/spec/commands/outdated_spec.rb @@ -273,4 +273,26 @@ describe "bundle outdated" do expect(out).to include("weakling (newest") end end + + context "after bundle install --deployment" do + before do + install_gemfile <<-G, :deployment => true + source "file://#{gem_repo2}" + + gem "rack" + gem "foo" + G + end + + it "outputs a helpful message about being in deployment mode" do + update_repo2 { build_gem "activesupport", "3.0" } + + bundle "outdated" + expect(exitstatus).to_not be_zero if exitstatus + expect(out).to include("You are trying to check outdated gems in deployment mode.") + expect(out).to include("Run `bundle outdated` elsewhere.") + expect(out).to include("If this is a development machine, remove the ") + expect(out).to include("Gemfile freeze\nby running `bundle install --no-deployment`.") + end + end end |