module Builderator::Control::Version::Git

SCM implementation for Git

Constants

COMMIT_FORMAT
TAG_FORMAT

Public Class Methods

_history() click to toggle source
# File lib/builderator/control/version/git.rb, line 24
def self._history
  `git log --pretty='format:%H %d %s' HEAD`.chomp
    .split("\n")
    .map { |string| string.match(COMMIT_FORMAT) }
    .reject(&:nil?)
    .map do |commit|
      {
        :id => commit[:hash],
        :message => commit[:message]
      }.tap do |c|
        tag_match = commit[:tags].scan(TAG_FORMAT)
                    .flatten
                    .reject(&:nil?) unless commit[:tags].nil?

        c[:tags] = tag_match unless tag_match.nil? || tag_match.empty?
      end
    end
end
supported?() click to toggle source

Is there a .git repo in the project root?

# File lib/builderator/control/version/git.rb, line 18
def self.supported?
  return true if ENV['GIT_DIR'] && File.exist?(ENV['GIT_DIR'])

  Util.relative_path('.git').exist?
end