Sha256: 876f44004b67176938b7d198771d9993a3262130668d426e1e86cbaa93926953

Contents?: true

Size: 642 Bytes

Versions: 5

Compression:

Stored size: 642 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.work_dir
      work_dir = ENV['WORK_DIR'] || git_dir
      work_dir
    end

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

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
codacy-coverage-1.1.5 lib/codacy/git.rb
codacy-coverage-1.1.4 lib/codacy/git.rb
codacy-coverage-1.1.3 lib/codacy/git.rb
codacy-coverage-1.1.1 lib/codacy/git.rb
codacy-coverage-1.1.0 lib/codacy/git.rb