vasyl-purchel/alpaca

View on GitHub
lib/alpacabuildtool/tools/git.rb

Summary

Maintainability
A
0 mins
Test Coverage
module AlpacaBuildTool
  ##
  # Git provides methods to help with git version control tool
  module Git
    ##
    # Returns string with changes in dir
    #
    # +dir+:: specific dir where to look for changes
    # +commit_from+:: commit from which look for changes(nil by default to
    # look for all changes)
    def self.changes(dir, commit_from = nil)
      return `git log -- #{dir}` unless commit_from
      `git log #{commit_from}..HEAD -- #{dir}`
    end

    ##
    # Returns current revision id
    def self.revision
      `git rev-parse HEAD`
    end
  end
end