diff options
author | Terence Lee <hone02@gmail.com> | 2011-12-06 14:57:05 -0800 |
---|---|---|
committer | Terence Lee <hone02@gmail.com> | 2011-12-06 15:06:55 -0800 |
commit | 4168c0220f7ebaff92f7e9238a3d0ce4d751518d (patch) | |
tree | f0eb4d4b34bc8d6c257185906122baca1357f502 | |
parent | 86b186fc349dc8c2ebe1f946b40b84498b725b67 (diff) | |
download | bundler-4168c0220f7ebaff92f7e9238a3d0ce4d751518d.tar.gz |
remove --clean on update, --clean is a setting on install
-rw-r--r-- | lib/bundler/cli.rb | 9 | ||||
-rw-r--r-- | spec/other/clean_spec.rb | 64 |
2 files changed, 30 insertions, 43 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index b2053d1a6b..797d97b5fc 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -156,7 +156,7 @@ module Bundler "Make a bundle that can work without the Bundler runtime" method_option "full-index", :type => :boolean, :banner => "Use the rubygems modern index instead of the API endpoint" - method_option "clean", :type => :boolean, :default => false, :banner => + method_option "clean", :type => :boolean, :banner => "Run bundle clean automatically after install" def install opts = options.dup @@ -211,6 +211,7 @@ module Bundler Bundler.settings[:disable_shared_gems] = Bundler.settings[:path] ? '1' : nil Bundler.settings.without = opts[:without] Bundler.ui.be_quiet! if opts[:quiet] + Bundler.settings[:clean] = opts[:clean] if opts[:clean] Bundler::Fetcher.disable_endpoint = opts["full-index"] # rubygems plugins sometimes hook into the gem install process @@ -232,7 +233,7 @@ module Bundler Bundler.ui.confirm "Post-install message from #{name}:\n#{msg}" end - clean if opts["clean"] && Bundler.settings[:path] && !Bundler.settings[:frozen] + clean if Bundler.settings[:clean] && Bundler.settings[:path] rescue GemNotFound => e if opts[:local] && Bundler.app_cache.exist? Bundler.ui.warn "Some gems seem to be missing from your vendor/cache directory." @@ -253,8 +254,6 @@ module Bundler method_option "source", :type => :array, :banner => "Update a specific source (and all gems associated with it)" method_option "local", :type => :boolean, :banner => "Do not attempt to fetch gems remotely and use the gem cache instead" - method_option "clean", :type => :boolean, :default => false, :banner => - "Run bundle clean automatically after update" def update(*gems) sources = Array(options[:source]) @@ -271,7 +270,7 @@ module Bundler Installer.install Bundler.root, Bundler.definition, opts Bundler.load.cache if Bundler.root.join("vendor/cache").exist? - clean if options["clean"] && Bundler.settings[:path] + clean if Bundler.settings[:clean] && Bundler.settings[:path] Bundler.ui.confirm "Your bundle is updated! " + "Use `bundle show [gemname]` to see where a bundled gem is installed." end diff --git a/spec/other/clean_spec.rb b/spec/other/clean_spec.rb index c863765b40..4c2b447fcd 100644 --- a/spec/other/clean_spec.rb +++ b/spec/other/clean_spec.rb @@ -296,7 +296,7 @@ describe "bundle clean" do out.should include("thin (1.0)") end - xit "--clean should override the bundle setting" do + it "--clean should override the bundle setting on install" do gemfile <<-G source "file://#{gem_repo1}" @@ -316,7 +316,27 @@ describe "bundle clean" do should_not_have_gems 'thin-1.0' end - xit "clean automatically on --path" do + it "--clean should override the bundle setting on update" do + build_repo2 + + gemfile <<-G + source "file://#{gem_repo2}" + + gem "foo" + G + bundle "install --path vendor/bundle --clean" + + update_repo2 do + build_gem 'foo', '1.0.1' + end + + bundle "update" + + should_have_gems 'foo-1.0.1' + should_not_have_gems 'foo-1.0' + end + + it "does not clean automatically on --path" do gemfile <<-G source "file://#{gem_repo1}" @@ -332,11 +352,10 @@ describe "bundle clean" do G bundle "install" - should_have_gems 'rack-1.0.0' - should_not_have_gems 'thin-1.0' + should_have_gems 'rack-1.0.0', 'thin-1.0' end - xit "cleans on bundle update with --path" do + it "does not clean on bundle update with --path" do build_repo2 gemfile <<-G @@ -351,10 +370,10 @@ describe "bundle clean" do end bundle :update - should_not_have_gems 'foo-1.0' + should_have_gems 'foo-1.0', 'foo-1.0.1' end - xit "does not clean on bundle update when using --system" do + it "does not clean on bundle update when using --system" do build_repo2 gemfile <<-G @@ -449,35 +468,4 @@ describe "bundle clean" do exitstatus.should == 0 out.should == "1.0" end - - it "does not clean when using --deployment" 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 "install --deployment" - - out.should_not include("Removing foo (1.0)") - should_have_gems 'thin-1.0', 'rack-1.0.0', 'foo-1.0' - vendored_gems("bin/rackup").should exist - - # check that it still doesn't clean and uses Bundler.settings - bundle "install" - - out.should_not include("Removing foo (1.0)") - should_have_gems 'thin-1.0', 'rack-1.0.0', 'foo-1.0' - vendored_gems("bin/rackup").should exist - - end end |