Sha256: b698e9b0360606d186efaa0b30bd30cf074da6557251aaf953956ee246cd1e94

Contents?: true

Size: 605 Bytes

Versions: 1

Compression:

Stored size: 605 Bytes

Contents

require 'open4'
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 
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
thor-scmversion-0.0.1 lib/thor-scmversion/git_version.rb