Module: CartoCSSHelper::Git
- Defined in:
- lib/cartocss_helper/git.rb
Instance Method Summary collapse
Instance Method Details
#checkout(branch, debug = false) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/cartocss_helper/git.rb', line 10 def checkout(branch, debug = false) Dir.chdir(Configuration.get_path_to_cartocss_project_folder) do require 'open3' command = "git checkout #{branch}" begin execute_command(command, debug, ignore_stderr_presence: true) # or maybe just do not run if it is currently in the wanted branch? rescue FailedCommandException => e raise "failed checkout to #{branch} due to #{e}" end end end |
#get_commit_hash ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/cartocss_helper/git.rb', line 22 def get_commit_hash Dir.chdir(Configuration.get_path_to_cartocss_project_folder) do command = 'git log -n 1 --pretty=format:"%H"' return execute_command(command) end raise 'impossible happened' end |