Sha256: 1c7fc43334078584c6f3e1342d3e43769690935ab13dd541ef41f32d7d0f8e50
Contents?: true
Size: 905 Bytes
Versions: 2
Compression:
Stored size: 905 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'] || ENV['HEROKU_TEST_RUN_COMMIT_VERSION'] || ENV['CI_COMMIT_SHA'] || ENV['COMMIT_SHA'] || # Google Cloud Build git_commit commit end def self.work_dir work_dir = ENV['WORK_DIR'] || ENV['TRAVIS_BUILD_DIR'] || git_dir work_dir end def self.git_commit git("log -1 --pretty=format:'%H'") end def self.git_dir dir = `git rev-parse --show-toplevel` if $?.to_i == 0 return dir.strip! else return '' end 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-2.2.1 | lib/codacy/git.rb |
codacy-coverage-2.2.0 | lib/codacy/git.rb |