brew-pull: combine conditionals

This commit is contained in:
Jack Nagel 2014-07-05 19:13:43 -05:00
parent 4ab696e4f2
commit 94c083dc2b

View File

@ -20,6 +20,7 @@ end
ARGV.named.each do |arg| ARGV.named.each do |arg|
if arg.to_i > 0 if arg.to_i > 0
url = 'https://github.com/Homebrew/homebrew/pull/' + arg url = 'https://github.com/Homebrew/homebrew/pull/' + arg
issue = arg
else else
url_match = arg.match HOMEBREW_PULL_OR_COMMIT_URL_REGEX url_match = arg.match HOMEBREW_PULL_OR_COMMIT_URL_REGEX
unless url_match unless url_match
@ -28,6 +29,7 @@ ARGV.named.each do |arg|
end end
url = url_match[0] url = url_match[0]
issue = url_match[4]
end end
if tap_name = tap(url) if tap_name = tap(url)
@ -39,8 +41,6 @@ ARGV.named.each do |arg|
Dir.chdir HOMEBREW_REPOSITORY Dir.chdir HOMEBREW_REPOSITORY
end end
issue = arg.to_i > 0 ? arg.to_i : url_match[4]
if ARGV.include? '--bottle' if ARGV.include? '--bottle'
raise 'No pull request detected!' unless issue raise 'No pull request detected!' unless issue
url = "https://github.com/BrewTestBot/homebrew/compare/homebrew:master...pr-#{issue}" url = "https://github.com/BrewTestBot/homebrew/compare/homebrew:master...pr-#{issue}"