# File lib/versionomy/format_definitions/rubygems.rb, line 254 def self.create_standard_to_rubygems # We'll use a parsing conversion. Conversion::Parsing.new do # We're going to modify how the standard format version is # unparsed, so the rubygems format will have a better chance # of parsing it. to_modify_unparse_params do |params_, convert_params_| params_ ||= {} # If the standard format version has a prerelease notation, # make sure it is set off using a delimiter that the rubygems # format can recognize. So instead of "1.0b2", we force the # unparsing to generate "1.0.b.2". params_[:release_type_delim] = '.' params_[:development_version_delim] = '.' params_[:alpha_version_delim] = '.' params_[:beta_version_delim] = '.' params_[:release_candidate_version_delim] = '.' params_[:preview_version_delim] = '.' # If the standard format version has a patchlevel notation, # force it to use the default number rather than letter style. # So instead of "1.2c", we force the unparsing to generate # "1.2-3". params_[:patchlevel_style] = nil # If the standard format version has a patchlevel notation, # force it to use the default delimiter of "-" so the rubygems # format will recognize it. So instead of "1.9.1p243", we force # the unparsing to generate "1.9.1-243". params_[:patchlevel_delim] = nil # If the standard format version includes a "v" prefix, strip # it because rubygems doesn't like it. params_[:major_delim] = nil params_ end # Standard formats sometimes allow hyphens and spaces in field # delimiters, but the rubygems format requires periods. So modify # the unparsed string to conform to rubygems's expectations. to_modify_string do |str_, convert_params_| str_.gsub(/[\.\s-]+/, '.') end end end