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 +4 -4
- data/bin/gist +9 -11
- data/build/gist +17 -17
- data/build/gist.1 +1 -1
- data/lib/gist.rb +8 -6
- data/spec/rawify_spec.rb +10 -1
- data/spec/shorten_spec.rb +11 -2
- data/spec/spec_helper.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '009c779d5fc272fe71b6a1f8ae44d110f91bcfe1'
|
4
|
+
data.tar.gz: d57f1f9e76c336d05a0145b7f0f31904049567c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
28
|
-
|
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] [-
|
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 = '
|
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
|
-
|
1907
|
-
|
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] [-
|
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]
|
data/build/gist.1
CHANGED
data/lib/gist.rb
CHANGED
@@ -12,7 +12,7 @@ end
|
|
12
12
|
module Gist
|
13
13
|
extend self
|
14
14
|
|
15
|
-
VERSION = '
|
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 != ''
|
data/spec/rawify_spec.rb
CHANGED
@@ -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 =>
|
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
|
|
data/spec/shorten_spec.rb
CHANGED
@@ -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, :
|
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, :
|
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
|
data/spec/spec_helper.rb
CHANGED
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
|
+
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-
|
12
|
+
date: 2018-05-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|