lib/mixlib/versioning/format/rubygems.rb in mixlib-versioning-1.0.0 vs lib/mixlib/versioning/format/rubygems.rb in mixlib-versioning-1.1.0

- old
+ new

@@ -1,8 +1,8 @@ # -# Author:: Seth Chisamore (<schisamo@opscode.com>) -# Author:: Christopher Maier (<cm@opscode.com>) +# Author:: Seth Chisamore (<schisamo@chef.io>) +# Author:: Christopher Maier (<cm@chef.io>) # Copyright:: Copyright (c) 2013 Opscode, Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -37,30 +37,28 @@ # 10.1.1.beta.1 # 10.1.1.rc.0 # 10.16.2 # ``` # - # @author Seth Chisamore (<schisamo@opscode.com>) - # @author Christopher Maier (<cm@opscode.com>) + # @author Seth Chisamore (<schisamo@chef.io>) + # @author Christopher Maier (<cm@chef.io>) class Rubygems < Format - RUBYGEMS_REGEX = /^(\d+)\.(\d+)\.(\d+)(?:\.([[:alnum:]]+(?:\.[[:alnum:]]+)?))?(?:\-(\d+))?$/ # @see Format#parse def parse(version_string) match = version_string.match(RUBYGEMS_REGEX) rescue nil unless match - raise Mixlib::Versioning::ParseError, "'#{version_string}' is not a valid #{self.class} version string!" + fail Mixlib::Versioning::ParseError, "'#{version_string}' is not a valid #{self.class} version string!" end @major, @minor, @patch, @prerelease, @iteration = match[1..5] @major, @minor, @patch, @iteration = [@major, @minor, @patch, @iteration].map(&:to_i) # Do not convert @build to an integer; SemVer sorting logic will handle the conversion - @prerelease = nil if (@prerelease.nil? || @prerelease.empty?) + @prerelease = nil if @prerelease.nil? || @prerelease.empty? end - end # class Rubygems end # class Format end # module Versioning end # module Mixlib