class GitCommands::Push
Push
a branch to remote
Public Class Methods
new(branch, remote_exists = true, opts = {})
click to toggle source
Calls superclass method
Command::new
# File lib/straight_line/common/git_commands/push.rb, line 6 def initialize(branch, remote_exists = true, opts = {}) super('git') arg 'checkout' arg branch if remote_exists.is_a? Hash opts = remote_exists remote_exists = true end sub_command push_command(branch, remote_exists, opts) end
Public Instance Methods
push_command(branch, remote_exists, opts)
click to toggle source
# File lib/straight_line/common/git_commands/push.rb, line 18 def push_command(branch, remote_exists, opts) push_command = Command.new('git') .arg('push') if opts[:delete] push_command .arg('origin') .arg('--delete') .arg(branch) elsif !remote_exists push_command .arg('--set-upstream') .arg('origin') .arg(branch) end push_command end