Sha256: 7c00b9aa6bfc9a66e941a69be773ccf95ea65a3545a1fe64ec25cad10b0bf101

Contents?: true

Size: 589 Bytes

Versions: 4

Compression:

Stored size: 589 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 
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
thor-scmversion-0.0.5 lib/thor-scmversion/git_version.rb
thor-scmversion-0.0.4 lib/thor-scmversion/git_version.rb
thor-scmversion-0.0.3 lib/thor-scmversion/git_version.rb
thor-scmversion-0.0.2 lib/thor-scmversion/git_version.rb