binman 3.0.1 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.markdown +24 -24
- data/README.markdown +187 -45
- data/bin/binman +54 -47
- data/binman.gemspec +10 -10
- data/lib/binman.rb +1 -1
- data/lib/binman/rakefile.rb +1 -1
- data/lib/binman/version.rb +1 -1
- data/man/man1/binman.1 +33 -21
- metadata +10 -10
data/HISTORY.markdown
CHANGED
@@ -1,6 +1,20 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
## Version 3.1.0 (2012-02-06)
|
2
|
+
|
3
|
+
Minor:
|
4
|
+
|
5
|
+
* Added `binman help` command for use by non-Ruby bin scripts. See README
|
6
|
+
for usage examples from Perl, Python, Node.js, Tcl, AWK, and UNIX shell!
|
7
|
+
|
8
|
+
Patch:
|
9
|
+
|
10
|
+
* Replace `gem install binman --development` tip in `BinMan::conv()` with
|
11
|
+
`gem install md2man` tip because the former just hangs in RubyGems 1.8.
|
12
|
+
|
13
|
+
Other:
|
14
|
+
|
15
|
+
* Shorten markdown headings; improve documentation; clean up.
|
16
|
+
|
17
|
+
## Version 3.0.1 (2012-02-02)
|
4
18
|
|
5
19
|
Patch:
|
6
20
|
|
@@ -18,9 +32,7 @@ Other:
|
|
18
32
|
|
19
33
|
* bundler suggests moving all dev deps into gemspec.
|
20
34
|
|
21
|
-
|
22
|
-
Version 3.0.0 (2012-01-09)
|
23
|
-
------------------------------------------------------------------------------
|
35
|
+
## Version 3.0.0 (2012-01-09)
|
24
36
|
|
25
37
|
Major:
|
26
38
|
|
@@ -35,9 +47,7 @@ Minor:
|
|
35
47
|
|
36
48
|
[1]: https://github.com/sunaku/md2man/commit/75d7a0064fa86f1c98dd01391ad82245fd387c20
|
37
49
|
|
38
|
-
|
39
|
-
Version 2.0.0 (2011-12-06)
|
40
|
-
------------------------------------------------------------------------------
|
50
|
+
## Version 2.0.0 (2011-12-06)
|
41
51
|
|
42
52
|
Major:
|
43
53
|
|
@@ -54,9 +64,7 @@ Other:
|
|
54
64
|
|
55
65
|
* Do not hard-code the version number in `binman/gemspec` helper.
|
56
66
|
|
57
|
-
|
58
|
-
Version 1.1.0 (2011-11-05)
|
59
|
-
------------------------------------------------------------------------------
|
67
|
+
## Version 1.1.0 (2011-11-05)
|
60
68
|
|
61
69
|
Alert:
|
62
70
|
|
@@ -70,9 +78,7 @@ Minor:
|
|
70
78
|
builds and includes your UNIX man page files in your gem packages and also
|
71
79
|
adds binman as a runtime and development gem dependency.
|
72
80
|
|
73
|
-
|
74
|
-
Version 1.0.0 (2011-10-13)
|
75
|
-
------------------------------------------------------------------------------
|
81
|
+
## Version 1.0.0 (2011-10-13)
|
76
82
|
|
77
83
|
Major:
|
78
84
|
|
@@ -98,9 +104,7 @@ Other:
|
|
98
104
|
|
99
105
|
* README: explain dev deps and `man/` dir packaging.
|
100
106
|
|
101
|
-
|
102
|
-
Version 0.1.2 (2011-10-13)
|
103
|
-
------------------------------------------------------------------------------
|
107
|
+
## Version 0.1.2 (2011-10-13)
|
104
108
|
|
105
109
|
Minor:
|
106
110
|
|
@@ -115,9 +119,7 @@ Other:
|
|
115
119
|
[Redcarpet2]: https://github.com/tanoku/redcarpet
|
116
120
|
[redcarpet-manpage]: http://rdoc.info/github/sunaku/redcarpet-manpage
|
117
121
|
|
118
|
-
|
119
|
-
Version 0.1.1 (2011-10-13)
|
120
|
-
------------------------------------------------------------------------------
|
122
|
+
## Version 0.1.1 (2011-10-13)
|
121
123
|
|
122
124
|
Minor:
|
123
125
|
|
@@ -140,8 +142,6 @@ Other:
|
|
140
142
|
|
141
143
|
* README: add obligatory screenshot! >:-)
|
142
144
|
|
143
|
-
|
144
|
-
Version 0.0.1 (2011-10-12)
|
145
|
-
------------------------------------------------------------------------------
|
145
|
+
## Version 0.0.1 (2011-10-12)
|
146
146
|
|
147
147
|
First release! Happy birthday! Woohoo! :-)
|
data/README.markdown
CHANGED
@@ -1,45 +1,39 @@
|
|
1
|
-
binman -
|
2
|
-
==============================================================================
|
1
|
+
# binman - man pages for bin scripts
|
3
2
|
|
4
|
-
[binman] produces UNIX
|
5
|
-
markdown(7), roff(7), [md2man] for conversion thereof, and man(1).
|
3
|
+
[binman] produces UNIX manual pages for executable scripts using [md2man].
|
6
4
|
|
7
|
-
|
5
|
+
## Features
|
8
6
|
|
9
|
-
|
7
|
+
* Supports any scripting language that has multi-line
|
8
|
+
comments or uses `#` for single-line comments: Ruby,
|
9
|
+
Perl, Python, Node.js, Tcl, AWK, UNIX shell, and more!
|
10
10
|
|
11
|
-
|
12
|
-
[binman-api]: http://rdoc.info/github/sunaku/binman
|
13
|
-
[binman-bin]: https://raw.github.com/sunaku/binman/master/bin/binman
|
14
|
-
[md2man]: https://github.com/sunaku/md2man
|
15
|
-
|
16
|
-
------------------------------------------------------------------------------
|
17
|
-
Features
|
18
|
-
------------------------------------------------------------------------------
|
11
|
+
* Provides a Ruby library and a command-line client too.
|
19
12
|
|
20
|
-
*
|
13
|
+
* Individual extraction, conversion, and display commands.
|
21
14
|
|
22
|
-
*
|
15
|
+
* Implemented in roughly 100 lines of pure Ruby code! :-)
|
23
16
|
|
24
|
-
|
17
|
+
### Demonstration
|
25
18
|
|
26
|
-
|
27
|
-
Prerequisites
|
28
|
-
------------------------------------------------------------------------------
|
19
|
+
![Obligatory screen-shot of binman(1) in action!](http://ompldr.org/vYm5mcg)
|
29
20
|
|
30
|
-
|
21
|
+
Here is [a complete example in Ruby][binman-bin] to help you get started.
|
22
|
+
For examples in other scripting languages, see the "Usage" section below!
|
31
23
|
|
32
|
-
|
33
|
-
Installation
|
34
|
-
------------------------------------------------------------------------------
|
24
|
+
## Installation
|
35
25
|
|
36
|
-
|
26
|
+
If you only want to view pre-built manual pages:
|
37
27
|
|
38
28
|
gem install binman
|
39
29
|
|
40
|
-
|
30
|
+
If you also want to build your own manual pages:
|
41
31
|
|
42
|
-
gem install
|
32
|
+
gem install md2man -v '~> 1'
|
33
|
+
|
34
|
+
### Prerequisites
|
35
|
+
|
36
|
+
* Ruby 1.8.7 or 1.9.2 or newer.
|
43
37
|
|
44
38
|
### Development
|
45
39
|
|
@@ -49,51 +43,199 @@ As a Ruby gem (with extra cheese and everything please):
|
|
49
43
|
bundle_bin/binman --help # run it directly
|
50
44
|
bundle exec rake -T # packaging tasks
|
51
45
|
|
52
|
-
|
53
|
-
Usage
|
54
|
-
------------------------------------------------------------------------------
|
46
|
+
## Usage
|
55
47
|
|
56
48
|
### At the command line
|
57
49
|
|
58
50
|
binman --help
|
59
51
|
|
60
|
-
###
|
52
|
+
### Inside a Ruby script
|
61
53
|
|
62
|
-
|
54
|
+
#!/usr/bin/env ruby
|
55
|
+
# your program's manual page goes here
|
63
56
|
|
64
57
|
require 'binman'
|
65
|
-
BinMan.help # show man page and exit if ARGV has -h or --help
|
66
58
|
|
67
|
-
|
59
|
+
# OPTION 1: show manual and exit if ARGV has -h or --help except after --
|
60
|
+
BinMan.help
|
68
61
|
|
69
|
-
|
70
|
-
BinMan.show
|
62
|
+
# OPTION 2: show manual unconditionally
|
63
|
+
BinMan.show
|
64
|
+
|
65
|
+
You can also specify your program's source file encoding above the manual:
|
66
|
+
|
67
|
+
#!/usr/bin/env ruby
|
68
|
+
# -*- coding: utf-8 -*-
|
69
|
+
# your program's manual page goes here
|
70
|
+
|
71
|
+
You can also write the manual as a multi-line Ruby comment:
|
72
|
+
|
73
|
+
#!/usr/bin/env ruby
|
74
|
+
=begin
|
75
|
+
your program's manual page goes here
|
76
|
+
=end
|
77
|
+
|
78
|
+
You can also specify your program's source file encoding above the manual:
|
79
|
+
|
80
|
+
#!/usr/bin/env ruby
|
81
|
+
# -*- coding: utf-8 -*-
|
82
|
+
=begin
|
83
|
+
your program's manual page goes here
|
84
|
+
=end
|
85
|
+
|
86
|
+
See the [API documentation][binman-api] for even more possibilities!
|
87
|
+
|
88
|
+
### Inside a shell script
|
89
|
+
|
90
|
+
#!/usr/bin/sh
|
91
|
+
# your program's manual page goes here
|
92
|
+
|
93
|
+
# OPTION 1: show manual and exit if ARGV has -h or --help except after --
|
94
|
+
binman help "$0" "$@" && exit
|
95
|
+
|
96
|
+
# OPTION 2: show manual unconditionally
|
97
|
+
binman show "$0"
|
98
|
+
|
99
|
+
### Inside a Perl script
|
100
|
+
|
101
|
+
#!/usr/bin/env perl
|
102
|
+
# your program's manual page goes here
|
103
|
+
|
104
|
+
# OPTION 1: show manual and exit if ARGV has -h or --help except after --
|
105
|
+
system('binman', 'help', __FILE__, @ARGV) == 0 and exit;
|
106
|
+
|
107
|
+
# OPTION 2: show manual unconditionally
|
108
|
+
system('binman', 'show', __FILE__);
|
109
|
+
|
110
|
+
You can also write the manual as a multi-line Ruby comment after `__END__`:
|
111
|
+
|
112
|
+
#!/usr/bin/env perl
|
113
|
+
print "your program's code goes here";
|
114
|
+
__END__
|
115
|
+
=begin
|
116
|
+
your program's manual page goes here
|
117
|
+
=end
|
118
|
+
|
119
|
+
### Inside a Python script
|
120
|
+
|
121
|
+
#!/usr/bin/env python
|
122
|
+
# your program's manual page goes here
|
123
|
+
|
124
|
+
import sys, subprocess
|
125
|
+
|
126
|
+
# OPTION 1: show manual and exit if ARGV has -h or --help except after --
|
127
|
+
subprocess.call(['binman', 'help', __file__] + sys.argv) == 0 and sys.exit()
|
71
128
|
|
72
|
-
|
129
|
+
# OPTION 2: show manual unconditionally
|
130
|
+
subprocess.call(['binman', 'show', __file__])
|
131
|
+
|
132
|
+
You can also specify your program's source file encoding above the manual:
|
133
|
+
|
134
|
+
#!/usr/bin/env python
|
135
|
+
# -*- coding: utf-8 -*-
|
136
|
+
# your program's manual page goes here
|
137
|
+
|
138
|
+
You can also write the manual as a multi-line Ruby comment inside a docstring:
|
139
|
+
|
140
|
+
#!/usr/bin/env python
|
141
|
+
"""
|
142
|
+
=begin
|
143
|
+
your program's manual page goes here
|
144
|
+
=end
|
145
|
+
"""
|
146
|
+
|
147
|
+
You can also specify your program's source file encoding above the manual:
|
148
|
+
|
149
|
+
#!/usr/bin/env python
|
150
|
+
# -*- coding: utf-8 -*-
|
151
|
+
"""
|
152
|
+
=begin
|
153
|
+
your program's manual page goes here
|
154
|
+
=end
|
155
|
+
"""
|
156
|
+
|
157
|
+
### Inside an AWK script
|
158
|
+
|
159
|
+
The technique for determining current AWK script file name [comes from here](
|
160
|
+
http://www.mombu.com/programming/programming/t-the-name-of-script-itself-2040784-print.html
|
161
|
+
).
|
162
|
+
|
163
|
+
#!/usr/bin/awk -f
|
164
|
+
# your program's manual page goes here
|
165
|
+
|
166
|
+
# OPTION 1: show manual and exit if ARGV has -h or --help except after --
|
167
|
+
BEGIN {getline c <"/proc/self/cmdline"; sub(".*-f\0"," ",c); gsub("\0"," ",c);
|
168
|
+
if(system("binman help" c) == 0){ exit }}
|
169
|
+
|
170
|
+
# OPTION 2: show manual unconditionally
|
171
|
+
BEGIN {getline c <"/proc/self/cmdline"; sub(".*-f\0"," ",c); sub("\0.*","",c);
|
172
|
+
system("binman show" c)}
|
173
|
+
|
174
|
+
### Inside a Tcl script
|
175
|
+
|
176
|
+
#!/usr/bin/env tclsh
|
177
|
+
# your program's manual page goes here
|
178
|
+
|
179
|
+
# OPTION 1: show manual and exit if ARGV has -h or --help except after --
|
180
|
+
if {![catch {exec -- >/dev/tty binman help $argv0 {*}$argv}]} {exit}
|
181
|
+
|
182
|
+
# OPTION 2: show manual unconditionally
|
183
|
+
exec >/dev/tty binman show $argv0
|
184
|
+
|
185
|
+
You can also write the manual as a multi-line Ruby comment inside an `if 0`:
|
186
|
+
|
187
|
+
#!/usr/bin/env tclsh
|
188
|
+
if 0 {
|
189
|
+
=begin
|
190
|
+
your program's manual page goes here
|
191
|
+
=end
|
192
|
+
}
|
193
|
+
|
194
|
+
### Inside a Node.js script
|
195
|
+
|
196
|
+
/*
|
197
|
+
=begin
|
198
|
+
your program's manual page goes here
|
199
|
+
=end
|
200
|
+
*/
|
201
|
+
|
202
|
+
var exec = require('child_process').exec;
|
203
|
+
|
204
|
+
// OPTION 1: show manual and exit if ARGV has -h or --help except after --
|
205
|
+
exec(['>/dev/tty', 'binman', 'help', __filename].concat(process.argv).
|
206
|
+
join(' '), function(error){ if (error === null){ process.exit(); } });
|
207
|
+
|
208
|
+
// OPTION 2: show manual unconditionally
|
209
|
+
exec(['>/dev/tty', 'binman', 'show', __filename].join(' '));
|
210
|
+
|
211
|
+
## Packaging
|
73
212
|
|
74
213
|
### Pre-building man pages
|
75
214
|
|
76
215
|
Add the following lines to your gemspec:
|
77
216
|
|
78
|
-
s.files += Dir[
|
217
|
+
s.files += Dir['man/**/*']
|
79
218
|
s.add_development_dependency 'md2man', '~> 1'
|
80
219
|
|
81
220
|
Add the following line to your Rakefile:
|
82
221
|
|
83
222
|
require 'binman/rakefile'
|
84
223
|
|
85
|
-
You now have a `rake binman` task that pre-builds UNIX
|
86
|
-
`bin/` scripts into a `man/` directory so that your end-users do not need
|
87
|
-
[md2man] installed in order to view the
|
224
|
+
You now have a `rake binman` task that pre-builds UNIX manual page files for
|
225
|
+
your `bin/` scripts into a `man/` directory so that your end-users do not need
|
226
|
+
[md2man] installed in order to view the manual pages you've embedded therein!
|
88
227
|
|
89
228
|
If you're using Bundler, this task also hooks into its gem packaging tasks and
|
90
|
-
ensures that your UNIX
|
229
|
+
ensures that your UNIX manual pages are pre-built and packaged into your gem:
|
91
230
|
|
92
231
|
bundle exec rake build
|
93
232
|
gem spec pkg/*.gem | fgrep man/man
|
94
233
|
|
95
|
-
|
96
|
-
License
|
97
|
-
------------------------------------------------------------------------------
|
234
|
+
## License
|
98
235
|
|
99
236
|
Released under the ISC license. See the LICENSE file for details.
|
237
|
+
|
238
|
+
[binman]: https://github.com/sunaku/binman
|
239
|
+
[binman-api]: http://rubydoc.info/gems/binman/frames
|
240
|
+
[binman-bin]: https://raw.github.com/sunaku/binman/master/bin/binman
|
241
|
+
[md2man]: https://github.com/sunaku/md2man
|
data/bin/binman
CHANGED
@@ -1,44 +1,43 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
=begin
|
2
|
+
=begin =======================================================================
|
4
3
|
|
5
|
-
BINMAN 1
|
6
|
-
=============================
|
4
|
+
# BINMAN 1 2012-02-06 3.1.0
|
7
5
|
|
8
|
-
NAME
|
9
|
-
----
|
6
|
+
## NAME
|
10
7
|
|
11
|
-
binman -
|
8
|
+
binman - man pages for bin scripts
|
12
9
|
|
13
|
-
SYNOPSIS
|
14
|
-
--------
|
10
|
+
## SYNOPSIS
|
15
11
|
|
16
12
|
`binman` [*OPTION*]... *COMMAND*
|
17
13
|
|
18
|
-
DESCRIPTION
|
19
|
-
-----------
|
14
|
+
## DESCRIPTION
|
20
15
|
|
21
|
-
[binman] produces UNIX
|
22
|
-
their leading comment headers (defined below), convert them from
|
23
|
-
into roff(7) using [md2man], and display them using man(1).
|
16
|
+
[binman] produces UNIX manual pages for your executable scripts. It can
|
17
|
+
extract their leading comment headers (defined below), convert them from
|
18
|
+
markdown(7) into roff(7) using [md2man], and display them using man(1).
|
24
19
|
|
25
|
-
### Leading
|
20
|
+
### Leading comment headers
|
26
21
|
|
27
22
|
A leading comment header can be one of the following two things:
|
28
23
|
|
29
|
-
1.
|
30
|
-
|
31
|
-
|
24
|
+
1. A contiguous sequence of single-line comments (which begin with `#`
|
25
|
+
and optionally continue with a single space followed by any number of
|
26
|
+
characters until the end of the line) starting at the beginning of the
|
27
|
+
file (after shebang and encoding comments plus optional blank lines) and
|
28
|
+
ending at the first single blank line.
|
32
29
|
|
33
|
-
2.
|
30
|
+
2. The first embedded document delimited by `=begin` and `=end` lines, which
|
31
|
+
begin with the respective delimiters and optionally continue with a single
|
32
|
+
space followed by any number of characters until the end of the line.
|
34
33
|
|
35
|
-
### Markdown
|
34
|
+
### Markdown processing divergence
|
36
35
|
|
37
36
|
Although your leading comment headers are written in markdown(7), `binman
|
38
|
-
conv`
|
37
|
+
conv` inherits the following additions to markdown(7) syntax from [md2man]:
|
39
38
|
|
40
39
|
* There can be at most one top-level heading (H1). It is emitted as `.TH`
|
41
|
-
in the roff(7) output
|
40
|
+
in the roff(7) output to define the UNIX manual page's header and footer.
|
42
41
|
|
43
42
|
* Paragraphs whose lines are all uniformly indented by two spaces are
|
44
43
|
considered to be "indented paragraphs". They are unindented accordingly
|
@@ -48,25 +47,29 @@ conv` introduces the following additions to markdown(7) syntax via [md2man]:
|
|
48
47
|
indented by two spaces are considered to be a "tagged paragraphs". They
|
49
48
|
are unindented accordingly before emission as `.TP` in the roff(7) output.
|
50
49
|
|
51
|
-
### Markdown
|
50
|
+
### Markdown processing extensions
|
52
51
|
|
53
|
-
The following [
|
52
|
+
The following [Redcarpet] extensions are enabled while processing markdown(7):
|
54
53
|
|
55
|
-
* tables
|
56
|
-
* autolink
|
57
|
-
* superscript
|
58
|
-
* strikethrough
|
59
|
-
* no_intra_emphasis
|
60
|
-
* fenced_code_blocks
|
54
|
+
* tables
|
55
|
+
* autolink
|
56
|
+
* superscript
|
57
|
+
* strikethrough
|
58
|
+
* no_intra_emphasis
|
59
|
+
* fenced_code_blocks
|
61
60
|
|
62
|
-
OPTIONS
|
63
|
-
-------
|
61
|
+
## OPTIONS
|
64
62
|
|
65
63
|
`-h`, `--help`
|
66
|
-
|
64
|
+
Show this help manual.
|
67
65
|
|
68
|
-
COMMANDS
|
69
|
-
|
66
|
+
## COMMANDS
|
67
|
+
|
68
|
+
`help` *FILE* [*ARGUMENT*]...
|
69
|
+
If the given *ARGUMENT* sequence contains `-h` or `--help` except after
|
70
|
+
`--`, then this program extracts the given *FILE*'s leading comment header,
|
71
|
+
converts it into roff(7), and displays it using man(1) before exiting with
|
72
|
+
status code `0`. Otherwise, this program exits with status code `111`.
|
70
73
|
|
71
74
|
`show` [*FILE*]
|
72
75
|
Use man(1) to display the roff(7) conversion of the leading comment header
|
@@ -83,29 +86,33 @@ COMMANDS
|
|
83
86
|
Print the roff(7) conversion of the markdown(7) document read from the given
|
84
87
|
*FILE* or STDIN.
|
85
88
|
|
86
|
-
SEE ALSO
|
87
|
-
--------
|
89
|
+
## SEE ALSO
|
88
90
|
|
89
91
|
man(1), roff(7), markdown(7)
|
90
92
|
|
91
93
|
[binman]: https://github.com/sunaku/binman
|
92
94
|
[md2man]: https://github.com/sunaku/md2man
|
93
|
-
[
|
95
|
+
[Redcarpet]: https://github.com/tanoku/redcarpet
|
94
96
|
|
95
97
|
=end =========================================================================
|
96
98
|
|
97
99
|
require 'binman'
|
98
|
-
BinMan.help
|
99
100
|
|
100
101
|
command, source = ARGV
|
101
|
-
source ||= STDIN
|
102
102
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
when 'load', 'dump', 'conv'
|
107
|
-
puts BinMan.send(command, source)
|
103
|
+
if command == 'help'
|
104
|
+
BinMan.help source, ARGV[2..-1]
|
105
|
+
exit 111
|
108
106
|
else
|
109
|
-
|
110
|
-
|
107
|
+
BinMan.help
|
108
|
+
source ||= STDIN
|
109
|
+
case command
|
110
|
+
when 'show'
|
111
|
+
BinMan.send(command, source)
|
112
|
+
when 'load', 'dump', 'conv'
|
113
|
+
puts BinMan.send(command, source)
|
114
|
+
else
|
115
|
+
warn 'binman: invalid command; try --help'
|
116
|
+
exit 1
|
117
|
+
end
|
111
118
|
end
|
data/binman.gemspec
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path(
|
3
|
-
require
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'binman/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
|
-
s.name =
|
6
|
+
s.name = 'binman'
|
7
7
|
s.version = BinMan::VERSION
|
8
8
|
s.authors,
|
9
9
|
s.email = File.read('LICENSE').scan(/Copyright \d+ (.+) <(.+?)>/).transpose
|
10
|
-
s.homepage =
|
11
|
-
s.summary =
|
12
|
-
s.description =
|
10
|
+
s.homepage = 'http://github.com/sunaku/binman'
|
11
|
+
s.summary = 'man pages for bin scripts'
|
12
|
+
s.description = 'Produces UNIX manual pages for executable scripts.'
|
13
13
|
|
14
|
-
s.files = `git ls-files`.split("\n") + Dir[
|
14
|
+
s.files = `git ls-files`.split("\n") + Dir['man/**/*']
|
15
15
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
16
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
-
s.require_paths = [
|
17
|
+
s.require_paths = ['lib']
|
18
18
|
|
19
|
-
s.add_development_dependency
|
20
|
-
s.add_development_dependency
|
19
|
+
s.add_development_dependency 'md2man', '~> 1'
|
20
|
+
s.add_development_dependency 'rake', '>= 0.9.2.2', '< 1'
|
21
21
|
end
|
data/lib/binman.rb
CHANGED
@@ -34,7 +34,7 @@ module BinMan
|
|
34
34
|
require 'md2man'
|
35
35
|
Md2Man::ENGINE.render(read(source))
|
36
36
|
rescue LoadError
|
37
|
-
raise 'Run `gem install
|
37
|
+
raise 'Run `gem install md2man -v "~>1"` to use BinMan::conv().'
|
38
38
|
end
|
39
39
|
|
40
40
|
# Extracts leading comment header content from given
|
data/lib/binman/rakefile.rb
CHANGED
data/lib/binman/version.rb
CHANGED
data/man/man1/binman.1
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
.TH BINMAN 1
|
1
|
+
.TH BINMAN 1 2012\-02\-06 3.1.0
|
2
2
|
.SH NAME
|
3
3
|
.PP
|
4
|
-
binman \-
|
4
|
+
binman \- man pages for bin scripts
|
5
5
|
.SH SYNOPSIS
|
6
6
|
.PP
|
7
7
|
\fB\fCbinman\fR [\fIOPTION\fP]... \fICOMMAND\fP
|
@@ -10,35 +10,39 @@ binman \- UNIX man pages for Ruby \fB\fCbin/\fR scripts
|
|
10
10
|
binman
|
11
11
|
.UR https://github.com/sunaku/binman
|
12
12
|
.UE
|
13
|
-
produces UNIX
|
14
|
-
their leading comment headers (defined below), convert them from
|
15
|
-
.BR markdown (7)
|
13
|
+
produces UNIX manual pages for your executable scripts. It can
|
14
|
+
extract their leading comment headers (defined below), convert them from
|
15
|
+
.BR markdown (7)
|
16
16
|
into
|
17
17
|
.BR roff (7)
|
18
18
|
using md2man
|
19
19
|
.UR https://github.com/sunaku/md2man
|
20
20
|
.UE , and display them using
|
21
21
|
.BR man (1).
|
22
|
-
.SS Leading
|
22
|
+
.SS Leading comment headers
|
23
23
|
.PP
|
24
24
|
A leading comment header can be one of the following two things:
|
25
25
|
.nr step0 0 1
|
26
26
|
.RS
|
27
27
|
.IP \n+[step0]
|
28
|
-
A contiguous sequence of single\-line comments
|
29
|
-
|
30
|
-
|
28
|
+
A contiguous sequence of single\-line comments (which begin with \fB\fC#\fR
|
29
|
+
and optionally continue with a single space followed by any number of
|
30
|
+
characters until the end of the line) starting at the beginning of the
|
31
|
+
file (after shebang and encoding comments plus optional blank lines) and
|
32
|
+
ending at the first single blank line.
|
31
33
|
.IP \n+[step0]
|
32
|
-
|
34
|
+
The first embedded document delimited by \fB\fC=begin\fR and \fB\fC=end\fR lines, which
|
35
|
+
begin with the respective delimiters and optionally continue with a single
|
36
|
+
space followed by any number of characters until the end of the line.
|
33
37
|
.RE
|
34
|
-
.SS Markdown
|
38
|
+
.SS Markdown processing divergence
|
35
39
|
.PP
|
36
40
|
Although your leading comment headers are written in
|
37
41
|
.BR markdown (7),
|
38
42
|
\fB\fCbinman
|
39
|
-
conv\fR
|
43
|
+
conv\fR inherits the following additions to
|
40
44
|
.BR markdown (7)
|
41
|
-
syntax
|
45
|
+
syntax from md2man
|
42
46
|
.UR https://github.com/sunaku/md2man
|
43
47
|
.UE :
|
44
48
|
.RS
|
@@ -46,7 +50,7 @@ syntax via md2man
|
|
46
50
|
There can be at most one top\-level heading (H1). It is emitted as \fB\fC.TH\fR
|
47
51
|
in the
|
48
52
|
.BR roff (7)
|
49
|
-
output
|
53
|
+
output to define the UNIX manual page's header and footer.
|
50
54
|
.IP \(bu 2
|
51
55
|
Paragraphs whose lines are all uniformly indented by two spaces are
|
52
56
|
considered to be "indented paragraphs". They are unindented accordingly
|
@@ -60,14 +64,13 @@ are unindented accordingly before emission as \fB\fC.TP\fR in the
|
|
60
64
|
.BR roff (7)
|
61
65
|
output.
|
62
66
|
.RE
|
63
|
-
.SS Markdown
|
67
|
+
.SS Markdown processing extensions
|
64
68
|
.PP
|
65
|
-
The following
|
69
|
+
The following Redcarpet
|
66
70
|
.UR https://github.com/tanoku/redcarpet
|
67
71
|
.UE
|
68
|
-
extensions
|
69
|
-
.BR markdown (7)
|
70
|
-
are enabled:
|
72
|
+
extensions are enabled while processing
|
73
|
+
.BR markdown (7):
|
71
74
|
.RS
|
72
75
|
.IP \(bu 2
|
73
76
|
tables
|
@@ -85,10 +88,19 @@ fenced_code_blocks
|
|
85
88
|
.SH OPTIONS
|
86
89
|
.TP
|
87
90
|
\fB\fC-h\fR, \fB\fC--help\fR
|
88
|
-
|
89
|
-
.BR man (1).
|
91
|
+
Show this help manual.
|
90
92
|
.SH COMMANDS
|
91
93
|
.TP
|
94
|
+
\fB\fChelp\fR \fIFILE\fP [\fIARGUMENT\fP]...
|
95
|
+
If the given \fIARGUMENT\fP sequence contains \fB\fC-h\fR or \fB\fC--help\fR except after
|
96
|
+
\fB\fC--\fR, then this program extracts the given \fIFILE\fP's leading comment header,
|
97
|
+
converts it into
|
98
|
+
.BR roff (7),
|
99
|
+
and displays it using
|
100
|
+
.BR man (1)
|
101
|
+
before exiting with
|
102
|
+
status code \fB\fC0\fR. Otherwise, this program exits with status code \fB\fC111\fR.
|
103
|
+
.TP
|
92
104
|
\fB\fCshow\fR [\fIFILE\fP]
|
93
105
|
Use
|
94
106
|
.BR man (1)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: binman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: md2man
|
16
|
-
requirement: &
|
16
|
+
requirement: &16648520 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '1'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *16648520
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &16906320 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -35,8 +35,8 @@ dependencies:
|
|
35
35
|
version: '1'
|
36
36
|
type: :development
|
37
37
|
prerelease: false
|
38
|
-
version_requirements: *
|
39
|
-
description:
|
38
|
+
version_requirements: *16906320
|
39
|
+
description: Produces UNIX manual pages for executable scripts.
|
40
40
|
email:
|
41
41
|
- sunaku@gmail.com
|
42
42
|
executables:
|
@@ -70,7 +70,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
70
70
|
version: '0'
|
71
71
|
segments:
|
72
72
|
- 0
|
73
|
-
hash:
|
73
|
+
hash: 1200769804944669574
|
74
74
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
75
|
none: false
|
76
76
|
requirements:
|
@@ -79,11 +79,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
79
|
version: '0'
|
80
80
|
segments:
|
81
81
|
- 0
|
82
|
-
hash:
|
82
|
+
hash: 1200769804944669574
|
83
83
|
requirements: []
|
84
84
|
rubyforge_project:
|
85
85
|
rubygems_version: 1.8.11
|
86
86
|
signing_key:
|
87
87
|
specification_version: 3
|
88
|
-
summary:
|
88
|
+
summary: man pages for bin scripts
|
89
89
|
test_files: []
|