aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorMike McQuaid2016-11-02 12:00:27 -0400
committerGitHub2016-11-02 12:00:27 -0400
commitdc47fb33640e2da62b42c069375518ee3c1766b9 (patch)
tree32e53ded900b0c8524262d8d88b57e58dbaab82b /Library/Homebrew/cmd
parent134b650151dadf148decc37f9bb2048d7ca02df2 (diff)
parent3c7446f3ff802a802de3bd923e9a0af486575f3d (diff)
downloadbrew-dc47fb33640e2da62b42c069375518ee3c1766b9.tar.bz2
Merge pull request #1370 from MikeMcQuaid/better-github-scopes
Improve GitHub API scopes output.
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/gist-logs.rb21
1 files changed, 14 insertions, 7 deletions
diff --git a/Library/Homebrew/cmd/gist-logs.rb b/Library/Homebrew/cmd/gist-logs.rb
index e55eefc17..5cacd50b6 100644
--- a/Library/Homebrew/cmd/gist-logs.rb
+++ b/Library/Homebrew/cmd/gist-logs.rb
@@ -47,13 +47,16 @@ module Homebrew
if ARGV.include?("--new-issue") || ARGV.switch?("n")
if GitHub.api_credentials_type == :none
- puts "You can create a personal access token: https://github.com/settings/tokens"
- puts "and then set HOMEBREW_GITHUB_API_TOKEN as authentication method."
- puts
+ puts <<-EOS.undent
+ You can create a new personal access token:
+ #{GitHub::ALL_SCOPES_URL}
+ and then set the new HOMEBREW_GITHUB_API_TOKEN as the authentication method.
+
+ EOS
login!
end
- url = new_issue(f.tap, "#{f.name} failed to build on #{MacOS.full_version}", url)
+ url = create_issue(f.tap, "#{f.name} failed to build on #{MacOS.full_version}", url)
end
puts url if url
@@ -103,13 +106,17 @@ module Homebrew
end
def create_gist(files, description)
+ url = "https://api.github.com/gists"
data = { "public" => true, "files" => files, "description" => description }
- GitHub.open("https://api.github.com/gists", data)["html_url"]
+ scopes = GitHub::CREATE_GIST_SCOPES
+ GitHub.open(url, data: data, scopes: scopes)["html_url"]
end
- def new_issue(repo, title, body)
+ def create_issue(repo, title, body)
+ url = "https://api.github.com/repos/#{repo}/issues"
data = { "title" => title, "body" => body }
- GitHub.open("https://api.github.com/repos/#{repo}/issues", data)["html_url"]
+ scopes = GitHub::CREATE_ISSUE_SCOPES
+ GitHub.open(url, data: data, scopes: scopes)["html_url"]
end
def gist_logs