class NliPipeline::GitManager
simple class for managing git commands
Public Instance Methods
branch()
click to toggle source
@return [String] current branch
# File lib/nli_pipeline/git_manager.rb, line 28 def branch call_system('git symbolic-ref --short HEAD', return_output: true) end
last_commit()
click to toggle source
@return [String] full length hash of last commit
# File lib/nli_pipeline/git_manager.rb, line 18 def last_commit call_system("git log -1 --pretty=format:'%H'", return_output: true) end
last_commit_message()
click to toggle source
@return [String] full messaage for last commit, all as one line
# File lib/nli_pipeline/git_manager.rb, line 23 def last_commit_message call_system('git log -1 --format=%B --oneline', return_output: true) end
last_commit_url()
click to toggle source
@return [String] full url to commit
# File lib/nli_pipeline/git_manager.rb, line 7 def last_commit_url "#{remote}/commits/#{last_commit}" end
remote(upstream: 'origin')
click to toggle source
@param upstream [String] @return [String] url for git remote origin
# File lib/nli_pipeline/git_manager.rb, line 13 def remote(upstream: 'origin') call_system("git ls-remote --get-url #{upstream}", return_output: true) end