From 2a1b936f7697f355f76603ef1984ccbdf4abea9e Mon Sep 17 00:00:00 2001 From: JBallin Date: Fri, 12 Oct 2018 15:26:35 -0700 Subject: [PATCH 1/2] Clarify HOMEBREW_GITHUB_API_TOKEN in gist-logs err --- Library/Homebrew/cmd/gist-logs.rb | 2 +- Library/Homebrew/utils/github.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/cmd/gist-logs.rb b/Library/Homebrew/cmd/gist-logs.rb index 2afad99ec3..59264f1359 100644 --- a/Library/Homebrew/cmd/gist-logs.rb +++ b/Library/Homebrew/cmd/gist-logs.rb @@ -43,7 +43,7 @@ module Homebrew puts <<~EOS 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. + #{Utils::Shell.set_variable_in_profile("HOMEBREW_GITHUB_API_TOKEN", "your_token_here")} EOS login! diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index cbfe76a218..9b6280f165 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -33,7 +33,7 @@ module GitHub GitHub API Error: #{github_message} Try again in #{pretty_ratelimit_reset(reset)}, or create a personal access token: #{ALL_SCOPES_URL} - and then set the token as: export HOMEBREW_GITHUB_API_TOKEN="your_new_token" + #{Utils::Shell.set_variable_in_profile("HOMEBREW_GITHUB_API_TOKEN", "your_token_here")} EOS end @@ -58,7 +58,7 @@ module GitHub printf "protocol=https\\nhost=github.com\\n" | git credential-osxkeychain erase Or create a personal access token: #{ALL_SCOPES_URL} - and then set the token as: export HOMEBREW_GITHUB_API_TOKEN="your_new_token" + #{Utils::Shell.set_variable_in_profile("HOMEBREW_GITHUB_API_TOKEN", "your_token_here")} EOS end super message @@ -124,7 +124,7 @@ module GitHub Scopes they need: #{needed_human_scopes} Scopes they have: #{credentials_scopes} Create a personal access token: #{ALL_SCOPES_URL} - and then set HOMEBREW_GITHUB_API_TOKEN as the authentication method instead. + #{Utils::Shell.set_variable_in_profile("HOMEBREW_GITHUB_API_TOKEN", "your_token_here")} EOS when :environment onoe <<~EOS @@ -132,7 +132,7 @@ module GitHub Scopes they need: #{needed_human_scopes} Scopes it has: #{credentials_scopes} Create a new personal access token: #{ALL_SCOPES_URL} - and then set the new HOMEBREW_GITHUB_API_TOKEN as the authentication method instead. + #{Utils::Shell.set_variable_in_profile("HOMEBREW_GITHUB_API_TOKEN", "your_token_here")} EOS end end From 2bf0db40b3fcbce6996d6e999c2c1dbc6d1f3c6c Mon Sep 17 00:00:00 2001 From: JBallin Date: Sun, 14 Oct 2018 11:59:04 -0700 Subject: [PATCH 2/2] Normalize formatting of gist-logs errors --- Library/Homebrew/cmd/gist-logs.rb | 2 +- Library/Homebrew/utils/github.rb | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/cmd/gist-logs.rb b/Library/Homebrew/cmd/gist-logs.rb index 59264f1359..12f40086da 100644 --- a/Library/Homebrew/cmd/gist-logs.rb +++ b/Library/Homebrew/cmd/gist-logs.rb @@ -42,7 +42,7 @@ module Homebrew if GitHub.api_credentials_type == :none puts <<~EOS You can create a new personal access token: - #{GitHub::ALL_SCOPES_URL} + #{GitHub::ALL_SCOPES_URL} #{Utils::Shell.set_variable_in_profile("HOMEBREW_GITHUB_API_TOKEN", "your_token_here")} EOS diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index 9b6280f165..865693ebd3 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -123,7 +123,8 @@ module GitHub Your macOS keychain GitHub credentials do not have sufficient scope! Scopes they need: #{needed_human_scopes} Scopes they have: #{credentials_scopes} - Create a personal access token: #{ALL_SCOPES_URL} + Create a personal access token: + #{ALL_SCOPES_URL} #{Utils::Shell.set_variable_in_profile("HOMEBREW_GITHUB_API_TOKEN", "your_token_here")} EOS when :environment @@ -131,7 +132,8 @@ module GitHub Your HOMEBREW_GITHUB_API_TOKEN does not have sufficient scope! Scopes they need: #{needed_human_scopes} Scopes it has: #{credentials_scopes} - Create a new personal access token: #{ALL_SCOPES_URL} + Create a new personal access token: + #{ALL_SCOPES_URL} #{Utils::Shell.set_variable_in_profile("HOMEBREW_GITHUB_API_TOKEN", "your_token_here")} EOS end