@@ -1318,7 +1318,7 @@ end
13181318module Gist
13191319 extend self
13201320
1321- VERSION = '4.6.2 '
1321+ VERSION = '5.0.0 '
13221322
13231323 # A list of clipboard commands with copy and paste support.
13241324 CLIPBOARD_COMMANDS = {
@@ -1414,6 +1414,13 @@ module Gist
14141414 #
14151415 # @see http://developer.github.com/v3/gists/
14161416 def multi_gist ( files , options = { } )
1417+ if options [ :anonymous ]
1418+ raise 'Anonymous gists are no longer supported. Please log in with `gist --login`. ' \
1419+ '(Github now requires credentials to gist https://bit.ly/2GBBxKw)'
1420+ else
1421+ access_token = ( options [ :access_token ] || auth_token ( ) )
1422+ end
1423+
14171424 json = { }
14181425
14191426 json [ :description ] = options [ :description ] if options [ :description ]
@@ -1432,11 +1439,6 @@ module Gist
14321439 return if json [ :files ] . empty? && options [ :skip_empty ]
14331440
14341441 existing_gist = options [ :update ] . to_s . split ( "/" ) . last
1435- if options [ :anonymous ]
1436- access_token = nil
1437- else
1438- access_token = ( options [ :access_token ] || auth_token ( ) )
1439- end
14401442
14411443 url = "#{ base_path } /gists"
14421444 url << "/" << CGI . escape ( existing_gist ) if existing_gist . to_s != ''
@@ -1903,16 +1905,12 @@ specified STDIN will be read. The default filename for STDIN is "a.rb", and all
19031905filenames can be overridden by repeating the "-f" flag. The most useful reason
19041906to do this is to change the syntax highlighting.
19051907
1906- If you'd like your gists to be associated with your GitHub account, so that you
1907- can edit them and find them in future, first use `gist --login` to obtain an
1908- Oauth2 access token. This is stored and used by gist in the future.
1908+ All gists must to be associated with a GitHub account, so you will need to login with
1909+ `gist --login` to obtain an Oauth2 access token. This is stored and used by gist in the future.
19091910
19101911Private gists do not have guessable URLs and can be created with "-p", you can
19111912also set the description at the top of the gist by passing "-d".
19121913
1913- Anonymous gists are not associated with your GitHub account, they can be created
1914- with "-a" even after you have used "gist --login".
1915-
19161914If you would like to shorten the resulting gist URL, use the -s flag. This will
19171915use GitHub's URL shortener, git.io. You can also use -R to get the link to the
19181916raw gist.
@@ -1929,7 +1927,7 @@ original gist with the same GitHub account.
19291927If you want to skip empty files, use the --skip-empty flag. If all files are
19301928empty no gist will be created.
19311929
1932- Usage: #{ executable_name } [-o|-c|-e] [-p] [-s] [-R] [-d DESC] [-a] [- u URL]
1930+ Usage: #{ executable_name } [-o|-c|-e] [-p] [-s] [-R] [-d DESC] [-u URL]
19331931 [--skip-empty] [-P] [-f NAME|-t EXT]* FILE*
19341932 #{ executable_name } --login
19351933 #{ executable_name } [-l|-r]
@@ -1971,10 +1969,6 @@ Usage: #{executable_name} [-o|-c|-e] [-p] [-s] [-R] [-d DESC] [-a] [-u URL]
19711969 options [ :update ] = update
19721970 end
19731971
1974- opts . on ( "-a" , "--anonymous" , "Create an anonymous gist." ) do
1975- options [ :anonymous ] = true
1976- end
1977-
19781972 opts . on ( "-c" , "--copy" , "Copy the resulting URL to the clipboard" ) do
19791973 options [ :copy ] = true
19801974 end
@@ -2027,6 +2021,12 @@ Usage: #{executable_name} [-o|-c|-e] [-p] [-s] [-R] [-d DESC] [-a] [-u URL]
20272021end . parse!
20282022
20292023begin
2024+ if Gist . auth_token . nil?
2025+ puts 'Please log in with `gist --login`. ' \
2026+ '(Github now requires credentials to gist https://bit.ly/2GBBxKw)'
2027+ exit ( 1 )
2028+ end
2029+
20302030 options [ :output ] = if options [ :embed ] && options [ :shorten ]
20312031 raise Gist ::Error , "--embed does not make sense with --shorten"
20322032 elsif options [ :embed ]
0 commit comments