Sha256: 94314b09b43b4961e7606980a0c335cd58a508e8878c39d3430b927734af1304
Contents?: true
Size: 962 Bytes
Versions: 2
Compression:
Stored size: 962 Bytes
Contents
require 'open3' module ThorSCMVersion class GitVersion < ScmVersion class << self def all_from_path(path) Dir.chdir(path) do tags = Open3.popen3("git tag") { |stdin, stdout, stderr| stdout.read }.split(/\n/) version_tags = tags.select { |tag| tag.match(ScmVersion::VERSION_FORMAT) } version_tags.collect { |tag| new(*tag.split('.')) }.sort.reverse end end end def tag ShellUtils.sh "git tag -a -m \"Version #{self}\" #{self}" ShellUtils.sh "git push --tags || true" end def auto_bump last_tag = self.class.from_path.to_s logs = ShellUtils.sh "git log --abbrev-commit --format=oneline #{last_tag}.." guess = if logs =~ /\[major\]|\#major/i :major elsif logs =~ /\[minor\]|\#minor/i :minor else :patch end bump!(guess) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
thor-scmversion-0.2.1 | lib/thor-scmversion/git_version.rb |
thor-scmversion-0.2.0 | lib/thor-scmversion/git_version.rb |