Sha256: 641061a477deadc4c48eaa48d2d3064bc682e394c8ceb583468a8ed642ffdd0c

Contents?: true

Size: 545 Bytes

Versions: 2

Compression:

Stored size: 545 Bytes

Contents

module Codacy
  class Git
    def self.commit_id

      commit = ENV['TRAVIS_COMMIT'] ||
          ENV['DRONE_COMMIT'] ||
          ENV['GIT_COMMIT'] ||
          ENV['CIRCLE_SHA1'] ||
          ENV['CI_COMMIT_ID'] ||
          ENV['WERCKER_GIT_COMMIT'] ||
          git_commit

      commit
    end

    def self.git_commit
      git("log -1 --pretty=format:'%H'")
    end

    def self.git_dir
      return `git rev-parse --show-toplevel`
    end

    def self.git(command)
      `git --git-dir="#{git_dir}/.git" #{command}`
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
codacy-coverage-0.2.2 lib/codacy/git.rb
codacy-coverage-0.2.1 lib/codacy/git.rb