4
5
6
7
8
9
10
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/gitcycle/ready.rb', line 4
def ready(*issues)
require_git && require_config
branch = pull
if branch && !branch['collab']
force = branch['labels'] && branch['labels'].include?('Pass')
force ||= branch['state'] && branch['state'] == 'closed'
branch = create_pull_request(branch, force)
end
if branch == false
puts "Branch not found.\n".red
elsif branch['collab']
remote, branch = branch['home'], branch['source']
puts "\nPushing branch '#{remote}/#{branch}'.\n".green
run("git push #{remote} #{branch} -q")
elsif branch['issue_url']
puts "\nLabeling issue as 'Pending Review'.\n".green
get('label',
'branch[name]' => branch['name'],
'labels' => [ 'Pending Review' ]
)
puts "Opening issue: #{branch['issue_url']}\n".green
Launchy.open(branch['issue_url'])
else
puts "You have not pushed any commits to '#{branch['name']}'.\n".red
end
end
|