Module: Priha::GitCommand
- Defined in:
- lib/priha/git_command.rb
Class Method Summary collapse
- .call_git_name_rev_name_only_head ⇒ Object
- .call_git_push(remote_name, local_branch, remote_branch) ⇒ Object
- .call_git_remote_add(token, username, repository_name, remote_name) ⇒ Object
- .call_git_remote_remove(remote_name) ⇒ Object
Class Method Details
.call_git_name_rev_name_only_head ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/priha/git_command.rb', line 3 def call_git_name_rev_name_only_head result = `git name-rev --name-only HEAD` return $?.exitstatus, result rescue => e # catch exception intead of status (a workaround for Windows) STDERR.puts e return 127, '' end |
.call_git_push(remote_name, local_branch, remote_branch) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/priha/git_command.rb', line 27 def call_git_push(remote_name, local_branch, remote_branch) result = `git push #{remote_name} #{local_branch}:#{remote_branch} --quiet` return $?.exitstatus, result rescue => e # catch exception intead of status (a workaround for Windows) STDERR.puts e return 127, '' end |
.call_git_remote_add(token, username, repository_name, remote_name) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/priha/git_command.rb', line 11 def call_git_remote_add(token, username, repository_name, remote_name) result = `git remote add #{remote_name} "https://#{token}@github.com/#{username}/#{repository_name}"` return $?.exitstatus, result rescue => e # catch exception intead of status (a workaround for Windows) STDERR.puts e return 127, '' end |
.call_git_remote_remove(remote_name) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/priha/git_command.rb', line 19 def call_git_remote_remove(remote_name) result = `git remote remove #{remote_name}` return $?.exitstatus, result rescue => e # catch exception intead of status (a workaround for Windows) STDERR.puts e return 127, '' end |