Class: Codacy::Git
- Inherits:
-
Object
- Object
- Codacy::Git
- Defined in:
- lib/codacy/git.rb
Class Method Summary collapse
- .commit_id ⇒ Object
- .git(command) ⇒ Object
- .git_commit ⇒ Object
- .git_dir ⇒ Object
- .work_dir ⇒ Object
Class Method Details
.commit_id ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# 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) ⇒ Object
39 40 41 |
# File 'lib/codacy/git.rb', line 39 def self.git(command) `git --git-dir="#{git_dir}/.git" #{command}` end |
.git_commit ⇒ Object
26 27 28 |
# File 'lib/codacy/git.rb', line 26 def self.git_commit git("log -1 --pretty=format:'%H'") end |
.git_dir ⇒ Object
30 31 32 33 34 35 36 37 |
# 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 ⇒ Object
19 20 21 22 23 24 |
# 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 |