module LogCabin::Modules::GitHash

Pull state from a git hash

Public Instance Methods

load!() click to toggle source
# File lib/prospectus/modules/git_hash.rb, line 8
def load!
  chdir_helper do
    short_arg = @long ? '' : '--short'
    hash = `git rev-parse #{short_arg} HEAD 2>/dev/null`.chomp
    raise('No hash found') if hash.empty?
    @state.value = hash
  end
end

Private Instance Methods

long() click to toggle source
# File lib/prospectus/modules/git_hash.rb, line 19
def long
  @long = true
end