Sha256: 4bf95818a85fdaaa8c3eea0410c93bdcb4481fa3e99912688ca2c1650c2b6b10

Contents?: true

Size: 601 Bytes

Versions: 5

Compression:

Stored size: 601 Bytes

Contents

module LogCabin
  module Modules
    ##
    # Pull state from the latest GitHub commit
    module GithubHash
      include Prospectus.helpers.find(:github_api)

      def load!
        fail('No repo specified') unless @repo
        @branch ||= 'master'
        @state.value = @long ? hash : hash.slice(0, 7)
      end

      private

      def hash
        @hash ||= github_api.branch(@repo, @branch).commit.sha
      end

      def repo(value)
        @repo = value
      end

      def branch(value)
        @branch = value
      end

      def long
        @long = true
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
prospectus-0.0.11 lib/prospectus/modules/github_hash.rb
prospectus-0.0.10 lib/prospectus/modules/github_hash.rb
prospectus-0.0.9 lib/prospectus/modules/github_hash.rb
prospectus-0.0.8 lib/prospectus/modules/github_hash.rb
prospectus-0.0.6 lib/prospectus/modules/github_hash.rb