Sha256: 8dac03e0ccf2946b5e9d8722e7680a8f4052da7f36b3bf64d8616d3bfa362d47

Contents?: true

Size: 472 Bytes

Versions: 7

Compression:

Stored size: 472 Bytes

Contents

module LogCabin
  module Modules
    ##
    # Pull state from a git hash
    module GitHash
      include Prospectus.helpers.find(:chdir)

      def load!
        chdir_helper do
          short_arg = @long ? '' : '--short'
          hash = `git rev-parse #{short_arg} HEAD 2>/dev/null`.chomp
          fail('No hash found') if hash.empty?
          @state.value = hash
        end
      end

      private

      def long
        @long = true
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
prospectus-0.0.12 lib/prospectus/modules/git_hash.rb
prospectus-0.0.11 lib/prospectus/modules/git_hash.rb
prospectus-0.0.10 lib/prospectus/modules/git_hash.rb
prospectus-0.0.9 lib/prospectus/modules/git_hash.rb
prospectus-0.0.8 lib/prospectus/modules/git_hash.rb
prospectus-0.0.6 lib/prospectus/modules/git_hash.rb
prospectus-0.0.5 lib/prospectus/modules/git_hash.rb