Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow clearing --without groups

fixes #1259
  • Loading branch information...
commit 83dbe36e70f75c767bbadf25242c4659d5ecb042 1 parent 73b04ed
@indirect indirect authored
View
9 lib/bundler/cli.rb
@@ -150,12 +150,11 @@ def check
"Install using defaults tuned for deployment environments"
def install(path = nil)
opts = options.dup
- opts[:without] ||= []
- if opts[:without].size == 1
- opts[:without] = opts[:without].map{|g| g.split(" ") }
+ if opts[:without]
+ opts[:without].map!{|g| g.split(" ") }
opts[:without].flatten!
+ opts[:without].map!{|g| g.to_sym }
end
- opts[:without] = opts[:without].map{|g| g.to_sym }
# Can't use Bundler.settings for this because settings needs gemfile.dirname
ENV['BUNDLE_GEMFILE'] = File.expand_path(opts[:gemfile]) if opts[:gemfile]
@@ -214,7 +213,7 @@ def install(path = nil)
Bundler.settings[:bin] = opts["binstubs"] if opts[:binstubs]
Bundler.settings[:no_prune] = true if opts["no-prune"]
Bundler.settings[:disable_shared_gems] = Bundler.settings[:path] ? '1' : nil
- Bundler.settings.without = opts[:without] unless opts[:without].empty?
+ Bundler.settings.without = opts[:without]
Bundler.ui.be_quiet! if opts[:quiet]
Installer.install(Bundler.root, Bundler.definition, opts)
View
5 lib/bundler/settings.rb
@@ -62,9 +62,7 @@ def pretty_values_for(exposed_key)
end
def without=(array)
- unless array.empty?
- self[:without] = array.join(":")
- end
+ self[:without] = (array.empty? ? nil : array.join(":")) if array
end
def without
@@ -95,6 +93,7 @@ def key_for(key)
def set_key(key, value, hash, file)
key = key_for(key)
+ puts key.inspect
unless hash[key] == value
hash[key] = value
View
14 spec/install/gems/groups_spec.rb
@@ -136,6 +136,20 @@
ENV["BUNDLE_WITHOUT"] = nil
end
+
+ it "clears without when passed an empty list" do
+ bundle :install, :without => "emo"
+
+ bundle 'install --without ""'
+ should_be_installed "activesupport 2.3.5"
+ end
+
+ it "doesn't clear without when nothing is passed" do
+ bundle :install, :without => "emo"
+
+ bundle :install
+ should_not_be_installed "activesupport 2.3.5"
+ end
end
describe "with gems assigned to multiple groups" do
Please sign in to comment.
Something went wrong with that request. Please try again.