Module: LogCabin::Modules::GitHash

Defined in:
lib/prospectus/modules/git_hash.rb

Overview

Pull state from a git hash

Instance Method Summary collapse

Instance Method Details

#load!Object



8
9
10
11
12
13
14
15
# 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