bcat 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -1
- data/bcat.gemspec +4 -3
- data/lib/bcat.rb +2 -2
- data/lib/bcat/ansi.rb +1 -1
- data/lib/bcat/browser.rb +1 -1
- data/man/a2h.1 +4 -4
- data/man/a2h.1.ronn +1 -1
- data/man/bcat.1 +10 -9
- data/man/bcat.1.ronn +4 -4
- data/man/btee.1 +10 -9
- data/man/btee.1.ronn +4 -4
- data/man/index.html +4 -4
- data/test/contest.rb +68 -0
- metadata +10 -8
data/README
CHANGED
@@ -8,7 +8,7 @@ Vim or Emacs. It reads from standard input, or one or more files, and streams
|
|
8
8
|
output to a browser window:
|
9
9
|
|
10
10
|
$ echo "hi mom" |bcat
|
11
|
-
$ echo "hi mom" |bcat -
|
11
|
+
$ echo "hi mom" |bcat -T 'Important Message'
|
12
12
|
$ echo "hi mom" |bcat -b chrome
|
13
13
|
|
14
14
|
Plain text is converted to simple preformatted HTML with rudimentary support for
|
data/bcat.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'bcat'
|
3
|
-
s.version = '0.5.
|
4
|
-
s.date = '2010-
|
3
|
+
s.version = '0.5.1'
|
4
|
+
s.date = '2010-07-11'
|
5
5
|
|
6
6
|
s.description = "pipe to browser utility"
|
7
7
|
s.summary =
|
@@ -35,6 +35,7 @@ Gem::Specification.new do |s|
|
|
35
35
|
man/btee.1
|
36
36
|
man/btee.1.ronn
|
37
37
|
man/index.html
|
38
|
+
test/contest.rb
|
38
39
|
test/test_bcat_a2h.rb
|
39
40
|
test/test_bcat_ansi.rb
|
40
41
|
test/test_bcat_browser.rb
|
@@ -46,7 +47,7 @@ Gem::Specification.new do |s|
|
|
46
47
|
s.executables = ['bcat']
|
47
48
|
|
48
49
|
s.test_files = s.files.select {|path| path =~ /^test\/.*_test.rb/}
|
49
|
-
s.add_dependency 'rack'
|
50
|
+
s.add_dependency 'rack', '< 1.2'
|
50
51
|
|
51
52
|
s.extra_rdoc_files = %w[COPYING]
|
52
53
|
|
data/lib/bcat.rb
CHANGED
@@ -6,7 +6,7 @@ require 'bcat/server'
|
|
6
6
|
require 'bcat/browser'
|
7
7
|
|
8
8
|
class Bcat
|
9
|
-
VERSION = '0.5.
|
9
|
+
VERSION = '0.5.1'
|
10
10
|
include Rack::Utils
|
11
11
|
|
12
12
|
attr_reader :format
|
@@ -101,7 +101,7 @@ class Bcat
|
|
101
101
|
|
102
102
|
def close
|
103
103
|
notice "closing with interrupt"
|
104
|
-
raise Interrupt
|
104
|
+
raise Interrupt, "connection closed"
|
105
105
|
end
|
106
106
|
|
107
107
|
def notice(message)
|
data/lib/bcat/ansi.rb
CHANGED
@@ -5,7 +5,7 @@ class Bcat
|
|
5
5
|
# The ANSI module is based on code from the following libraries:
|
6
6
|
#
|
7
7
|
# ansi2html.sh:
|
8
|
-
# http://
|
8
|
+
# http://github.com/pixelb/scripts/blob/master/scripts/ansi2html.sh
|
9
9
|
#
|
10
10
|
# HTML::FromANSI:
|
11
11
|
# http://cpansearch.perl.org/src/NUFFIN/HTML-FromANSI-2.03/lib/HTML/FromANSI.pm
|
data/lib/bcat/browser.rb
CHANGED
data/man/a2h.1
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
.\" generated with Ronn/v0.
|
2
|
-
.\" http://github.com/rtomayko/ronn/tree/0.
|
1
|
+
.\" generated with Ronn/v0.7.3
|
2
|
+
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "A2H" "1" "June 2010" "Ryan Tomayko" "Bcat 0.
|
4
|
+
.TH "A2H" "1" "June 2010" "Ryan Tomayko" "Bcat 0.5.0"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBa2h\fR \- convert ANSI/VT100 escape sequences to HTML
|
@@ -52,4 +52,4 @@ Light foreground colors\.
|
|
52
52
|
Light background color\.
|
53
53
|
.
|
54
54
|
.SH "SEE ALSO"
|
55
|
-
ansi2html\.sh \fIhttp://
|
55
|
+
ansi2html\.sh \fIhttp://github\.com/pixelb/scripts/blob/master/scripts/ansi2html\.sh\fR, HTML::FromANSI \fIhttp://cpansearch\.perl\.org/src/NUFFIN/HTML\-FromANSI\-2\.03/lib/HTML/FromANSI\.pm\fR
|
data/man/a2h.1.ronn
CHANGED
@@ -35,5 +35,5 @@ The following escape sequences are supported:
|
|
35
35
|
|
36
36
|
## SEE ALSO
|
37
37
|
|
38
|
-
[ansi2html.sh](http://
|
38
|
+
[ansi2html.sh](http://github.com/pixelb/scripts/blob/master/scripts/ansi2html.sh),
|
39
39
|
[HTML::FromANSI](http://cpansearch.perl.org/src/NUFFIN/HTML-FromANSI-2.03/lib/HTML/FromANSI.pm)
|
data/man/bcat.1
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
.\" generated with Ronn/v0.
|
2
|
-
.\" http://github.com/rtomayko/ronn/tree/0.
|
1
|
+
.\" generated with Ronn/v0.7.3
|
2
|
+
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BCAT" "1" "
|
4
|
+
.TH "BCAT" "1" "July 2010" "Ryan Tomayko" "Bcat 0.5.0"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbcat\fR \- browser cat
|
@@ -55,7 +55,7 @@ Turn on verbose debug logging to standard error\. Include this output when repor
|
|
55
55
|
.
|
56
56
|
.TP
|
57
57
|
\fBBCAT_BROWSER\fR=default|firefox|safari|chrome|opera|\fIother\fR
|
58
|
-
The name of the browser to use by default\. \fBbcat\fR maps this to an actual browser command based on the current platform\. The special value
|
58
|
+
The name of the browser to use by default\. \fBbcat\fR maps this to an actual browser command based on the current platform\. The special value "default" maps to the system default browser\.
|
59
59
|
.
|
60
60
|
.TP
|
61
61
|
\fBBCAT_COMMAND\fR=\fIcommand\fR
|
@@ -84,7 +84,8 @@ As a clipboard viewer:
|
|
84
84
|
.
|
85
85
|
.nf
|
86
86
|
|
87
|
-
pbpaste
|
87
|
+
pbpaste |bcat # mac
|
88
|
+
xclip \-o |bcat # X11
|
88
89
|
.
|
89
90
|
.fi
|
90
91
|
.
|
@@ -158,8 +159,8 @@ As a log viewer:
|
|
158
159
|
.
|
159
160
|
.nf
|
160
161
|
|
161
|
-
tail \-n 1000 \-f log/
|
162
|
-
tail \-f $RAILS_ROOT/log/development\.log
|
162
|
+
tail \-n 1000 \-f /var/log/messages |bcat
|
163
|
+
tail \-f $RAILS_ROOT/log/development\.log |bcat
|
163
164
|
.
|
164
165
|
.fi
|
165
166
|
.
|
@@ -199,8 +200,8 @@ Create keymappings:
|
|
199
200
|
.
|
200
201
|
.nf
|
201
202
|
|
202
|
-
map ,pm :!markdown % |bcat
|
203
|
-
map ,pp :!pygmentize \-Ofull,style=colorful \-f html % |bcat
|
203
|
+
map ,pm :!markdown % \e|bcat
|
204
|
+
map ,pp :!pygmentize \-Ofull,style=colorful \-f html % \e|bcat
|
204
205
|
.
|
205
206
|
.fi
|
206
207
|
.
|
data/man/bcat.1.ronn
CHANGED
@@ -111,8 +111,8 @@ With git, as the default PAGER:
|
|
111
111
|
|
112
112
|
As a log viewer:
|
113
113
|
|
114
|
-
tail -n 1000 -f log/
|
115
|
-
tail -f $RAILS_ROOT/log/development.log
|
114
|
+
tail -n 1000 -f /var/log/messages |bcat
|
115
|
+
tail -f $RAILS_ROOT/log/development.log |bcat
|
116
116
|
|
117
117
|
Or, a remote log viewer:
|
118
118
|
|
@@ -127,8 +127,8 @@ Preview current buffer as HTML:
|
|
127
127
|
|
128
128
|
Create keymappings:
|
129
129
|
|
130
|
-
map ,pm :!markdown %
|
131
|
-
map ,pp :!pygmentize -Ofull,style=colorful -f html %
|
130
|
+
map ,pm :!markdown % \|bcat
|
131
|
+
map ,pp :!pygmentize -Ofull,style=colorful -f html % \|bcat
|
132
132
|
|
133
133
|
Use with `makeprg`:
|
134
134
|
|
data/man/btee.1
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
.\" generated with Ronn/v0.
|
2
|
-
.\" http://github.com/rtomayko/ronn/tree/0.
|
1
|
+
.\" generated with Ronn/v0.7.3
|
2
|
+
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BCAT" "1" "
|
4
|
+
.TH "BCAT" "1" "July 2010" "Ryan Tomayko" "Bcat 0.5.0"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbcat\fR \- browser cat
|
@@ -55,7 +55,7 @@ Turn on verbose debug logging to standard error\. Include this output when repor
|
|
55
55
|
.
|
56
56
|
.TP
|
57
57
|
\fBBCAT_BROWSER\fR=default|firefox|safari|chrome|opera|\fIother\fR
|
58
|
-
The name of the browser to use by default\. \fBbcat\fR maps this to an actual browser command based on the current platform\. The special value
|
58
|
+
The name of the browser to use by default\. \fBbcat\fR maps this to an actual browser command based on the current platform\. The special value "default" maps to the system default browser\.
|
59
59
|
.
|
60
60
|
.TP
|
61
61
|
\fBBCAT_COMMAND\fR=\fIcommand\fR
|
@@ -84,7 +84,8 @@ As a clipboard viewer:
|
|
84
84
|
.
|
85
85
|
.nf
|
86
86
|
|
87
|
-
pbpaste
|
87
|
+
pbpaste |bcat # mac
|
88
|
+
xclip \-o |bcat # X11
|
88
89
|
.
|
89
90
|
.fi
|
90
91
|
.
|
@@ -158,8 +159,8 @@ As a log viewer:
|
|
158
159
|
.
|
159
160
|
.nf
|
160
161
|
|
161
|
-
tail \-n 1000 \-f log/
|
162
|
-
tail \-f $RAILS_ROOT/log/development\.log
|
162
|
+
tail \-n 1000 \-f /var/log/messages |bcat
|
163
|
+
tail \-f $RAILS_ROOT/log/development\.log |bcat
|
163
164
|
.
|
164
165
|
.fi
|
165
166
|
.
|
@@ -199,8 +200,8 @@ Create keymappings:
|
|
199
200
|
.
|
200
201
|
.nf
|
201
202
|
|
202
|
-
map ,pm :!markdown % |bcat
|
203
|
-
map ,pp :!pygmentize \-Ofull,style=colorful \-f html % |bcat
|
203
|
+
map ,pm :!markdown % \e|bcat
|
204
|
+
map ,pp :!pygmentize \-Ofull,style=colorful \-f html % \e|bcat
|
204
205
|
.
|
205
206
|
.fi
|
206
207
|
.
|
data/man/btee.1.ronn
CHANGED
@@ -111,8 +111,8 @@ With git, as the default PAGER:
|
|
111
111
|
|
112
112
|
As a log viewer:
|
113
113
|
|
114
|
-
tail -n 1000 -f log/
|
115
|
-
tail -f $RAILS_ROOT/log/development.log
|
114
|
+
tail -n 1000 -f /var/log/messages |bcat
|
115
|
+
tail -f $RAILS_ROOT/log/development.log |bcat
|
116
116
|
|
117
117
|
Or, a remote log viewer:
|
118
118
|
|
@@ -127,8 +127,8 @@ Preview current buffer as HTML:
|
|
127
127
|
|
128
128
|
Create keymappings:
|
129
129
|
|
130
|
-
map ,pm :!markdown %
|
131
|
-
map ,pp :!pygmentize -Ofull,style=colorful -f html %
|
130
|
+
map ,pm :!markdown % \|bcat
|
131
|
+
map ,pp :!pygmentize -Ofull,style=colorful -f html % \|bcat
|
132
132
|
|
133
133
|
Use with `makeprg`:
|
134
134
|
|
data/man/index.html
CHANGED
@@ -130,8 +130,8 @@ git diff HEAD@{5d} HEAD
|
|
130
130
|
|
131
131
|
<p>As a log viewer:</p>
|
132
132
|
|
133
|
-
<pre><code>tail -n 1000 -f log/
|
134
|
-
tail -f $RAILS_ROOT/log/development.log
|
133
|
+
<pre><code>tail -n 1000 -f /var/log/messages |bcat
|
134
|
+
tail -f $RAILS_ROOT/log/development.log |bcat
|
135
135
|
</code></pre>
|
136
136
|
|
137
137
|
<p>Or, a remote log viewer:</p>
|
@@ -149,8 +149,8 @@ tail -f $RAILS_ROOT/log/development.log
|
|
149
149
|
|
150
150
|
<p>Create keymappings:</p>
|
151
151
|
|
152
|
-
<pre><code>:map ,pm :!markdown %
|
153
|
-
:map ,pp :!pygmentize -Ofull,style=colorful -f html %
|
152
|
+
<pre><code>:map ,pm :!markdown % \|bcat
|
153
|
+
:map ,pp :!pygmentize -Ofull,style=colorful -f html % \|bcat
|
154
154
|
</code></pre>
|
155
155
|
|
156
156
|
<p>Use with <code>makeprg</code>:</p>
|
data/test/contest.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
require "test/unit"
|
2
|
+
|
3
|
+
# Test::Unit loads a default test if the suite is empty, whose purpose is to
|
4
|
+
# fail. Since having empty contexts is a common practice, we decided to
|
5
|
+
# overwrite TestSuite#empty? in order to allow them. Having a failure when no
|
6
|
+
# tests have been defined seems counter-intuitive.
|
7
|
+
class Test::Unit::TestSuite
|
8
|
+
def empty?
|
9
|
+
false
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# Contest adds +teardown+, +test+ and +context+ as class methods, and the
|
14
|
+
# instance methods +setup+ and +teardown+ now iterate on the corresponding
|
15
|
+
# blocks. Note that all setup and teardown blocks must be defined with the
|
16
|
+
# block syntax. Adding setup or teardown instance methods defeats the purpose
|
17
|
+
# of this library.
|
18
|
+
class Test::Unit::TestCase
|
19
|
+
def self.setup(&block)
|
20
|
+
define_method :setup do
|
21
|
+
super(&block)
|
22
|
+
instance_eval(&block)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.teardown(&block)
|
27
|
+
define_method :teardown do
|
28
|
+
instance_eval(&block)
|
29
|
+
super(&block)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.context(name, &block)
|
34
|
+
subclass = Class.new(self)
|
35
|
+
remove_tests(subclass)
|
36
|
+
subclass.class_eval(&block) if block_given?
|
37
|
+
const_set(context_name(name), subclass)
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.test(name, &block)
|
41
|
+
define_method(test_name(name), &block)
|
42
|
+
end
|
43
|
+
|
44
|
+
class << self
|
45
|
+
alias_method :should, :test
|
46
|
+
alias_method :describe, :context
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def self.context_name(name)
|
52
|
+
"Test#{sanitize_name(name).gsub(/(^| )(\w)/) { $2.upcase }}".to_sym
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.test_name(name)
|
56
|
+
"test_#{sanitize_name(name).gsub(/\s+/,'_')}".to_sym
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.sanitize_name(name)
|
60
|
+
name.gsub(/\W+/, ' ').strip
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.remove_tests(subclass)
|
64
|
+
subclass.public_instance_methods.grep(/^test_/).each do |meth|
|
65
|
+
subclass.send(:undef_method, meth.to_sym)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bcat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 1
|
10
|
+
version: 0.5.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Tomayko
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-07-11 00:00:00 -07:00
|
19
19
|
default_executable: bcat
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -24,12 +24,13 @@ dependencies:
|
|
24
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - <
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 11
|
30
30
|
segments:
|
31
|
-
-
|
32
|
-
|
31
|
+
- 1
|
32
|
+
- 2
|
33
|
+
version: "1.2"
|
33
34
|
type: :runtime
|
34
35
|
version_requirements: *id001
|
35
36
|
description: pipe to browser utility
|
@@ -63,6 +64,7 @@ files:
|
|
63
64
|
- man/btee.1
|
64
65
|
- man/btee.1.ronn
|
65
66
|
- man/index.html
|
67
|
+
- test/contest.rb
|
66
68
|
- test/test_bcat_a2h.rb
|
67
69
|
- test/test_bcat_ansi.rb
|
68
70
|
- test/test_bcat_browser.rb
|