gist 4.6.2 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8dcb4ad16178e41476596aa05e8819ed3431e5f2
4
- data.tar.gz: 6698bd0bda9e583700e5bec695d7e6b5c1b6fba5
3
+ metadata.gz: '009c779d5fc272fe71b6a1f8ae44d110f91bcfe1'
4
+ data.tar.gz: d57f1f9e76c336d05a0145b7f0f31904049567c2
5
5
  SHA512:
6
- metadata.gz: 7ca4af1b0e24281a929ea6a39e5e67a3b2a2c5bc7aed06039adac829665f5e5d013061a65b097a3be0a68bc623c43299f5f9b148b2a28113644aff267cd86036
7
- data.tar.gz: c4bde01c49fe0182422071f8afa445b3da2af1d829b7d4f36df957eef059ddb097f4e248f232c5bebf06888e22327d7b44bb18f93cb2456965f9f03e8f031f32
6
+ metadata.gz: f0fad7991139e0848e8c3e884c0b16fec18f1097dffc08d5e76842f80367c1af621ef3ca04f2b970084cdca16630b47fcb31025ba415125d0e1497151a6647c9
7
+ data.tar.gz: 386a013bfc9c25e5453944d4c71cdf5e913772dc3574bbd0b3b8eb227f1d55e987b21e83c7ab7b9554edbfcec0b19569d1f6dc479e338463b1d3146c47e61e14
data/bin/gist CHANGED
@@ -24,16 +24,12 @@ specified STDIN will be read. The default filename for STDIN is "a.rb", and all
24
24
  filenames can be overridden by repeating the "-f" flag. The most useful reason
25
25
  to do this is to change the syntax highlighting.
26
26
 
27
- If you'd like your gists to be associated with your GitHub account, so that you
28
- can edit them and find them in future, first use `gist --login` to obtain an
29
- Oauth2 access token. This is stored and used by gist in the future.
27
+ All gists must to be associated with a GitHub account, so you will need to login with
28
+ `gist --login` to obtain an Oauth2 access token. This is stored and used by gist in the future.
30
29
 
31
30
  Private gists do not have guessable URLs and can be created with "-p", you can
32
31
  also set the description at the top of the gist by passing "-d".
33
32
 
34
- Anonymous gists are not associated with your GitHub account, they can be created
35
- with "-a" even after you have used "gist --login".
36
-
37
33
  If you would like to shorten the resulting gist URL, use the -s flag. This will
38
34
  use GitHub's URL shortener, git.io. You can also use -R to get the link to the
39
35
  raw gist.
@@ -50,7 +46,7 @@ original gist with the same GitHub account.
50
46
  If you want to skip empty files, use the --skip-empty flag. If all files are
51
47
  empty no gist will be created.
52
48
 
53
- Usage: #{executable_name} [-o|-c|-e] [-p] [-s] [-R] [-d DESC] [-a] [-u URL]
49
+ Usage: #{executable_name} [-o|-c|-e] [-p] [-s] [-R] [-d DESC] [-u URL]
54
50
  [--skip-empty] [-P] [-f NAME|-t EXT]* FILE*
55
51
  #{executable_name} --login
56
52
  #{executable_name} [-l|-r]
@@ -92,10 +88,6 @@ Usage: #{executable_name} [-o|-c|-e] [-p] [-s] [-R] [-d DESC] [-a] [-u URL]
92
88
  options[:update] = update
93
89
  end
94
90
 
95
- opts.on("-a", "--anonymous", "Create an anonymous gist.") do
96
- options[:anonymous] = true
97
- end
98
-
99
91
  opts.on("-c", "--copy", "Copy the resulting URL to the clipboard") do
100
92
  options[:copy] = true
101
93
  end
@@ -148,6 +140,12 @@ Usage: #{executable_name} [-o|-c|-e] [-p] [-s] [-R] [-d DESC] [-a] [-u URL]
148
140
  end.parse!
149
141
 
150
142
  begin
143
+ if Gist.auth_token.nil?
144
+ puts 'Please log in with `gist --login`. ' \
145
+ '(Github now requires credentials to gist https://bit.ly/2GBBxKw)'
146
+ exit(1)
147
+ end
148
+
151
149
  options[:output] = if options[:embed] && options[:shorten]
152
150
  raise Gist::Error, "--embed does not make sense with --shorten"
153
151
  elsif options[:embed]
data/build/gist CHANGED
@@ -1318,7 +1318,7 @@ end
1318
1318
  module Gist
1319
1319
  extend self
1320
1320
 
1321
- VERSION = '4.6.2'
1321
+ VERSION = '5.0.0'
1322
1322
 
1323
1323
  # A list of clipboard commands with copy and paste support.
1324
1324
  CLIPBOARD_COMMANDS = {
@@ -1414,6 +1414,13 @@ module Gist
1414
1414
  #
1415
1415
  # @see http://developer.github.com/v3/gists/
1416
1416
  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
+
1417
1424
  json = {}
1418
1425
 
1419
1426
  json[:description] = options[:description] if options[:description]
@@ -1432,11 +1439,6 @@ module Gist
1432
1439
  return if json[:files].empty? && options[:skip_empty]
1433
1440
 
1434
1441
  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
1440
1442
 
1441
1443
  url = "#{base_path}/gists"
1442
1444
  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
1903
1905
  filenames can be overridden by repeating the "-f" flag. The most useful reason
1904
1906
  to do this is to change the syntax highlighting.
1905
1907
 
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.
1909
1910
 
1910
1911
  Private gists do not have guessable URLs and can be created with "-p", you can
1911
1912
  also set the description at the top of the gist by passing "-d".
1912
1913
 
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
-
1916
1914
  If you would like to shorten the resulting gist URL, use the -s flag. This will
1917
1915
  use GitHub's URL shortener, git.io. You can also use -R to get the link to the
1918
1916
  raw gist.
@@ -1929,7 +1927,7 @@ original gist with the same GitHub account.
1929
1927
  If you want to skip empty files, use the --skip-empty flag. If all files are
1930
1928
  empty no gist will be created.
1931
1929
 
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]
1933
1931
  [--skip-empty] [-P] [-f NAME|-t EXT]* FILE*
