summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHomu <homu@barosl.com>2016-10-15 05:06:48 +0900
committerHomu <homu@barosl.com>2016-10-15 05:06:48 +0900
commit37ec6051f6442a23b2c524cfdee02a13873a2a61 (patch)
treeaba2e1425d4b27cc0c99729a655e6300ff1e3d1b
parent509d50b17e0b77680ec5bdd4737c5ed73f87bd06 (diff)
parentfca76d30dec6c1d3c0cc5459333901240c81deb4 (diff)
downloadbundler-37ec6051f6442a23b2c524cfdee02a13873a2a61.tar.gz
Auto merge of #5053 - hmistry:fix-clean-dry-run, r=segiddins
Changed the behavior of 'bundle clean --dry-run' to output the list regardless of path set or force option Changed the behavior of 'bundle clean --dry-run' to output the list of gems bundle without having the local path set or providing the '--force' option. This change does not affect the actual behavior of 'bundle clean' which requires either the path being set or use of '--force'. Closes #5027.
-rw-r--r--lib/bundler/cli/clean.rb2
-rw-r--r--spec/commands/clean_spec.rb32
2 files changed, 32 insertions, 2 deletions
diff --git a/lib/bundler/cli/clean.rb b/lib/bundler/cli/clean.rb
index 895b6567fa..5eba09c6bc 100644
--- a/lib/bundler/cli/clean.rb
+++ b/lib/bundler/cli/clean.rb
@@ -8,7 +8,7 @@ module Bundler
end
def run
- require_path_or_force
+ require_path_or_force unless options[:"dry-run"]
Bundler.load.clean(options[:"dry-run"])
end
diff --git a/spec/commands/clean_spec.rb b/spec/commands/clean_spec.rb
index 72d422c3a2..acec0eef95 100644
--- a/spec/commands/clean_spec.rb
+++ b/spec/commands/clean_spec.rb
@@ -567,7 +567,7 @@ describe "bundle clean" do
expect(exitstatus).to eq(0) if exitstatus
end
- it "doesn't remove gems in dry-run mode" do
+ it "doesn't remove gems in dry-run mode with path set" do
gemfile <<-G
source "file://#{gem_repo1}"
@@ -595,6 +595,36 @@ describe "bundle clean" do
expect(vendored_gems("bin/rackup")).to exist
end
+ it "doesn't remove gems in dry-run mode with no path set" do
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+
+ gem "thin"
+ gem "foo"
+ G
+
+ bundle "install --path vendor/bundle --no-clean"
+
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+
+ gem "thin"
+ G
+
+ bundle :install
+
+ bundle "configuration --delete path"
+
+ bundle "clean --dry-run"
+
+ expect(out).not_to include("Removing foo (1.0)")
+ expect(out).to include("Would have removed foo (1.0)")
+
+ should_have_gems "thin-1.0", "rack-1.0.0", "foo-1.0"
+
+ expect(vendored_gems("bin/rackup")).to exist
+ end
+
it "doesn't store dry run as a config setting" do
gemfile <<-G
source "file://#{gem_repo1}"