Sha256: 48ededab43799a74204da2b630a3b11fa196038ab8079239db79fe3821875ec5

Contents?: true

Size: 586 Bytes

Versions: 6

Compression:

Stored size: 586 Bytes

Contents

require 'contracts'
require 'git'

module GitHubStatus
  module Support
    module Git
      include ::Contracts::Core
      include ::Contracts::Builtin

      Contract None => ::Git::Base
      def git
        @git ||= ::Git.open "#{workdir}/#{path}"
      rescue ArgumentError
        STDERR.puts "#{path} is not a git repository"
        abort
      end

      Contract None => String
      def sha
        @sha ||= if File.file? "#{workdir}/#{path}"
          File.read("#{workdir}/#{path}").chomp
        else
          git.revparse 'HEAD'
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
concourse-github-status-0.7.1 lib/github-status/support/git.rb
concourse-github-status-0.7.0 lib/github-status/support/git.rb
concourse-github-status-0.6.6 lib/github-status/support/git.rb
concourse-github-status-0.6.4 lib/github-status/support/git.rb
concourse-github-status-0.6.3 lib/github-status/support/git.rb
concourse-github-status-0.6.2 lib/github-status/support/git.rb