1934
1932
  #{executable_name} --login
1935
1933
  #{executable_name} [-l|-r]
@@ -1971,10 +1969,6 @@ Usage: #{executable_name} [-o|-c|-e] [-p] [-s] [-R] [-d DESC] [-a] [-u URL]
1971
1969
  options[:update] = update
1972
1970
  end
1973
1971
 
1974
- opts.on("-a", "--anonymous", "Create an anonymous gist.") do
1975
- options[:anonymous] = true
1976
- end
1977
-
1978
1972
  opts.on("-c", "--copy", "Copy the resulting URL to the clipboard") do
1979
1973
  options[:copy] = true
1980
1974
  end
@@ -2027,6 +2021,12 @@ Usage: #{executable_name} [-o|-c|-e] [-p] [-s] [-R] [-d DESC] [-a] [-u URL]
2027
2021
  end.parse!
2028
2022
 
2029
2023
  begin
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
+
2030
2030
  options[:output] = if options[:embed] && options[:shorten]
2031
2031
  raise Gist::Error, "--embed does not make sense with --shorten"
2032
2032
  elsif options[:embed]
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "GIST" "1" "January 2018" "" "Gist manual"
4
+ .TH "GIST" "1" "May 2018" "" "Gist manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBgist\fR \- upload code to https://gist\.github\.com
@@ -12,7 +12,7 @@ end
12
12
  module Gist
13
13
  extend self
14
14
 
15
- VERSION = '4.6.2'
15
+ VERSION = '5.0.0'
16
16
 
17
17
  # A list of clipboard commands with copy and paste support.
18
18
  CLIPBOARD_COMMANDS = {
@@ -108,6 +108,13 @@ module Gist
108
108
  #
109
109
  # @see http://developer.github.com/v3/gists/
110
110
  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
+
111
118
  json = {}
112
119
 
113
120
  json[:description] = options[:description] if options[:description]
@@ -126,11 +133,6 @@ module Gist
126
133
  return if json[:files].empty? && options[:skip_empty]
127
134
 
128
135
  existing_gist = options[:update].to_s.split("/").last
129
- if options[:anonymous]
130
- access_token = nil
131
- else
132
- access_token = (options[:access_token] || auth_token())
133
- end
134
136
 
135
137
  url = "#{base_path}/gists"
136
138
  url << "/" << CGI.escape(existing_gist) if existing_gist.to_s != ''
@@ -6,7 +6,16 @@ describe '...' do
6
6
  end
7
7
 
8
8
  it "should return the raw file url" do
9
- Gist.gist("Test gist", :output => :raw_url, :anonymous => true).should == "https://gist.github.com/anonymous/XXXXXX/raw"
9
+ Gist.gist("Test gist", :output => :raw_url, :anonymous => false).should == "https://gist.github.com/anonymous/XXXXXX/raw"
10
+ end
11
+
12
+ it 'should raise an error when trying to do operations without being logged in' do
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)'
15
+
16
+ expect do
17
+ Gist.gist("Test gist", output: :raw_url, anonymous: true)
18
+ end.to raise_error(StandardError, error_msg)
10
19
  end
11
20
  end
12
21
 
@@ -5,11 +5,20 @@ describe '...' do
5
5
 
6
6
  it "should return a shortened version of the URL when response is 200" do
7
7
  stub_request(:post, "https://git.io/create").to_return(:status => 200, :body => 'XXXXXX')
8
- Gist.gist("Test gist", :output => :short_url, :anonymous => true).should == "https://git.io/XXXXXX"
8
+ Gist.gist("Test gist", :output => :short_url, anonymous: false).should == "https://git.io/XXXXXX"
9
9
  end
10
10
 
11
11
  it "should return a shortened version of the URL when response is 201" do
12
12
  stub_request(:post, "https://git.io/create").to_return(:status => 201, :headers => { 'Location' => 'https://git.io/XXXXXX' })
13
- Gist.gist("Test gist", :output => :short_url, :anonymous => true).should == "https://git.io/XXXXXX"
13
+ Gist.gist("Test gist", :output => :short_url, anonymous: false).should == "https://git.io/XXXXXX"
14
+ end
15
+
16
+ it 'should raise an error when trying to get short urls without being logged in' do
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)'
19
+
20
+ expect do
21
+ Gist.gist("Test gist", output: :short_url, anonymous: true)
22
+ end.to raise_error(StandardError, error_msg)
14
23
  end
15
24
  end
@@ -11,7 +11,7 @@ RSpec.configure do |config|
11
11
  mocks.syntax = :should
12
12
  end
13
13
  config.expect_with :rspec do |expectations|
14
- expectations.syntax = :should
14
+ expectations.syntax = [:should, :expect]
15
15
  end
16
16
  end
17
17
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gist
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.6.2
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Conrad Irwin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-01-09 00:00:00.000000000 Z
12
+ date: 2018-05-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake