Class: Git::Daily::Push
Instance Method Summary
collapse
Methods inherited from Command
branches, clean?, current_branch, develop, has_branch?, has_remote_branch?, #initialize, logurl, master, merged_branches, pull_request_url, release_branches, remote, remote_branch, remotes
Instance Method Details
#help ⇒ Object
7
8
9
|
# File 'lib/git-daily/command/push.rb', line 7
def help
"push\tPush local to remote (for only same branch)"
end
|
#run ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/git-daily/command/push.rb', line 11
def run
remote = Command.remote
if remote.empty?
raise "no remote setting"
end
current_branch = Command.current_branch
unless current_branch
raise "not on any branches"
end
remote_branch = Command.remote_branch(remote, current_branch)
unless remote_branch
raise "note remote branch named: #{current_branch}"
end
puts "run git push #{remote} #{current_branch}"
r = `git push #{remote} #{current_branch}`
puts r
unless $?.success?
$stderr.puts "git push failed:"
raise "git push failed"
end
puts "push completed"
end
|
#usage ⇒ Object
37
38
39
40
41
|
# File 'lib/git-daily/command/push.rb', line 37
def usage
<<-EOS
Usage: git daily push
EOS
end
|