gist 3.1.1 → 4.0.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.
@@ -1,90 +0,0 @@
1
- module Gist
2
- module Manpage
3
- extend self
4
-
5
- # Prints a manpage, all pretty and paged.
6
- def display(name)
7
- puts manpage(name)
8
- end
9
-
10
- # Returns the terminal-formatted manpage, ready to be printed to
11
- # the screen.
12
- def manpage(name)
13
- return "** Can't find groff(1)" unless groff?
14
-
15
- require 'open3'
16
- out = nil
17
- Open3.popen3(groff_command) do |stdin, stdout, _|
18
- stdin.puts raw_manpage(name)
19
- stdin.close
20
- out = stdout.read.strip
21
- end
22
- out
23
- end
24
-
25
- # Returns the raw manpage. If we're not running in standalone
26
- # mode, it's a file sitting at the root under the `man`
27
- # directory.
28
- #
29
- # If we are running in standalone mode the manpage will be
30
- # included after the __END__ of the file so we can grab it using
31
- # DATA.
32
- def raw_manpage(name)
33
- if File.exists? file = File.dirname(__FILE__) + "/../../man/#{name}.1"
34
- File.read(file)
35
- else
36
- DATA.read.split("__CACERT__").first
37
- end
38
- end
39
-
40
- # Returns true if groff is installed and in our path, false if
41
- # not.
42
- def groff?
43
- system("which groff > /dev/null")
44
- end
45
-
46
- # The groff command complete with crazy arguments we need to run
47
- # in order to turn our raw roff (manpage markup) into something
48
- # readable on the terminal.
49
- def groff_command
50
- "groff -Wall -mtty-char -mandoc -Tascii"
51
- end
52
-
53
- # All calls to `puts` are paged, git-style.
54
- def puts(*args)
55
- page_stdout
56
- super
57
- end
58
-
59
- # http://nex-3.com/posts/73-git-style-automatic-paging-in-ruby
60
- def page_stdout
61
- return unless $stdout.tty?
62
-
63
- read, write = IO.pipe
64
-
65
- if Kernel.fork
66
- # Parent process, become pager
67
- $stdin.reopen(read)
68
- read.close
69
- write.close
70
-
71
- # Don't page if the input is short enough
72
- ENV['LESS'] = 'FSRX'
73
-
74
- # Wait until we have input before we start the pager
75
- Kernel.select [STDIN]
76
-
77
- pager = ENV['PAGER'] || 'less -isr'
78
- pager = 'cat' if pager.empty?
79
-
80
- exec pager rescue exec "/bin/sh", "-c", pager
81
- else
82
- # Child process
83
- $stdout.reopen(write)
84
- $stderr.reopen(write) if $stderr.tty?
85
- read.close
86
- write.close
87
- end
88
- end
89
- end
90
- end
@@ -1,55 +0,0 @@
1
- module Gist
2
- module Standalone
3
- extend self
4
-
5
- PREAMBLE = <<-preamble
6
- #!/usr/bin/env ruby
7
- # encoding: utf-8
8
- #
9
- # This file, gist, is generated code.
10
- # Please DO NOT EDIT or send patches for it.
11
- #
12
- # Please take a look at the source from
13
- # http://github.com/defunkt/gist
14
- # and submit patches against the individual files
15
- # that build gist.
16
- #
17
-
18
- preamble
19
-
20
- POSTAMBLE = "Gist.execute(*ARGV)\n"
21
- __DIR__ = File.dirname(__FILE__)
22
- MANPAGE = "__END__\n#{File.read(__DIR__ + '/../../man/gist.1')}"
23
- CACERT = "__CACERT__\n#{File.read(__DIR__ + '/cacert.pem')}"
24
-
25
- def save(filename, path = '.')
26
- target = File.join(File.expand_path(path), filename)
27
- File.open(target, 'w') do |f|
28
- f.puts build
29
- f.chmod 0755
30
- end
31
- end
32
-
33
- def build
34
- root = File.dirname(__FILE__)
35
-
36
- standalone = ''
37
- standalone << PREAMBLE
38
-
39
- Dir["#{root}/../**/*.rb"].each do |file|
40
- # skip standalone.rb
41
- next if File.expand_path(file) == File.expand_path(__FILE__)
42
-
43
- File.readlines(file).each do |line|
44
- next if line =~ /^\s*#/
45
- standalone << line
46
- end
47
- end
48
-
49
- standalone << POSTAMBLE
50
- standalone << MANPAGE
51
- standalone << CACERT
52
- standalone
53
- end
54
- end
55
- end
@@ -1,3 +0,0 @@
1
- module Gist
2
- VERSION = Version = '3.1.1'
3
- end
data/man/gist.1 DELETED
@@ -1,146 +0,0 @@
1
- .\" generated with Ronn/v0.7.3
2
- .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
- .
4
- .TH "GIST" "1" "November 2012" "GITHUB" "Gist Manual"
5
- .
6
- .SH "NAME"
7
- \fBgist\fR \- gist on the command line
8
- .
9
- .SH "SYNOPSIS"
10
- \fBgist\fR [\fB\-p\fR] [\fB\-t extension\fR] \fIFILE|\-\fR
11
- .
12
- .SH "DESCRIPTION"
13
- \fBgist\fR can be used to create gists on gist\.github\.com from the command line\. There are two primary methods of creating gists\.
14
- .
15
- .P
16
- If standard input is supplied, it will be used as the content of the new gist\. If \fIFILE\fR is provided, the content of that file will be used to create the gist\. If \fIFILE\fR is \'\-\' then gist will wait for content from standard input\.
17
- .
18
- .P
19
- Once your gist is successfully created, the URL will be copied to your clipboard\. If you are on OS X, \fBgist\fR will open the gist in your browser, too\.
20
- .
21
- .SH "OPTIONS"
22
- \fBgist\fR\'s default mode of operation is to read content from standard input and create a public, text gist without description from it, tied to your GitHub account if you user and passwordare provided (see \fBCONFIGURATION\fR)\.
23
- .
24
- .P
25
- These options can be used to change this behavior:
26
- .
27
- .TP
28
- \fB\-p\fR, \fB\-\-private\fR
29
- Create a private gist instead of a public gist\.
30
- .
31
- .TP
32
- \fB\-t\fR, \fB\-\-type\fR
33
- Set the file extension explicitly\. Passing a type of \fBrb\fR ensures the gist is created as a Ruby file\.
34
- .
35
- .TP
36
- \fB\-d\fR, \fB\-\-description\fR
37
- Set a description\.
38
- .
39
- .TP
40
- \fB\-o\fR, \fB\-\-[no\-]open\fR
41
- Open the gist in your browser after creation\. Or don\'t\. Defaults to \-\-open
42
- .
43
- .P
44
- You may additionally ask for help:
45
- .
46
- .TP
47
- \fB\-h\fR, \fB\-\-help\fR
48
- Print help\.
49
- .
50
- .TP
51
- \fB\-m\fR, \fB\-\-man\fR
52
- Display this man page\.
53
- .
54
- .SH "AUTHENTICATION"
55
- There are two ways to set GitHub user and password info:
56
- .
57
- .IP "\(bu" 4
58
- Using environment vars GITHUB_USER and GITHUB_PASSWORD
59
- .
60
- .IP
61
- $ export GITHUB_USER=johndoe
62
- .
63
- .br
64
- $ export GITHUB_PASSWORD=mysecretgithubpassword
65
- .
66
- .br
67
- $ gist ~/example
68
- .
69
- .IP "\(bu" 4
70
- Using git\-config(1)
71
- .
72
- .IP "" 0
73
- .
74
- .P
75
- Use git\-config(1) to display the currently configured GitHub username:
76
- .
77
- .IP "" 4
78
- .
79
- .nf
80
-
81
- $ git config \-\-global github\.user
82
- .
83
- .fi
84
- .
85
- .IP "" 0
86
- .
87
- .P
88
- Or, set the GitHub username with:
89
- .
90
- .IP "" 4
91
- .
92
- .nf
93
-
94
- $ git config \-\-global github\.user <username>
95
- .
96
- .fi
97
- .
98
- .IP "" 0
99
- .
100
- .P
101
- See \fIhttp://github\.com/guides/local\-github\-config\fR for more information\.
102
- .
103
- .SH "CONFIGURATION"
104
- You can set a few options in your git config (using git\-config(1)) to control the default behavior of gist(1)\.
105
- .
106
- .IP "\(bu" 4
107
- gist\.private \- boolean (yes or no) \- Determines whether to make a gist private by default
108
- .
109
- .IP "\(bu" 4
110
- gist\.extension \- string \- Default extension for gists you create\.
111
- .
112
- .IP "\(bu" 4
113
- gist\.browse \- boolean (yes or no) \- Whether to open the gist in your browser after creation\. Default: yes
114
- .
115
- .IP "" 0
116
- .
117
- .SH "ENVIRONMENT"
118
- The following environment variables affect the execution of \fBgist\fR:
119
- .
120
- .IP "\(bu" 4
121
- HTTP_PROXY \- Proxy to use when Gisting\. Should be "http://host:port/"
122
- .
123
- .IP "" 0
124
- .
125
- .SH "EXAMPLES"
126
- .
127
- .nf
128
-
129
- $ gist < file\.txt
130
- $ echo secret | gist \-\-private
131
- $ echo "puts :hi" | gist \-t rb
132
- $ gist script\.py
133
- $ gist \-
134
- the quick brown fox jumps over the lazy dog
135
- ^D
136
- .
137
- .fi
138
- .
139
- .SH "BUGS"
140
- \fIhttp://github\.com/defunkt/gist/issues\fR
141
- .
142
- .SH "AUTHOR"
143
- Chris Wanstrath :: chris@ozmm\.org
144
- .
145
- .SH "SEE ALSO"
146
- hub(1), git(1), git\-clone(1), \fIhttp://github\.com\fR, \fIhttp://github\.com/defunkt/gist\fR
@@ -1,209 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta http-equiv='content-type' value='text/html;charset=utf8'>
5
- <meta name='generator' value='Ronn/v0.7.3 (http://github.com/rtomayko/ronn/tree/0.7.3)'>
6
- <title>gist(1) - gist on the command line</title>
7
- <style type='text/css' media='all'>
8
- /* style: man */
9
- body#manpage {margin:0}
10
- .mp {max-width:100ex;padding:0 9ex 1ex 4ex}
11
- .mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0}
12
- .mp h2 {margin:10px 0 0 0}
13
- .mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex}
14
- .mp h3 {margin:0 0 0 4ex}
15
- .mp dt {margin:0;clear:left}
16
- .mp dt.flush {float:left;width:8ex}
17
- .mp dd {margin:0 0 0 9ex}
18
- .mp h1,.mp h2,.mp h3,.mp h4 {clear:left}
19
- .mp pre {margin-bottom:20px}
20
- .mp pre+h2,.mp pre+h3 {margin-top:22px}
21
- .mp h2+pre,.mp h3+pre {margin-top:5px}
22
- .mp img {display:block;margin:auto}
23
- .mp h1.man-title {display:none}
24
- .mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 {font-family:monospace;font-size:14px;line-height:1.42857142857143}
25
- .mp h2 {font-size:16px;line-height:1.25}
26
- .mp h1 {font-size:20px;line-height:2}
27
- .mp {text-align:justify;background:#fff}
28
- .mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211}
29
- .mp h1,.mp h2,.mp h3,.mp h4 {color:#030201}
30
- .mp u {text-decoration:underline}
31
- .mp code,.mp strong,.mp b {font-weight:bold;color:#131211}
32
- .mp em,.mp var {font-style:italic;color:#232221;text-decoration:none}
33
- .mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a samp {color:#0000ff}
34
- .mp b.man-ref {font-weight:normal;color:#434241}
35
- .mp pre {padding:0 4ex}
36
- .mp pre code {font-weight:normal;color:#434241}
37
- .mp h2+pre,h3+pre {padding-left:0}
38
- ol.man-decor,ol.man-decor li {margin:3px 0 10px 0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px}
39
- ol.man-decor {width:100%}
40
- ol.man-decor li.tl {text-align:left}
41
- ol.man-decor li.tc {text-align:center;letter-spacing:4px}
42
- ol.man-decor li.tr {text-align:right;float:right}
43
- </style>
44
- </head>
45
- <!--
46
- The following styles are deprecated and will be removed at some point:
47
- div#man, div#man ol.man, div#man ol.head, div#man ol.man.
48
-
49
- The .man-page, .man-decor, .man-head, .man-foot, .man-title, and
50
- .man-navigation should be used instead.
51
- -->
52
- <body id='manpage'>
53
- <div class='mp' id='man'>
54
-
55
- <div class='man-navigation' style='display:none'>
56
- <a href="#NAME">NAME</a>
57
- <a href="#SYNOPSIS">SYNOPSIS</a>
58
- <a href="#DESCRIPTION">DESCRIPTION</a>
59
- <a href="#OPTIONS">OPTIONS</a>
60
- <a href="#AUTHENTICATION">AUTHENTICATION</a>
61
- <a href="#CONFIGURATION">CONFIGURATION</a>
62
- <a href="#ENVIRONMENT">ENVIRONMENT</a>
63
- <a href="#EXAMPLES">EXAMPLES</a>
64
- <a href="#BUGS">BUGS</a>
65
- <a href="#AUTHOR">AUTHOR</a>
66
- <a href="#SEE-ALSO">SEE ALSO</a>
67
- </div>
68
-
69
- <ol class='man-decor man-head man head'>
70
- <li class='tl'>gist(1)</li>
71
- <li class='tc'>Gist Manual</li>
72
- <li class='tr'>gist(1)</li>
73
- </ol>
74
-
75
- <h2 id="NAME">NAME</h2>
76
- <p class="man-name">
77
- <code>gist</code> - <span class="man-whatis">gist on the command line</span>
78
- </p>
79
-
80
- <h2 id="SYNOPSIS">SYNOPSIS</h2>
81
-
82
- <p><code>gist</code> [<code>-p</code>] [<code>-t extension</code>] <var>FILE|-</var></p>
83
-
84
- <h2 id="DESCRIPTION">DESCRIPTION</h2>
85
-
86
- <p><code>gist</code> can be used to create gists on gist.github.com from the command
87
- line. There are two primary methods of creating gists.</p>
88
-
89
- <p>If standard input is supplied, it will be used as the content of the
90
- new gist. If <var>FILE</var> is provided, the content of that file will be used
91
- to create the gist. If <var>FILE</var> is '-' then gist will wait for content
92
- from standard input.</p>
93
-
94
- <p>Once your gist is successfully created, the URL will be copied to your
95
- clipboard. If you are on OS X, <code>gist</code> will open the gist in your
96
- browser, too.</p>
97
-
98
- <h2 id="OPTIONS">OPTIONS</h2>
99
-
100
- <p><code>gist</code>'s default mode of operation is to read content from standard
101
- input and create a public, text gist without description from it, tied
102
- to your GitHub account if you user and passwordare provided (see
103
- <code>CONFIGURATION</code>).</p>
104
-
105
- <p>These options can be used to change this behavior:</p>
106
-
107
- <dl>
108
- <dt><code>-p</code>, <code>--private</code></dt><dd><p>Create a private gist instead of a public gist.</p></dd>
109
- <dt><code>-t</code>, <code>--type</code></dt><dd><p>Set the file extension explicitly. Passing a type of <code>rb</code> ensures
110
- the gist is created as a Ruby file.</p></dd>
111
- <dt><code>-d</code>, <code>--description</code></dt><dd><p>Set a description.</p></dd>
112
- <dt><code>-o</code>, <code>--[no-]open</code></dt><dd><p>Open the gist in your browser after creation. Or don't. Defaults
113
- to --open</p></dd>
114
- </dl>
115
-
116
-
117
- <p>You may additionally ask for help:</p>
118
-
119
- <dl>
120
- <dt><code>-h</code>, <code>--help</code></dt><dd><p>Print help.</p></dd>
121
- <dt><code>-m</code>, <code>--man</code></dt><dd><p>Display this man page.</p></dd>
122
- </dl>
123
-
124
-
125
- <h2 id="AUTHENTICATION">AUTHENTICATION</h2>
126
-
127
- <p>There are two ways to set GitHub user and password info:</p>
128
-
129
- <ul>
130
- <li><p>Using environment vars GITHUB_USER and GITHUB_PASSWORD</p>
131
-
132
- <p>$ export GITHUB_USER=johndoe<br />
133
- $ export GITHUB_PASSWORD=mysecretgithubpassword<br />
134
- $ gist ~/example</p></li>
135
- <li><p>Using <span class="man-ref">git-config<span class="s">(1)</span></span></p></li>
136
- </ul>
137
-
138
-
139
- <p>Use <span class="man-ref">git-config<span class="s">(1)</span></span> to display the currently configured GitHub username:</p>
140
-
141
- <pre><code>$ git config --global github.user
142
- </code></pre>
143
-
144
- <p>Or, set the GitHub username with:</p>
145
-
146
- <pre><code>$ git config --global github.user &lt;username>
147
- </code></pre>
148
-
149
- <p>See <a href="http://github.com/guides/local-github-config" data-bare-link="true">http://github.com/guides/local-github-config</a> for more
150
- information.</p>
151
-
152
- <h2 id="CONFIGURATION">CONFIGURATION</h2>
153
-
154
- <p>You can set a few options in your git config (using <span class="man-ref">git-config<span class="s">(1)</span></span>) to
155
- control the default behavior of <a class="man-ref" href="gist.1.ron.html">gist<span class="s">(1)</span></a>.</p>
156
-
157
- <ul>
158
- <li><p>gist.private - boolean (yes or no) - Determines whether to make a gist
159
- private by default</p></li>
160
- <li><p>gist.extension - string - Default extension for gists you create.</p></li>
161
- <li><p>gist.browse - boolean (yes or no) - Whether to open the gist in your
162
- browser after creation. Default: yes</p></li>
163
- </ul>
164
-
165
-
166
- <h2 id="ENVIRONMENT">ENVIRONMENT</h2>
167
-
168
- <p>The following environment variables affect the execution of <code>gist</code>:</p>
169
-
170
- <ul>
171
- <li>HTTP_PROXY - Proxy to use when Gisting. Should be "http://host:port/"</li>
172
- </ul>
173
-
174
-
175
- <h2 id="EXAMPLES">EXAMPLES</h2>
176
-
177
- <pre><code>$ gist &lt; file.txt
178
- $ echo secret | gist --private
179
- $ echo "puts :hi" | gist -t rb
180
- $ gist script.py
181
- $ gist -
182
- the quick brown fox jumps over the lazy dog
183
- ^D
184
- </code></pre>
185
-
186
- <h2 id="BUGS">BUGS</h2>
187
-
188
- <p><a href="http://github.com/defunkt/gist/issues" data-bare-link="true">http://github.com/defunkt/gist/issues</a></p>
189
-
190
- <h2 id="AUTHOR">AUTHOR</h2>
191
-
192
- <p>Chris Wanstrath :: chris@ozmm.org</p>
193
-
194
- <h2 id="SEE-ALSO">SEE ALSO</h2>
195
-
196
- <p><span class="man-ref">hub<span class="s">(1)</span></span>, <span class="man-ref">git<span class="s">(1)</span></span>, <span class="man-ref">git-clone<span class="s">(1)</span></span>,
197
- <a href="http://github.com" data-bare-link="true">http://github.com</a>,
198
- <a href="http://github.com/defunkt/gist" data-bare-link="true">http://github.com/defunkt/gist</a></p>
199
-
200
-
201
- <ol class='man-decor man-foot man foot'>
202
- <li class='tl'>GITHUB</li>
203
- <li class='tc'>November 2012</li>
204
- <li class='tr'>gist(1)</li>
205
- </ol>
206
-
207
- </div>
208
- </body>
209
- </html>