gistl 4.14.2 → 4.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -9
- data/bin/gist +15 -1
- data/build/gist +38 -2
- data/build/gist.1 +1 -17
- data/lib/gist.rb +23 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8d8a28b0951be758446dc82c6d06b71fcec52b2
|
4
|
+
data.tar.gz: 0c014ef1ce48d583a4c1dfc8f7a9b06d5b2882d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0e1c5ec8053c1cb63df8a22c82994f5e3ef2bd2674c5c5894441c7f860adc201a243aeeefbc02557ef46ef7e079be9421290fa1b0348d51dcf1a63d85c8fc2d
|
7
|
+
data.tar.gz: 155100d01a2b83c669d4b270b653f17ba1cb76613f72a5c812ac2bf388943dd702f6581677b6386407250462319c9b0f47d491d3aafa797d916c0986033e72df
|
data/README.md
CHANGED
@@ -103,15 +103,6 @@ an OAuth2 token (with the "gist" permission).
|
|
103
103
|
2-factor auth code:
|
104
104
|
Success! https://github.com/settings/applications
|
105
105
|
|
106
|
-
You can read the 2-factor auth code from an sms or the authentication app,
|
107
|
-
depending on how you [set your account up](https://github.com/settings/admin).
|
108
|
-
|
109
|
-
Note: 2-factor authentication
|
110
|
-
[just appeared recently](https://github.com/blog/1614-two-factor-authentication),
|
111
|
-
so if you run into errors, update the gist gem.
|
112
|
-
|
113
|
-
gem update gist
|
114
|
-
|
115
106
|
This token is stored in `~/.gist` and used for all future gisting. If you need to
|
116
107
|
you can revoke it from https://github.com/settings/applications, or just delete the
|
117
108
|
file. If you need to store tokens for both github.com and a Github Enterprise instance
|
data/bin/gist
CHANGED
@@ -2,7 +2,10 @@
|
|
2
2
|
|
3
3
|
# Silence Ctrl-C's
|
4
4
|
trap('INT'){ exit 1 }
|
5
|
-
|
5
|
+
|
6
|
+
if Signal.list.include? 'PIPE'
|
7
|
+
trap('PIPE', 'EXIT')
|
8
|
+
end
|
6
9
|
|
7
10
|
require 'date'
|
8
11
|
require 'optparse'
|
@@ -47,6 +50,7 @@ original gist with the same GitHub account.
|
|
47
50
|
|
48
51
|
Usage: #{executable_name} [-o|-c|-e] [-p] [-s] [-R] [-d DESC] [-a] [-u URL] [-P] [-f NAME|-t EXT]* FILE*
|
49
52
|
#{executable_name} --login
|
53
|
+
#{executable_name} [-l|-r]
|
50
54
|
|
51
55
|
EOS
|
52
56
|
|
@@ -131,6 +135,10 @@ Usage: #{executable_name} [-o|-c|-e] [-p] [-s] [-R] [-d DESC] [-a] [-u URL] [-P]
|
|
131
135
|
options[:max_pages] = pages
|
132
136
|
end
|
133
137
|
|
138
|
+
opts.on("-r", "--read ID [FILENAME]", "Read a gist and print out the contents") do |id|
|
139
|
+
options[:read] = id
|
140
|
+
end
|
141
|
+
|
134
142
|
opts.on_tail("-h","--help", "Show this message.") do
|
135
143
|
puts opts
|
136
144
|
exit
|
@@ -166,6 +174,12 @@ begin
|
|
166
174
|
exit
|
167
175
|
end
|
168
176
|
|
177
|
+
if options.key? :read
|
178
|
+
file_name = ARGV.first
|
179
|
+
Gist.read_gist(options[:read], file_name)
|
180
|
+
exit
|
181
|
+
end
|
182
|
+
|
169
183
|
if options[:paste]
|
170
184
|
puts Gist.gist(Gist.paste, options)
|
171
185
|
else
|
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.5.0'
|
1322
1322
|
|
1323
1323
|
# A list of clipboard commands with copy and paste support.
|
1324
1324
|
CLIPBOARD_COMMANDS = {
|
@@ -1507,6 +1507,28 @@ module Gist
|
|
1507
1507
|
|
1508
1508
|
end
|
1509
1509
|
|
1510
|
+
def read_gist(id, file_name=nil)
|
1511
|
+
url = "#{base_path}/gists/#{id}"
|
1512
|
+
request = Net::HTTP::Get.new(url)
|
1513
|
+
response = http(api_url, request)
|
1514
|
+
|
1515
|
+
if response.code == '200'
|
1516
|
+
body = JSON.parse(response.body)
|
1517
|
+
files = body["files"]
|
1518
|
+
|
1519
|
+
if file_name
|
1520
|
+
file = files[file_name]
|
1521
|
+
raise Error, "Gist with id of #{id} and file #{file_name} does not exist." unless file
|
1522
|
+
else
|
1523
|
+
file = files.values.first
|
1524
|
+
end
|
1525
|
+
|
1526
|
+
puts file["content"]
|
1527
|
+
else
|
1528
|
+
raise Error, "Gist with id of #{id} does not exist."
|
1529
|
+
end
|
1530
|
+
end
|
1531
|
+
|
1510
1532
|
def get_gist_pages(url)
|
1511
1533
|
|
1512
1534
|
request = Net::HTTP::Get.new(url)
|
@@ -1820,7 +1842,10 @@ end
|
|
1820
1842
|
|
1821
1843
|
# Silence Ctrl-C's
|
1822
1844
|
trap('INT'){ exit 1 }
|
1823
|
-
|
1845
|
+
|
1846
|
+
if Signal.list.include? 'PIPE'
|
1847
|
+
trap('PIPE', 'EXIT')
|
1848
|
+
end
|
1824
1849
|
|
1825
1850
|
require 'optparse'
|
1826
1851
|
|
@@ -1863,6 +1888,7 @@ original gist with the same GitHub account.
|
|
1863
1888
|
|
1864
1889
|
Usage: #{executable_name} [-o|-c|-e] [-p] [-s] [-R] [-d DESC] [-a] [-u URL] [-P] [-f NAME|-t EXT]* FILE*
|
1865
1890
|
#{executable_name} --login
|
1891
|
+
#{executable_name} [-l|-r]
|
1866
1892
|
|
1867
1893
|
EOS
|
1868
1894
|
|
@@ -1932,6 +1958,10 @@ Usage: #{executable_name} [-o|-c|-e] [-p] [-s] [-R] [-d DESC] [-a] [-u URL] [-P]
|
|
1932
1958
|
options[:list] = user
|
1933
1959
|
end
|
1934
1960
|
|
1961
|
+
opts.on("-r", "--read ID [FILENAME]", "Read a gist and print out the contents") do |id|
|
1962
|
+
options[:read] = id
|
1963
|
+
end
|
1964
|
+
|
1935
1965
|
opts.on_tail("-h","--help", "Show this message.") do
|
1936
1966
|
puts opts
|
1937
1967
|
exit
|
@@ -1970,6 +2000,12 @@ begin
|
|
1970
2000
|
exit
|
1971
2001
|
end
|
1972
2002
|
|
2003
|
+
if options.key? :read
|
2004
|
+
file_name = ARGV.first
|
2005
|
+
Gist.read_gist(options[:read], file_name)
|
2006
|
+
exit
|
2007
|
+
end
|
2008
|
+
|
1973
2009
|
if options[:paste]
|
1974
2010
|
puts Gist.gist(Gist.paste, options)
|
1975
2011
|
else
|
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" "November 2015" "" "Gist manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBgist\fR \- upload code to https://gist\.github\.com
|
@@ -123,22 +123,6 @@ Success! https://github\.com/settings/applications
|
|
123
123
|
.IP "" 0
|
124
124
|
.
|
125
125
|
.P
|
126
|
-
You can read the 2\-factor auth code from an sms or the authentication app, depending on how you set your account up \fIhttps://github\.com/settings/admin\fR\.
|
127
|
-
.
|
128
|
-
.P
|
129
|
-
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\.
|
130
|
-
.
|
131
|
-
.IP "" 4
|
132
|
-
.
|
133
|
-
.nf
|
134
|
-
|
135
|
-
gem update gist
|
136
|
-
.
|
137
|
-
.fi
|
138
|
-
.
|
139
|
-
.IP "" 0
|
140
|
-
.
|
141
|
-
.P
|
142
126
|
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\.
|
143
127
|
.
|
144
128
|
.IP "\(bu" 4
|
data/lib/gist.rb
CHANGED
@@ -13,7 +13,7 @@ end
|
|
13
13
|
module Gist
|
14
14
|
extend self
|
15
15
|
|
16
|
-
VERSION = '4.
|
16
|
+
VERSION = '4.15.0'
|
17
17
|
|
18
18
|
# A list of clipboard commands with copy and paste support.
|
19
19
|
CLIPBOARD_COMMANDS = {
|
@@ -237,6 +237,28 @@ module Gist
|
|
237
237
|
|
238
238
|
end
|
239
239
|
|
240
|
+
def read_gist(id, file_name=nil)
|
241
|
+
url = "#{base_path}/gists/#{id}"
|
242
|
+
request = Net::HTTP::Get.new(url)
|
243
|
+
response = http(api_url, request)
|
244
|
+
|
245
|
+
if response.code == '200'
|
246
|
+
body = JSON.parse(response.body)
|
247
|
+
files = body["files"]
|
248
|
+
|
249
|
+
if file_name
|
250
|
+
file = files[file_name]
|
251
|
+
raise Error, "Gist with id of #{id} and file #{file_name} does not exist." unless file
|
252
|
+
else
|
253
|
+
file = files.values.first
|
254
|
+
end
|
255
|
+
|
256
|
+
puts file["content"]
|
257
|
+
else
|
258
|
+
raise Error, "Gist with id of #{id} does not exist."
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
240
262
|
# List gists given an API endpoint
|
241
263
|
#
|
242
264
|
# Pagination is handled, and all gists are listed by default.
|
@@ -247,7 +269,6 @@ module Gist
|
|
247
269
|
#
|
248
270
|
# see https://developer.github.com/v3/gists/#list-gists
|
249
271
|
def get_gist_pages(url, max_number=0, max_pages=0)
|
250
|
-
|
251
272
|
request = Net::HTTP::Get.new(url)
|
252
273
|
response = http(api_url, request)
|
253
274
|
number_listed = pretty_gist(response, max_number)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gistl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zhiming Wang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
114
|
version: '0'
|
115
115
|
requirements: []
|
116
116
|
rubyforge_project:
|
117
|
-
rubygems_version: 2.4.
|
117
|
+
rubygems_version: 2.4.5.1
|
118
118
|
signing_key:
|
119
119
|
specification_version: 4
|
120
120
|
summary: CLI/API gist client
|