Module: Pantograph::Helper::Git
- Defined in:
- pantograph/lib/pantograph/helper/git_helper.rb
Class Method Summary collapse
-
.current_branch ⇒ Object
Returns the current git branch - can be replaced using the environment variable ‘GIT_BRANCH`.
- .is_git? ⇒ Boolean
- .repo_clean? ⇒ Boolean
- .repo_status ⇒ Object
Class Method Details
.current_branch ⇒ Object
Returns the current git branch - can be replaced using the environment variable ‘GIT_BRANCH`
139 140 141 142 143 144 145 146 |
# File 'pantograph/lib/pantograph/helper/git_helper.rb', line 139 def self.current_branch return ENV['GIT_BRANCH'] if ENV['GIT_BRANCH'].to_s.length > 0 # set by Jenkins s = Actions.sh("git rev-parse --abbrev-ref HEAD", log: false).chomp return s.to_s.strip if s.to_s.length > 0 nil rescue nil end |
.is_git? ⇒ Boolean
156 157 158 159 160 161 |
# File 'pantograph/lib/pantograph/helper/git_helper.rb', line 156 def self.is_git? Actions.sh('git rev-parse HEAD', log: false) return true rescue UI.user_error!("Not in a git repository.") end |
.repo_clean? ⇒ Boolean
152 153 154 |
# File 'pantograph/lib/pantograph/helper/git_helper.rb', line 152 def self.repo_clean? repo_status.empty? end |