gist 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +20 -6
- data/Rakefile +1 -1
- data/lib/gist.rb +25 -10
- data/lib/gist/version.rb +1 -1
- data/man/gist.1 +23 -3
- data/man/gist.1.html +14 -2
- data/man/gist.1.ron +32 -3
- metadata +12 -5
data/README.markdown
CHANGED
@@ -6,9 +6,15 @@ Works great with Gist: The Website.
|
|
6
6
|
Installation
|
7
7
|
------------
|
8
8
|
|
9
|
-
|
9
|
+
[homebrew](http://mxcl.github.com/homebrew/):
|
10
|
+
|
11
|
+
brew install gist
|
12
|
+
gist -h
|
13
|
+
|
14
|
+
RubyGems:
|
10
15
|
|
11
16
|
gem install gist
|
17
|
+
gist -h
|
12
18
|
|
13
19
|
Old school:
|
14
20
|
|
@@ -28,8 +34,15 @@ Use
|
|
28
34
|
|
29
35
|
Authentication
|
30
36
|
--------------
|
37
|
+
There are two ways to set GitHub user and token info:
|
38
|
+
|
39
|
+
Using env vars GITHUB_USER and GITHUB_TOKEN:
|
31
40
|
|
32
|
-
|
41
|
+
$ export GITHUB_USER="your-github-username"
|
42
|
+
$ export GITHUB_TOKEN="your-github-token"
|
43
|
+
$ gist ~/example
|
44
|
+
|
45
|
+
Or by having your git config set up with your GitHub username and token.
|
33
46
|
|
34
47
|
git config --global github.user "your-github-username"
|
35
48
|
git config --global github.token "your-github-token"
|
@@ -56,6 +69,8 @@ control the default behavior of gist(1).
|
|
56
69
|
|
57
70
|
* gist.extension - string - Default extension for gists you create.
|
58
71
|
|
72
|
+
* gist.browse - boolean (yes or no) - Whether to open the gist in your
|
73
|
+
browser after creation. Default: yes
|
59
74
|
|
60
75
|
Proxies
|
61
76
|
-------
|
@@ -72,8 +87,7 @@ Visit <http://defunkt.github.com/gist/> or use:
|
|
72
87
|
|
73
88
|
$ gist -m
|
74
89
|
|
90
|
+
Bugs
|
91
|
+
----
|
75
92
|
|
76
|
-
|
77
|
-
--------------
|
78
|
-
|
79
|
-
![Ninja vs Shark](http://github.com/defunkt/gist/tree/master%2Fbattle.png?raw=true)
|
93
|
+
<http://github.com/defunkt/gist/issues>
|
data/Rakefile
CHANGED
data/lib/gist.rb
CHANGED
@@ -35,6 +35,7 @@ module Gist
|
|
35
35
|
private_gist = defaults["private"]
|
36
36
|
gist_filename = nil
|
37
37
|
gist_extension = defaults["extension"]
|
38
|
+
browse_enabled = defaults["browse"]
|
38
39
|
|
39
40
|
opts = OptionParser.new do |opts|
|
40
41
|
opts.banner = "Usage: gist [options] [filename or stdin]"
|
@@ -48,6 +49,10 @@ module Gist
|
|
48
49
|
gist_extension = '.' + extension
|
49
50
|
end
|
50
51
|
|
52
|
+
opts.on('-o','--[no-]open', 'Open gist in browser') do |o|
|
53
|
+
browse_enabled = o
|
54
|
+
end
|
55
|
+
|
51
56
|
opts.on('-m', '--man', 'Print manual') do
|
52
57
|
Gist::Manpage.display("gist")
|
53
58
|
end
|
@@ -89,7 +94,7 @@ module Gist
|
|
89
94
|
end
|
90
95
|
|
91
96
|
url = write(input, private_gist, gist_extension, gist_filename)
|
92
|
-
browse(url)
|
97
|
+
browse(url) if browse_enabled
|
93
98
|
puts copy(url)
|
94
99
|
rescue => e
|
95
100
|
warn e
|
@@ -115,21 +120,24 @@ module Gist
|
|
115
120
|
end
|
116
121
|
|
117
122
|
# Given a url, tries to open it in your browser.
|
118
|
-
# TODO: Linux
|
123
|
+
# TODO: Linux
|
119
124
|
def browse(url)
|
120
125
|
if RUBY_PLATFORM =~ /darwin/
|
121
126
|
`open #{url}`
|
127
|
+
elsif ENV['OS'] == 'Windows_NT' or
|
128
|
+
RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw|wince/i
|
129
|
+
`start "" "#{url}"`
|
122
130
|
end
|
123
131
|
end
|
124
132
|
|
125
133
|
# Tries to copy passed content to the clipboard.
|
126
134
|
def copy(content)
|
127
135
|
cmd = case true
|
128
|
-
when system("type pbcopy > /dev/null")
|
136
|
+
when system("type pbcopy > /dev/null 2>&1")
|
129
137
|
:pbcopy
|
130
|
-
when system("type xclip > /dev/null")
|
138
|
+
when system("type xclip > /dev/null 2>&1")
|
131
139
|
:xclip
|
132
|
-
when system("type putclip > /dev/null")
|
140
|
+
when system("type putclip > /dev/null 2>&1")
|
133
141
|
:putclip
|
134
142
|
end
|
135
143
|
|
@@ -168,19 +176,26 @@ private
|
|
168
176
|
# gist.private - boolean
|
169
177
|
# gist.extension - string
|
170
178
|
def defaults
|
171
|
-
priv = config("gist.private")
|
172
179
|
extension = config("gist.extension")
|
173
180
|
extension = nil if extension && extension.empty?
|
174
181
|
|
175
182
|
return {
|
176
|
-
"private" =>
|
177
|
-
"
|
183
|
+
"private" => config("gist.private"),
|
184
|
+
"browse" => config("gist.browse"),
|
185
|
+
"extension" => extension,
|
178
186
|
}
|
179
187
|
end
|
180
188
|
|
181
|
-
# Reads a config value using
|
182
|
-
#
|
189
|
+
# Reads a config value using:
|
190
|
+
# => Environement: GITHUB_TOKEN, GITHUB_USER
|
191
|
+
# like vim gist plugin
|
192
|
+
# => git-config(1)
|
193
|
+
#
|
194
|
+
# return something useful or nil
|
183
195
|
def config(key)
|
196
|
+
env_key = ENV[key.upcase.gsub(/\./, '_')]
|
197
|
+
return env_key if env_key and not env_key.empty?
|
198
|
+
|
184
199
|
str_to_bool `git config --global #{key}`.strip
|
185
200
|
end
|
186
201
|
|
data/lib/gist/version.rb
CHANGED
data/man/gist.1
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
.\" generated with Ronn/v0.
|
1
|
+
.\" generated with Ronn/v0.5
|
2
2
|
.\" http://github.com/rtomayko/ronn/
|
3
3
|
.
|
4
|
-
.TH "GIST" "1" "
|
4
|
+
.TH "GIST" "1" "May 2010" "GITHUB" "Gist Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBgist\fR \-\- gist on the command line
|
@@ -52,11 +52,28 @@ Print help.
|
|
52
52
|
Display this man page.
|
53
53
|
.
|
54
54
|
.SH "CONFIGURATION"
|
55
|
+
There are two ways to set GitHub user and token info:
|
56
|
+
.
|
57
|
+
.IP "\(bu" 4
|
58
|
+
Using env vars GITHUB_USER and GITHUB_TOKEN
|
59
|
+
.
|
60
|
+
.IP
|
61
|
+
$ export GITHUB_USER=johndoe
|
62
|
+
$ export GITHUB_TOKEN=mysecretgithubtoken
|
63
|
+
$ gist ~/example
|
64
|
+
.
|
65
|
+
.IP "\(bu" 4
|
66
|
+
Using git\-config(1)
|
67
|
+
.
|
68
|
+
.IP "" 0
|
69
|
+
.
|
70
|
+
.P
|
55
71
|
Use git\-config(1) to display the currently configured GitHub username:
|
56
72
|
.
|
57
73
|
.IP "" 4
|
58
74
|
.
|
59
75
|
.nf
|
76
|
+
|
60
77
|
$ git config \-\-global github.user
|
61
78
|
.
|
62
79
|
.fi
|
@@ -69,6 +86,7 @@ Or, set the GitHub username with:
|
|
69
86
|
.IP "" 4
|
70
87
|
.
|
71
88
|
.nf
|
89
|
+
|
72
90
|
$ git config \-\-global github.user <username>
|
73
91
|
.
|
74
92
|
.fi
|
@@ -85,6 +103,7 @@ information.
|
|
85
103
|
.IP "" 4
|
86
104
|
.
|
87
105
|
.nf
|
106
|
+
|
88
107
|
$ HTTP_PROXY=http://host:port/ gist script.py
|
89
108
|
.
|
90
109
|
.fi
|
@@ -94,6 +113,7 @@ $ HTTP_PROXY=http://host:port/ gist script.py
|
|
94
113
|
.SH "EXAMPLES"
|
95
114
|
.
|
96
115
|
.nf
|
116
|
+
|
97
117
|
$ gist < file.txt
|
98
118
|
$ echo secret | gist \-\-private
|
99
119
|
$ echo "puts :hi" | gist \-t rb
|
@@ -108,4 +128,4 @@ $ gist script.py
|
|
108
128
|
Chris Wanstrath :: chris@ozmm.org
|
109
129
|
.
|
110
130
|
.SH "SEE ALSO"
|
111
|
-
hub(1), git(1), git\-clone(1)
|
131
|
+
hub(1), git(1), git\-clone(1), \fIhttp://github.com\fR, \fIhttp://github.com/defunkt/gist\fR
|
data/man/gist.1.html
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<meta http-equiv='content-type' value='text/html;charset=utf8'>
|
5
|
-
<meta name='generator' value='Ronn/v0.
|
5
|
+
<meta name='generator' value='Ronn/v0.5'>
|
6
6
|
<title>gist(1) -- gist on the command line</title>
|
7
7
|
<style type='text/css'>
|
8
8
|
body {margin:0}
|
@@ -107,6 +107,18 @@ the gist is created as a Ruby file.</p></dd>
|
|
107
107
|
|
108
108
|
<h2>CONFIGURATION</h2>
|
109
109
|
|
110
|
+
<p>There are two ways to set GitHub user and token info:</p>
|
111
|
+
|
112
|
+
<ul>
|
113
|
+
<li><p>Using env vars GITHUB_USER and GITHUB_TOKEN</p>
|
114
|
+
|
115
|
+
<p>$ export GITHUB_USER=johndoe
|
116
|
+
$ export GITHUB_TOKEN=mysecretgithubtoken
|
117
|
+
$ gist ~/example</p></li>
|
118
|
+
<li><p>Using git-config(1)</p></li>
|
119
|
+
</ul>
|
120
|
+
|
121
|
+
|
110
122
|
<p>Use git-config(1) to display the currently configured GitHub username:</p>
|
111
123
|
|
112
124
|
<pre><code>$ git config --global github.user
|
@@ -150,7 +162,7 @@ $ gist script.py
|
|
150
162
|
|
151
163
|
<ol class='foot man'>
|
152
164
|
<li class='tl'>GITHUB</li>
|
153
|
-
<li class='tc'>
|
165
|
+
<li class='tc'>May 2010</li>
|
154
166
|
<li class='tr'>gist(1)</li>
|
155
167
|
</ol>
|
156
168
|
|
data/man/gist.1.ron
CHANGED
@@ -33,6 +33,10 @@ These options can be used to change this behavior:
|
|
33
33
|
Set the file extension explicitly. Passing a type of `rb` ensure
|
34
34
|
the gist is created as a Ruby file.
|
35
35
|
|
36
|
+
* `-o`, `--[no-]open`:
|
37
|
+
Open the gist in your browser after creation. Or don't. Defaults
|
38
|
+
to --open
|
39
|
+
|
36
40
|
You may additionally ask for help:
|
37
41
|
|
38
42
|
* `-h`, `--help`:
|
@@ -41,7 +45,17 @@ You may additionally ask for help:
|
|
41
45
|
* `-m`, `--man`:
|
42
46
|
Display this man page.
|
43
47
|
|
44
|
-
##
|
48
|
+
## AUTHENTICATION
|
49
|
+
|
50
|
+
There are two ways to set GitHub user and token info:
|
51
|
+
|
52
|
+
* Using env vars GITHUB_USER and GITHUB_TOKEN
|
53
|
+
|
54
|
+
$ export GITHUB_USER=johndoe
|
55
|
+
$ export GITHUB_TOKEN=mysecretgithubtoken
|
56
|
+
$ gist ~/example
|
57
|
+
|
58
|
+
* Using git-config(1)
|
45
59
|
|
46
60
|
Use git-config(1) to display the currently configured GitHub username:
|
47
61
|
|
@@ -54,9 +68,24 @@ Or, set the GitHub username with:
|
|
54
68
|
See <http://github.com/guides/local-github-config> for more
|
55
69
|
information.
|
56
70
|
|
57
|
-
|
71
|
+
## CONFIGURATION
|
72
|
+
|
73
|
+
You can set a few options in your git config (using git-config(1)) to
|
74
|
+
control the default behavior of gist(1).
|
75
|
+
|
76
|
+
* gist.private - boolean (yes or no) - Determines whether to make a gist
|
77
|
+
private by default
|
78
|
+
|
79
|
+
* gist.extension - string - Default extension for gists you create.
|
80
|
+
|
81
|
+
* gist.browse - boolean (yes or no) - Whether to open the gist in your
|
82
|
+
browser after creation. Default: yes
|
83
|
+
|
84
|
+
## ENVIRONMENT
|
85
|
+
|
86
|
+
The following environment variables affect the execution of `gist`:
|
58
87
|
|
59
|
-
|
88
|
+
* HTTP_PROXY - Proxy to use when Gisting. Should be "http://host:port/"
|
60
89
|
|
61
90
|
## EXAMPLES
|
62
91
|
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
version: 1.2.0
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Chris Wanstrath
|
@@ -9,7 +14,7 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date: 2010-
|
17
|
+
date: 2010-06-23 00:00:00 -07:00
|
13
18
|
default_executable:
|
14
19
|
dependencies: []
|
15
20
|
|
@@ -46,18 +51,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
46
51
|
requirements:
|
47
52
|
- - ">="
|
48
53
|
- !ruby/object:Gem::Version
|
54
|
+
segments:
|
55
|
+
- 0
|
49
56
|
version: "0"
|
50
|
-
version:
|
51
57
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
58
|
requirements:
|
53
59
|
- - ">="
|
54
60
|
- !ruby/object:Gem::Version
|
61
|
+
segments:
|
62
|
+
- 0
|
55
63
|
version: "0"
|
56
|
-
version:
|
57
64
|
requirements: []
|
58
65
|
|
59
66
|
rubyforge_project:
|
60
|
-
rubygems_version: 1.3.
|
67
|
+
rubygems_version: 1.3.6
|
61
68
|
signing_key:
|
62
69
|
specification_version: 3
|
63
70
|
summary: Creates Gists from STDIN or files.
|