aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/version_option.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/version_option.rb')
-rw-r--r--lib/rubygems/version_option.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/rubygems/version_option.rb b/lib/rubygems/version_option.rb
index a69b732f78..a3de4dc9e7 100644
--- a/lib/rubygems/version_option.rb
+++ b/lib/rubygems/version_option.rb
@@ -6,10 +6,14 @@
require 'rubygems'
+##
# Mixin methods for --version and --platform Gem::Command options.
+
module Gem::VersionOption
+ ##
# Add the --platform option to the option parser.
+
def add_platform_option(task = command, *wrap)
OptionParser.accept Gem::Platform do |value|
if value == Gem::Platform::RUBY then
@@ -31,7 +35,19 @@ module Gem::VersionOption
end
end
+ ##
+ # Add the --prerelease option to the option parser.
+
+ def add_prerelease_option(*wrap)
+ add_option("--[no-]prerelease",
+ "Allow prerelease versions of a gem", *wrap) do |value, options|
+ options[:prerelease] = value
+ end
+ end
+
+ ##
# Add the --version option to the option parser.
+
def add_version_option(task = command, *wrap)
OptionParser.accept Gem::Requirement do |value|
Gem::Requirement.new value