Created
December 19, 2012 17:07
-
-
Save VictorLowther/4338375 to your computer and use it in GitHub Desktop.
Rubygems wrapper that allows for multiple --version arguments.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'rubygems' | |
require 'rubygems/gem_runner' | |
require 'rubygems/exceptions' | |
# Stupid hack to allow multiple --version options. | |
module Gem::VersionOption | |
def add_version_option(task = command, *wrap) | |
OptionParser.accept Gem::Requirement do |value| | |
Gem::Requirement.new value | |
end | |
add_option('-v', '--version VERSION', Gem::Requirement, | |
"Specify version of gem to #{task}", *wrap) do | |
|value, options| | |
options[:version] = Array.new unless options[:version].kind_of?(Array) | |
options[:version] << value | |
options[:prerelease] = true if value.prerelease? | |
end | |
end | |
end | |
args = ARGV.clone | |
begin | |
Gem::GemRunner.new.run args | |
rescue Exception => e | |
e.backtrace | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment