class Codacy::Git
Public Class Methods
commit_id()
click to toggle source
# File lib/codacy/git.rb, line 3 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
git(command)
click to toggle source
# File lib/codacy/git.rb, line 39 def self.git(command) `git --git-dir="#{git_dir}/.git" #{command}` end
git_commit()
click to toggle source
# File lib/codacy/git.rb, line 26 def self.git_commit git("log -1 --pretty=format:'%H'") end
git_dir()
click to toggle source
# File lib/codacy/git.rb, line 30 def self.git_dir dir = `git rev-parse --show-toplevel` if $?.to_i == 0 return dir.strip! else return '' end end
work_dir()
click to toggle source
# File lib/codacy/git.rb, line 19 def self.work_dir work_dir = ENV['WORK_DIR'] || ENV['TRAVIS_BUILD_DIR'] || git_dir work_dir end