lib/mixlib/versioning/format/git_describe.rb in mixlib-versioning-1.0.0 vs lib/mixlib/versioning/format/git_describe.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. @@ -39,33 +39,31 @@ # 10.16.2.rc.1-49-g21353f0-1 # 11.0.0-alpha-10-g642ffed # 11.0.0-alpha.1-1-gcea071e # ``` # - # @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 GitDescribe < Format - GIT_DESCRIBE_REGEX = /^(\d+)\.(\d+)\.(\d+)(?:\-|\.)?(.+)?\-(\d+)\-g([a-f0-9]{7,40})(?:\-)?(\d+)?$/ attr_reader :commits_since, :commit_sha # @see Format#parse def parse(version_string) match = version_string.match(GIT_DESCRIBE_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, @commits_since, @commit_sha, @iteration = match[1..7] @major, @minor, @patch, @commits_since, @iteration = [@major, @minor, @patch, @commits_since, @iteration].map(&:to_i) # Our comparison logic is built around SemVer semantics, so # we'll store our internal information in that format @build = "#{@commits_since}.g#{@commit_sha}.#{@iteration}" end - end # class GitDescribe end # class Format end # module Versioning end # module Mixlib