Use Formula#tap to get the repository name

This commit is contained in:
Jack Nagel 2014-09-07 16:06:07 -05:00
parent 269405995e
commit 944ac75b24

View File

@ -11,7 +11,6 @@ def gist_logs f
puts 'and then set HOMEBREW_GITHUB_API_TOKEN to use --new-issue option.'
exit 1
end
repo = repo_name(f)
end
files = load_logs(f.name)
@ -22,7 +21,7 @@ def gist_logs f
url = create_gist(files)
if ARGV.include? '--new-issue'
url = new_issue(repo, "#{f.name} failed to build on #{MACOS_FULL_VERSION}", url)
url = new_issue(f.tap, "#{f.name} failed to build on #{MACOS_FULL_VERSION}", url)
end
ensure puts url if url
@ -98,15 +97,6 @@ class HTTP_Error < RuntimeError
end
end
def repo_name f
dir = f.path.dirname
url = dir.cd { `git config --get remote.origin.url` }
unless url =~ %r{github.com(?:/|:)([\w\d]+)/([\-\w\d]+)}
raise 'Unable to determine formula repository.'
end
"#{$1}/#{$2}"
end
def usage
puts "usage: brew gist-logs [options] <formula>"
puts