diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2017-08-19 18:32:49 -0400 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2017-08-25 15:56:23 -0400 |
commit | 4875b395a8419e31900d8f052f19cd994e254b6f (patch) | |
tree | 0065a9d64d06b8075d5ae43b42c39e65e971b0ae /lib/bundler/templates | |
parent | 85a5d361d06694e96e91c7f833c746803699342a (diff) | |
download | bundler-4875b395a8419e31900d8f052f19cd994e254b6f.tar.gz |
Allow spaces in bundle update --bundler version
Diffstat (limited to 'lib/bundler/templates')
-rw-r--r-- | lib/bundler/templates/Executable.bundler | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/bundler/templates/Executable.bundler b/lib/bundler/templates/Executable.bundler index ccb9627ca5..49d4295021 100644 --- a/lib/bundler/templates/Executable.bundler +++ b/lib/bundler/templates/Executable.bundler @@ -24,9 +24,17 @@ m = Module.new do def cli_arg_version return unless invoked_as_script? # don't want to hijack other binstubs return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update` - return unless update = ARGV.find {|a| a.start_with?("--bundler") } # must have a --bundler arg - return unless update =~ /--bundler(?:=(.+))?/ - $1 || ">= 0.a" + bundler_version = nil + update_index = nil + ARGV.each_with_index do |a, i| + if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN + bundler_version = a + end + next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ + bundler_version = $1 || ">= 0.a" + update_index = i + end + bundler_version end def gemfile |