gist 4.1.3 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +1 -1
- data/bin/gist +17 -8
- data/build/gist +80 -41
- data/build/gist.1 +19 -2
- data/lib/gist.rb +64 -34
- data/spec/rawify_spec.rb +12 -0
- metadata +75 -94
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 730e7eb88155102e71741d068a955fabedb5b13e
|
4
|
+
data.tar.gz: c0ec9f5d77a19f0e7b3a441b071f1bf70c3f76be
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 28e3e28669cd3a7d419dc87f8d28e10544fa01c9b9d013e04f68ffd35040ead7770f29738f21a8929c6543c0ff03adaf61cb32d2195c17f4e7ab566bedb598c6
|
7
|
+
data.tar.gz: 776b770dd8b1e4091fb4d0c342946764d3f38724f4386b0ca99eac4e8554a86871714f558d17d5bccd899df35103a322868d5c33f3d6645d82cc3d0cbdbdb3ba
|
data/Gemfile
CHANGED
data/bin/gist
CHANGED
@@ -1,13 +1,16 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
# Silence Ctrl-C's
|
4
|
+
trap('INT'){ exit 1 }
|
5
|
+
|
3
6
|
require 'optparse'
|
4
|
-
require
|
7
|
+
require 'gist'
|
5
8
|
|
6
9
|
# For the holdings of options.
|
7
10
|
options = {}
|
8
11
|
filenames = []
|
9
12
|
|
10
|
-
|
13
|
+
OptionParser.new do |opts|
|
11
14
|
executable_name = File.split($0)[1]
|
12
15
|
opts.banner = <<-EOS
|
13
16
|
Gist (v#{Gist::VERSION}) lets you upload to https://gist.github.com/
|
@@ -28,7 +31,8 @@ Anonymous gists are not associated with your GitHub account, they can be created
|
|
28
31
|
with "-a" even after you have used "gist --login".
|
29
32
|
|
30
33
|
If you would like to shorten the resulting gist URL, use the -s flag. This will
|
31
|
-
use GitHub's URL shortener, git.io.
|
34
|
+
use GitHub's URL shortener, git.io. You can also use -R to get the link to the
|
35
|
+
raw gist.
|
32
36
|
|
33
37
|
To copy the resulting URL to your clipboard you can use the -c option, or to
|
34
38
|
just open it directly in your browser, use -o. Using the -e option will copy the
|
@@ -39,7 +43,7 @@ Instead of creating a new gist, you can update an existing one by passing its ID
|
|
39
43
|
or URL with "-u". For this to work, you must be logged in, and have created the
|
40
44
|
original gist with the same GitHub account.
|
41
45
|
|
42
|
-
Usage: #{executable_name} [-o|-c|-e] [-p] [-s] [-d DESC] [-a] [-u URL] [-P] [-f NAME|-t EXT]* FILE*
|
46
|
+
Usage: #{executable_name} [-o|-c|-e] [-p] [-s] [-R] [-d DESC] [-a] [-u URL] [-P] [-f NAME|-t EXT]* FILE*
|
43
47
|
#{executable_name} --login
|
44
48
|
|
45
49
|
EOS
|
@@ -102,6 +106,10 @@ Usage: #{executable_name} [-o|-c|-e] [-p] [-s] [-d DESC] [-a] [-u URL] [-P] [-f
|
|
102
106
|
options[:paste] = true
|
103
107
|
end
|
104
108
|
|
109
|
+
opts.on("-R", "--raw", "Raw url of the new gist") do
|
110
|
+
options[:raw] = true
|
111
|
+
end
|
112
|
+
|
105
113
|
opts.on_tail("-h","--help", "Show this message.") do
|
106
114
|
puts opts
|
107
115
|
exit
|
@@ -112,16 +120,19 @@ Usage: #{executable_name} [-o|-c|-e] [-p] [-s] [-d DESC] [-a] [-u URL] [-P] [-f
|
|
112
120
|
exit
|
113
121
|
end
|
114
122
|
|
115
|
-
end
|
116
|
-
opts.parse!
|
123
|
+
end.parse!
|
117
124
|
|
118
125
|
begin
|
119
126
|
options[:output] = if options[:embed] && options[:shorten]
|
120
127
|
raise Gist::Error, "--embed does not make sense with --shorten"
|
121
128
|
elsif options[:embed]
|
122
129
|
:javascript
|
130
|
+
elsif options[:shorten] and options[:raw]
|
131
|
+
:short_raw_url
|
123
132
|
elsif options[:shorten]
|
124
133
|
:short_url
|
134
|
+
elsif options[:raw]
|
135
|
+
:raw_url
|
125
136
|
else
|
126
137
|
:html_url
|
127
138
|
end
|
@@ -152,6 +163,4 @@ begin
|
|
152
163
|
rescue Gist::Error => e
|
153
164
|
puts "Error: #{e.message}"
|
154
165
|
exit 1
|
155
|
-
rescue Interrupt
|
156
|
-
# bye!
|
157
166
|
end
|
data/build/gist
CHANGED
@@ -1318,7 +1318,7 @@ end
|
|
1318
1318
|
module Gist
|
1319
1319
|
extend self
|
1320
1320
|
|
1321
|
-
VERSION = '4.
|
1321
|
+
VERSION = '4.2.0'
|
1322
1322
|
|
1323
1323
|
# A list of clipboard commands with copy and paste support.
|
1324
1324
|
CLIPBOARD_COMMANDS = {
|
@@ -1442,6 +1442,25 @@ module Gist
|
|
1442
1442
|
end
|
1443
1443
|
end
|
1444
1444
|
|
1445
|
+
# Convert github url into raw file url
|
1446
|
+
#
|
1447
|
+
# Unfortunately the url returns from github's api is legacy,
|
1448
|
+
# we have to taking a HTTPRedirection before appending it
|
1449
|
+
# with '/raw'. Let's looking forward for github's api fix :)
|
1450
|
+
#
|
1451
|
+
# @param [String] url
|
1452
|
+
# @return [String] the raw file url
|
1453
|
+
def rawify(url)
|
1454
|
+
uri = URI(url)
|
1455
|
+
request = Net::HTTP::Get.new(uri.path)
|
1456
|
+
response = http(uri, request)
|
1457
|
+
if Net::HTTPSuccess === response
|
1458
|
+
url + '/raw'
|
1459
|
+
elsif Net::HTTPRedirection === response
|
1460
|
+
rawify(response.header['location'])
|
1461
|
+
end
|
1462
|
+
end
|
1463
|
+
|
1445
1464
|
# Log the user into gist.
|
1446
1465
|
#
|
1447
1466
|
# This method asks the user for a username and password, and tries to obtain
|
@@ -1454,44 +1473,50 @@ module Gist
|
|
1454
1473
|
# @see http://developer.github.com/v3/oauth/
|
1455
1474
|
def login!(credentials={})
|
1456
1475
|
puts "Obtaining OAuth2 access_token from github."
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
request = Net::HTTP::Post.new("#{base_path}/authorizations")
|
1469
|
-
request.body = JSON.dump({
|
1470
|
-
:scopes => [:gist],
|
1471
|
-
:note => "The gist gem",
|
1472
|
-
:note_url => "https://github.com/ConradIrwin/gist"
|
1473
|
-
})
|
1474
|
-
request.content_type = 'application/json'
|
1475
|
-
request.basic_auth(username, password)
|
1476
|
-
|
1477
|
-
response = http(api_url, request)
|
1478
|
-
|
1479
|
-
if Net::HTTPUnauthorized === response && response['X-GitHub-OTP']
|
1480
|
-
print "2-factor auth code: "
|
1481
|
-
twofa_code = $stdin.gets.strip
|
1476
|
+
loop do
|
1477
|
+
print "GitHub username: "
|
1478
|
+
username = credentials[:username] || $stdin.gets.strip
|
1479
|
+
print "GitHub password: "
|
1480
|
+
password = credentials[:password] || begin
|
1481
|
+
`stty -echo` rescue nil
|
1482
|
+
$stdin.gets.strip
|
1483
|
+
ensure
|
1484
|
+
`stty echo` rescue nil
|
1485
|
+
end
|
1482
1486
|
puts ""
|
1483
1487
|
|
1484
|
-
request
|
1488
|
+
request = Net::HTTP::Post.new("#{base_path}/authorizations")
|
1489
|
+
request.body = JSON.dump({
|
1490
|
+
:scopes => [:gist],
|
1491
|
+
:note => "The gist gem",
|
1492
|
+
:note_url => "https://github.com/ConradIrwin/gist"
|
1493
|
+
})
|
1494
|
+
request.content_type = 'application/json'
|
1495
|
+
request.basic_auth(username, password)
|
1496
|
+
|
1485
1497
|
response = http(api_url, request)
|
1486
|
-
end
|
1487
1498
|
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1499
|
+
if Net::HTTPUnauthorized === response && response['X-GitHub-OTP']
|
1500
|
+
print "2-factor auth code: "
|
1501
|
+
twofa_code = $stdin.gets.strip
|
1502
|
+
puts ""
|
1503
|
+
|
1504
|
+
request['X-GitHub-OTP'] = twofa_code
|
1505
|
+
response = http(api_url, request)
|
1506
|
+
end
|
1507
|
+
|
1508
|
+
if Net::HTTPCreated === response
|
1509
|
+
File.open(auth_token_file, 'w', 0600) do |f|
|
1510
|
+
f.write JSON.parse(response.body)['token']
|
1511
|
+
end
|
1512
|
+
puts "Success! #{ENV[URL_ENV_NAME] || "https://github.com/"}settings/applications"
|
1513
|
+
return
|
1514
|
+
elsif Net::HTTPUnauthorized === response
|
1515
|
+
puts "Error: #{JSON.parse(response.body)['message']}"
|
1516
|
+
next
|
1517
|
+
else
|
1518
|
+
raise "Got #{response.class} from gist: #{response.body}"
|
1491
1519
|
end
|
1492
|
-
puts "Success! #{ENV[URL_ENV_NAME] || "https://github.com/"}settings/applications"
|
1493
|
-
else
|
1494
|
-
raise "Got #{response.class} from gist: #{response.body}"
|
1495
1520
|
end
|
1496
1521
|
rescue => e
|
1497
1522
|
raise e.extend Error
|
@@ -1546,8 +1571,12 @@ module Gist
|
|
1546
1571
|
%Q{<script src="#{json['html_url']}.js"></script>}
|
1547
1572
|
when :html_url
|
1548
1573
|
json['html_url']
|
1574
|
+
when :raw_url
|
1575
|
+
rawify(json['html_url'])
|
1549
1576
|
when :short_url
|
1550
1577
|
shorten(json['html_url'])
|
1578
|
+
when :short_raw_url
|
1579
|
+
shorten(rawify(json['html_url']))
|
1551
1580
|
else
|
1552
1581
|
json
|
1553
1582
|
end
|
@@ -1635,6 +1664,7 @@ Could not find copy command, tried:
|
|
1635
1664
|
elsif RUBY_PLATFORM =~ /linux/
|
1636
1665
|
%w(
|
1637
1666
|
sensible-browser
|
1667
|
+
xdg-open
|
1638
1668
|
firefox
|
1639
1669
|
firefox-bin
|
1640
1670
|
).detect do |cmd|
|
@@ -1682,13 +1712,16 @@ Could not find copy command, tried:
|
|
1682
1712
|
end
|
1683
1713
|
#!/usr/bin/env ruby
|
1684
1714
|
|
1715
|
+
# Silence Ctrl-C's
|
1716
|
+
trap('INT'){ exit 1 }
|
1717
|
+
|
1685
1718
|
require 'optparse'
|
1686
1719
|
|
1687
1720
|
# For the holdings of options.
|
1688
1721
|
options = {}
|
1689
1722
|
filenames = []
|
1690
1723
|
|
1691
|
-
|
1724
|
+
OptionParser.new do |opts|
|
1692
1725
|
executable_name = File.split($0)[1]
|
1693
1726
|
opts.banner = <<-EOS
|
1694
1727
|
Gist (v#{Gist::VERSION}) lets you upload to https://gist.github.com/
|
@@ -1709,7 +1742,8 @@ Anonymous gists are not associated with your GitHub account, they can be created
|
|
1709
1742
|
with "-a" even after you have used "gist --login".
|
1710
1743
|
|
1711
1744
|
If you would like to shorten the resulting gist URL, use the -s flag. This will
|
1712
|
-
use GitHub's URL shortener, git.io.
|
1745
|
+
use GitHub's URL shortener, git.io. You can also use -R to get the link to the
|
1746
|
+
raw gist.
|
1713
1747
|
|
1714
1748
|
To copy the resulting URL to your clipboard you can use the -c option, or to
|
1715
1749
|
just open it directly in your browser, use -o. Using the -e option will copy the
|
@@ -1720,7 +1754,7 @@ Instead of creating a new gist, you can update an existing one by passing its ID
|
|
1720
1754
|
or URL with "-u". For this to work, you must be logged in, and have created the
|
1721
1755
|
original gist with the same GitHub account.
|
1722
1756
|
|
1723
|
-
Usage: #{executable_name} [-o|-c|-e] [-p] [-s] [-d DESC] [-a] [-u URL] [-P] [-f NAME|-t EXT]* FILE*
|
1757
|
+
Usage: #{executable_name} [-o|-c|-e] [-p] [-s] [-R] [-d DESC] [-a] [-u URL] [-P] [-f NAME|-t EXT]* FILE*
|
1724
1758
|
#{executable_name} --login
|
1725
1759
|
|
1726
1760
|
EOS
|
@@ -1783,6 +1817,10 @@ Usage: #{executable_name} [-o|-c|-e] [-p] [-s] [-d DESC] [-a] [-u URL] [-P] [-f
|
|
1783
1817
|
options[:paste] = true
|
1784
1818
|
end
|
1785
1819
|
|
1820
|
+
opts.on("-R", "--raw", "Raw url of the new gist") do
|
1821
|
+
options[:raw] = true
|
1822
|
+
end
|
1823
|
+
|
1786
1824
|
opts.on_tail("-h","--help", "Show this message.") do
|
1787
1825
|
puts opts
|
1788
1826
|
exit
|
@@ -1793,16 +1831,19 @@ Usage: #{executable_name} [-o|-c|-e] [-p] [-s] [-d DESC] [-a] [-u URL] [-P] [-f
|
|
1793
1831
|
exit
|
1794
1832
|
end
|
1795
1833
|
|
1796
|
-
end
|
1797
|
-
opts.parse!
|
1834
|
+
end.parse!
|
1798
1835
|
|
1799
1836
|
begin
|
1800
1837
|
options[:output] = if options[:embed] && options[:shorten]
|
1801
1838
|
raise Gist::Error, "--embed does not make sense with --shorten"
|
1802
1839
|
elsif options[:embed]
|
1803
1840
|
:javascript
|
1841
|
+
elsif options[:shorten] and options[:raw]
|
1842
|
+
:short_raw_url
|
1804
1843
|
elsif options[:shorten]
|
1805
1844
|
:short_url
|
1845
|
+
elsif options[:raw]
|
1846
|
+
:raw_url
|
1806
1847
|
else
|
1807
1848
|
:html_url
|
1808
1849
|
end
|
@@ -1833,6 +1874,4 @@ begin
|
|
1833
1874
|
rescue Gist::Error => e
|
1834
1875
|
puts "Error: #{e.message}"
|
1835
1876
|
exit 1
|
1836
|
-
rescue Interrupt
|
1837
|
-
# bye!
|
1838
1877
|
end
|
data/build/gist.1
CHANGED
@@ -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" "
|
4
|
+
.TH "GIST" "1" "December 2013" "" "Gist manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBgist\fR \- upload code to https://gist\.github\.com
|
@@ -101,6 +101,7 @@ gist \-\-login
|
|
101
101
|
Obtaining OAuth2 access_token from github\.
|
102
102
|
GitHub username: ConradIrwin
|
103
103
|
GitHub password:
|
104
|
+
2\-factor auth code:
|
104
105
|
Success! https://github\.com/settings/applications
|
105
106
|
.
|
106
107
|
.fi
|
@@ -108,7 +109,23 @@ Success! https://github\.com/settings/applications
|
|
108
109
|
.IP "" 0
|
109
110
|
.
|
110
111
|
.P
|
111
|
-
|
112
|
+
You can read the 2\-factor auth code from an sms or the authentification app, depending on how you set your account up \fIhttps://github\.com/settings/admin\fR\.
|
113
|
+
.
|
114
|
+
.P
|
115
|
+
Note: 2\-factor authentication just appeared recently \fIhttps://github\.com/blog/1614\-two\-factor\-authentication\fR, so if you run into errors, update the gist gem\.
|
116
|
+
.
|
117
|
+
.IP "" 4
|
118
|
+
.
|
119
|
+
.nf
|
120
|
+
|
121
|
+
gem update gist
|
122
|
+
.
|
123
|
+
.fi
|
124
|
+
.
|
125
|
+
.IP "" 0
|
126
|
+
.
|
127
|
+
.P
|
128
|
+
This token is stored in \fB~/\.gist\fR and used for all future gisting\. If you need to you can revoke it from https://github\.com/settings/applications, or just delete the file\. If you need to store tokens for both github\.com and a Github Enterprise instance you can save your Github Enterprise token in \fB~/\.gist\.github\.example\.com\fR where "github\.example\.com" is the URL for your Github Enterprise instance\.
|
112
129
|
.
|
113
130
|
.IP "\(bu" 4
|
114
131
|
After you\'ve done this, you can still upload gists anonymously with \fB\-a\fR\.
|
data/lib/gist.rb
CHANGED
@@ -12,7 +12,7 @@ end
|
|
12
12
|
module Gist
|
13
13
|
extend self
|
14
14
|
|
15
|
-
VERSION = '4.
|
15
|
+
VERSION = '4.2.0'
|
16
16
|
|
17
17
|
# A list of clipboard commands with copy and paste support.
|
18
18
|
CLIPBOARD_COMMANDS = {
|
@@ -136,6 +136,25 @@ module Gist
|
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
139
|
+
# Convert github url into raw file url
|
140
|
+
#
|
141
|
+
# Unfortunately the url returns from github's api is legacy,
|
142
|
+
# we have to taking a HTTPRedirection before appending it
|
143
|
+
# with '/raw'. Let's looking forward for github's api fix :)
|
144
|
+
#
|
145
|
+
# @param [String] url
|
146
|
+
# @return [String] the raw file url
|
147
|
+
def rawify(url)
|
148
|
+
uri = URI(url)
|
149
|
+
request = Net::HTTP::Get.new(uri.path)
|
150
|
+
response = http(uri, request)
|
151
|
+
if Net::HTTPSuccess === response
|
152
|
+
url + '/raw'
|
153
|
+
elsif Net::HTTPRedirection === response
|
154
|
+
rawify(response.header['location'])
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
139
158
|
# Log the user into gist.
|
140
159
|
#
|
141
160
|
# This method asks the user for a username and password, and tries to obtain
|
@@ -148,44 +167,50 @@ module Gist
|
|
148
167
|
# @see http://developer.github.com/v3/oauth/
|
149
168
|
def login!(credentials={})
|
150
169
|
puts "Obtaining OAuth2 access_token from github."
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
request = Net::HTTP::Post.new("#{base_path}/authorizations")
|
163
|
-
request.body = JSON.dump({
|
164
|
-
:scopes => [:gist],
|
165
|
-
:note => "The gist gem",
|
166
|
-
:note_url => "https://github.com/ConradIrwin/gist"
|
167
|
-
})
|
168
|
-
request.content_type = 'application/json'
|
169
|
-
request.basic_auth(username, password)
|
170
|
-
|
171
|
-
response = http(api_url, request)
|
172
|
-
|
173
|
-
if Net::HTTPUnauthorized === response && response['X-GitHub-OTP']
|
174
|
-
print "2-factor auth code: "
|
175
|
-
twofa_code = $stdin.gets.strip
|
170
|
+
loop do
|
171
|
+
print "GitHub username: "
|
172
|
+
username = credentials[:username] || $stdin.gets.strip
|
173
|
+
print "GitHub password: "
|
174
|
+
password = credentials[:password] || begin
|
175
|
+
`stty -echo` rescue nil
|
176
|
+
$stdin.gets.strip
|
177
|
+
ensure
|
178
|
+
`stty echo` rescue nil
|
179
|
+
end
|
176
180
|
puts ""
|
177
181
|
|
178
|
-
request
|
182
|
+
request = Net::HTTP::Post.new("#{base_path}/authorizations")
|
183
|
+
request.body = JSON.dump({
|
184
|
+
:scopes => [:gist],
|
185
|
+
:note => "The gist gem",
|
186
|
+
:note_url => "https://github.com/ConradIrwin/gist"
|
187
|
+
})
|
188
|
+
request.content_type = 'application/json'
|
189
|
+
request.basic_auth(username, password)
|
190
|
+
|
179
191
|
response = http(api_url, request)
|
180
|
-
end
|
181
192
|
|
182
|
-
|
183
|
-
|
184
|
-
|
193
|
+
if Net::HTTPUnauthorized === response && response['X-GitHub-OTP']
|
194
|
+
print "2-factor auth code: "
|
195
|
+
twofa_code = $stdin.gets.strip
|
196
|
+
puts ""
|
197
|
+
|
198
|
+
request['X-GitHub-OTP'] = twofa_code
|
199
|
+
response = http(api_url, request)
|
200
|
+
end
|
201
|
+
|
202
|
+
if Net::HTTPCreated === response
|
203
|
+
File.open(auth_token_file, 'w', 0600) do |f|
|
204
|
+
f.write JSON.parse(response.body)['token']
|
205
|
+
end
|
206
|
+
puts "Success! #{ENV[URL_ENV_NAME] || "https://github.com/"}settings/applications"
|
207
|
+
return
|
208
|
+
elsif Net::HTTPUnauthorized === response
|
209
|
+
puts "Error: #{JSON.parse(response.body)['message']}"
|
210
|
+
next
|
211
|
+
else
|
212
|
+
raise "Got #{response.class} from gist: #{response.body}"
|
185
213
|
end
|
186
|
-
puts "Success! #{ENV[URL_ENV_NAME] || "https://github.com/"}settings/applications"
|
187
|
-
else
|
188
|
-
raise "Got #{response.class} from gist: #{response.body}"
|
189
214
|
end
|
190
215
|
rescue => e
|
191
216
|
raise e.extend Error
|
@@ -240,8 +265,12 @@ module Gist
|
|
240
265
|
%Q{<script src="#{json['html_url']}.js"></script>}
|
241
266
|
when :html_url
|
242
267
|
json['html_url']
|
268
|
+
when :raw_url
|
269
|
+
rawify(json['html_url'])
|
243
270
|
when :short_url
|
244
271
|
shorten(json['html_url'])
|
272
|
+
when :short_raw_url
|
273
|
+
shorten(rawify(json['html_url']))
|
245
274
|
else
|
246
275
|
json
|
247
276
|
end
|
@@ -329,6 +358,7 @@ Could not find copy command, tried:
|
|
329
358
|
elsif RUBY_PLATFORM =~ /linux/
|
330
359
|
%w(
|
331
360
|
sensible-browser
|
361
|
+
xdg-open
|
332
362
|
firefox
|
333
363
|
firefox-bin
|
334
364
|
).detect do |cmd|
|
data/spec/rawify_spec.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
describe '...' do
|
2
|
+
before do
|
3
|
+
stub_request(:post, /api\.github.com\/gists/).to_return(:body => '{"html_url": "https://gist.github.com/XXXXXX"}')
|
4
|
+
stub_request(:get, "https://gist.github.com/XXXXXX").to_return(:status => 304, :headers => { 'Location' => 'https://gist.github.com/anonymous/XXXXXX' })
|
5
|
+
stub_request(:get, "https://gist.github.com/anonymous/XXXXXX").to_return(:status => 200)
|
6
|
+
end
|
7
|
+
|
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"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
metadata
CHANGED
@@ -1,92 +1,81 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: gist
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 4
|
8
|
-
- 1
|
9
|
-
- 3
|
10
|
-
version: 4.1.3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 4.2.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Conrad Irwin
|
14
|
-
-
|
15
|
-
4piIa2luZw==
|
16
|
-
|
8
|
+
- ☈king
|
17
9
|
autorequire:
|
18
10
|
bindir: bin
|
19
11
|
cert_chain: []
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-12-26 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
24
15
|
name: rake
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
- !ruby/object:Gem::Version
|
31
|
-
hash: 3
|
32
|
-
segments:
|
33
|
-
- 0
|
34
|
-
version: "0"
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - '>='
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
35
21
|
type: :development
|
36
|
-
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: rspec
|
39
22
|
prerelease: false
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - '>='
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rspec
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
49
35
|
type: :development
|
50
|
-
version_requirements: *id002
|
51
|
-
- !ruby/object:Gem::Dependency
|
52
|
-
name: webmock
|
53
36
|
prerelease: false
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: webmock
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
63
49
|
type: :development
|
64
|
-
version_requirements: *id003
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
|
-
name: ronn
|
67
50
|
prerelease: false
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: ronn
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
77
63
|
type: :development
|
78
|
-
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
79
70
|
description: Provides a single function (Gist.gist) that uploads a gist.
|
80
|
-
email:
|
71
|
+
email:
|
81
72
|
- conrad.irwin@gmail.com
|
82
73
|
- rkingist@sharpsaw.org
|
83
|
-
executables:
|
74
|
+
executables:
|
84
75
|
- gist
|
85
76
|
extensions: []
|
86
|
-
|
87
77
|
extra_rdoc_files: []
|
88
|
-
|
89
|
-
files:
|
78
|
+
files:
|
90
79
|
- .gitignore
|
91
80
|
- .rspec
|
92
81
|
- Gemfile
|
@@ -102,41 +91,33 @@ files:
|
|
102
91
|
- spec/ghe_spec.rb
|
103
92
|
- spec/gist_spec.rb
|
104
93
|
- spec/proxy_spec.rb
|
94
|
+
- spec/rawify_spec.rb
|
105
95
|
- spec/shorten_spec.rb
|
106
96
|
- spec/spec_helper.rb
|
107
97
|
- vendor/json.rb
|
108
98
|
homepage: https://github.com/defunkt/gist
|
109
|
-
licenses:
|
99
|
+
licenses:
|
110
100
|
- MIT
|
101
|
+
metadata: {}
|
111
102
|
post_install_message:
|
112
103
|
rdoc_options: []
|
113
|
-
|
114
|
-
require_paths:
|
104
|
+
require_paths:
|
115
105
|
- lib
|
116
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
none: false
|
127
|
-
requirements:
|
128
|
-
- - ">="
|
129
|
-
- !ruby/object:Gem::Version
|
130
|
-
hash: 3
|
131
|
-
segments:
|
132
|
-
- 0
|
133
|
-
version: "0"
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - '>='
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
134
116
|
requirements: []
|
135
|
-
|
136
117
|
rubyforge_project:
|
137
|
-
rubygems_version:
|
118
|
+
rubygems_version: 2.0.3
|
138
119
|
signing_key:
|
139
|
-
specification_version:
|
120
|
+
specification_version: 4
|
140
121
|
summary: Just allows you to upload gists
|
141
122
|
test_files: []
|
142
|
-
|
123
|
+
has_rdoc:
|