module Gem::VersionOption
Mixin methods for –version and –platformGem::Command options.
Public Instance Methods
Source
# File lib/rubygems/version_option.rb, line 18defadd_platform_option(task =command,*wrap)Gem::OptionParser.acceptGem::Platformdo|value|ifvalue==Gem::Platform::RUBYvalueelseGem::Platform.newvalueendendadd_option("--platform PLATFORM",Gem::Platform,"Specify the platform of gem to #{task}",*wrap)do|value,options|unlessoptions[:added_platform]Gem.platforms = [Gem::Platform::RUBY]options[:added_platform] =trueendGem.platforms<<valueunlessGem.platforms.include?valueendend
Add the –platform option to the option parser.
Source
# File lib/rubygems/version_option.rb, line 41defadd_prerelease_option(*wrap)add_option("--[no-]prerelease","Allow prerelease versions of a gem",*wrap)do|value,options|options[:prerelease] =valueoptions[:explicit_prerelease] =trueendend
Add the –prerelease option to the option parser.
Source
# File lib/rubygems/version_option.rb, line 52defadd_version_option(task =command,*wrap)Gem::OptionParser.acceptGem::Requirementdo|value|Gem::Requirement.new(*value.split(/\s*,\s*/))endadd_option("-v","--version VERSION",Gem::Requirement,"Specify version of gem to #{task}",*wrap)do|value,options|# Allow handling for multiple --version operatorsifoptions[:version]&&!options[:version].none?options[:version].concat([value])elseoptions[:version] =valueendexplicit_prerelease_set =!options[:explicit_prerelease].nil?options[:explicit_prerelease] =falseunlessexplicit_prerelease_setoptions[:prerelease] =value.prerelease?unlessoptions[:explicit_prerelease]endend
Add the –version option to the option parser.
Source
# File lib/rubygems/version_option.rb, line 77defget_platform_from_requirements(requirements)Gem.platforms[1].to_sifrequirements.key?:added_platformend
Extract platform given on the command line