Skip to content

Commit 4fce19e

Browse files
author
esteban zapata
committed
gist: Update raise message.
1 parent c8ab655 commit 4fce19e

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

lib/gist.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@ def default_filename
108108
#
109109
# @see http://developer.github.com/v3/gists/
110110
def multi_gist(files, options={})
111+
if options[:anonymous]
112+
raise 'Anonymous gists are no longer supported. Please log in with `gist --login`. ' \
113+
'(Github now requires credentials to gist https://bit.ly/2GBBxKw)'
114+
else
115+
access_token = (options[:access_token] || auth_token())
116+
end
117+
111118
json = {}
112119

113120
json[:description] = options[:description] if options[:description]
@@ -126,12 +133,6 @@ def multi_gist(files, options={})
126133
return if json[:files].empty? && options[:skip_empty]
127134

128135
existing_gist = options[:update].to_s.split("/").last
129-
if options[:anonymous]
130-
raise 'Anonymous gist support has been removed by Github. ' \
131-
'See: https://blog.github.com/2018-02-18-deprecation-notice-removing-anonymous-gist-creation/'
132-
else
133-
access_token = (options[:access_token] || auth_token())
134-
end
135136

136137
url = "#{base_path}/gists"
137138
url << "/" << CGI.escape(existing_gist) if existing_gist.to_s != ''

spec/rawify_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
end
1111

1212
it 'should raise an error when trying to do operations without being logged in' do
13-
error_msg = 'Anonymous gist support has been removed by Github. ' \
14-
'See: https://blog.github.com/2018-02-18-deprecation-notice-removing-anonymous-gist-creation/'
13+
error_msg = 'Anonymous gists are no longer supported. Please log in with `gist --login`. ' \
14+
'(Github now requires credentials to gist https://bit.ly/2GBBxKw)'
1515

1616
expect do
1717
Gist.gist("Test gist", output: :raw_url, anonymous: true)

spec/shorten_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
end
1515

1616
it 'should raise an error when trying to get short urls without being logged in' do
17-
error_msg = 'Anonymous gist support has been removed by Github. ' \
18-
'See: https://blog.github.com/2018-02-18-deprecation-notice-removing-anonymous-gist-creation/'
17+
error_msg = 'Anonymous gists are no longer supported. Please log in with `gist --login`. ' \
18+
'(Github now requires credentials to gist https://bit.ly/2GBBxKw)'
1919

2020
expect do
2121
Gist.gist("Test gist", output: :short_url, anonymous: true)

0 commit comments

Comments
 (0)