command_line_reporter 2.0 → 2.1
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.
- data/README.md +44 -276
- data/examples/quiet.rb +40 -0
- data/examples/simple.rb +12 -12
- data/examples/table.rb +1 -1
- data/lib/column.rb +0 -2
- data/lib/command_line_reporter.rb +10 -1
- data/lib/row.rb +1 -1
- data/lib/table.rb +2 -2
- data/lib/version.rb +1 -1
- data/spec/column_spec.rb +0 -16
- data/spec/row_spec.rb +11 -11
- data/spec/table_spec.rb +1 -1
- metadata +37 -30
data/README.md
CHANGED
@@ -1,15 +1,23 @@
|
|
1
1
|
## Command Line Reporter
|
2
2
|
|
3
|
-
This gem provides
|
4
|
-
|
5
|
-
|
3
|
+
This gem provides a DSL that makes it easy to write reports of various types in ruby. It eliminate
|
4
|
+
the need to litter your source with *puts* statements instead providing a more readable, expressive
|
5
|
+
interface to your application. Some of the best features include:
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
* Formatters that automatically indicate progress
|
8
|
+
* Table syntax similar to HTML that makes it trivial to format your data in rows and columns
|
9
|
+
* Easily created headers and footers for your report
|
10
|
+
* Output suppression that makes it easy for your script to support a _quiet_ flag
|
9
11
|
|
10
12
|
### Installation
|
11
13
|
|
12
|
-
It is up on rubygems.org so add it to your bundle
|
14
|
+
It is up on rubygems.org so add it to your bundle
|
15
|
+
|
16
|
+
```bash
|
17
|
+
gem 'command_line_reporter', '>=2.1'
|
18
|
+
```
|
19
|
+
|
20
|
+
or do it the old fashioned way:
|
13
21
|
|
14
22
|
```bash
|
15
23
|
gem install command_line_reporter
|
@@ -20,10 +28,20 @@ gem install command_line_reporter
|
|
20
28
|
The gem provides a mixin that can be included in your scripts.
|
21
29
|
|
22
30
|
```ruby
|
23
|
-
|
31
|
+
require 'command_line_reporter'
|
32
|
+
|
33
|
+
class MyReport
|
34
|
+
include CommandLineReporter
|
35
|
+
...
|
36
|
+
end
|
24
37
|
```
|
25
38
|
|
26
|
-
|
39
|
+
### [Wiki](https://github.com/wbailey/command_line_reporter/wiki)
|
40
|
+
|
41
|
+
The [Wiki](https://github.com/wbailey/command_line_reporter/wiki) has all of the documentation
|
42
|
+
necessary for getting you started.
|
43
|
+
|
44
|
+
### API Reference
|
27
45
|
|
28
46
|
There are several methods the mixin provides that do not depend on the formatter used:
|
29
47
|
|
@@ -74,277 +92,27 @@ There are several methods the mixin provides that do not depend on the formatter
|
|
74
92
|
* :padding - The number of spaces to put on both the left and right of the text.
|
75
93
|
* :align - Allowed values are left|right|center
|
76
94
|
|
77
|
-
###
|
78
|
-
|
79
|
-
#### Example
|
80
|
-
|
81
|
-
```ruby
|
82
|
-
require 'command_line_reporter'
|
83
|
-
|
84
|
-
class Example
|
85
|
-
include CommandLineReporter
|
86
|
-
|
87
|
-
def initialize
|
88
|
-
self.formatter = 'progress'
|
89
|
-
end
|
90
|
-
|
91
|
-
def run
|
92
|
-
x = 0
|
93
|
-
report do
|
94
|
-
10.times do
|
95
|
-
x += 1
|
96
|
-
formatter.progress
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
Example.new.run
|
103
|
-
```
|
104
|
-
|
105
|
-
This simply produces 10 dots (.) in succession:
|
106
|
-
|
107
|
-
```bash
|
108
|
-
[~/scratch]$ ruby example.rb
|
109
|
-
..........
|
110
|
-
```
|
111
|
-
|
112
|
-
#### Indicator
|
113
|
-
|
114
|
-
The indicator is the string that is displayed in the command line interface that indicates progress.
|
115
|
-
The default is the dot (.) but any string is allowed. In fact one can use the erase character to
|
116
|
-
get crafty with displaying percent complete in place.
|
117
|
-
|
118
|
-
#### Instance Methods
|
119
|
-
|
120
|
-
* _indicator(string)_ - This overrides the default value of the dot (.) being used for all calls to
|
121
|
-
the report method.
|
122
|
-
|
123
|
-
```ruby
|
124
|
-
formatter.indicator('*')
|
125
|
-
```
|
126
|
-
|
127
|
-
* _progress(string)_ - Call this method to invoke the output to the command line interface. The
|
128
|
-
string overrides the indicator for this call only.
|
129
|
-
|
130
|
-
```ruby
|
131
|
-
formatter.progress
|
132
|
-
formatter.progress("^H^H^H10%")
|
133
|
-
```
|
134
|
-
|
135
|
-
### Nested Formatter
|
136
|
-
|
137
|
-
The nested formatter concept is inspired by the documentation formatter in RSpec. The idea is to be
|
138
|
-
able to create nested grouping levels of output that are very readable as the code is being
|
139
|
-
executed.
|
140
|
-
|
141
|
-
#### Example
|
142
|
-
|
143
|
-
```ruby
|
144
|
-
require 'command_line_reporter'
|
145
|
-
|
146
|
-
class Example
|
147
|
-
include CommandLineReporter
|
148
|
-
|
149
|
-
def initialize
|
150
|
-
self.formatter = 'nested'
|
151
|
-
end
|
152
|
-
|
153
|
-
def run
|
154
|
-
x,y,z = 0,0,0
|
155
|
-
|
156
|
-
report(:message => 'calculating first expression') do
|
157
|
-
x = 2 + 2
|
158
|
-
2.times do
|
159
|
-
report(:message => 'calculating second expression') do
|
160
|
-
y = 10 - x
|
161
|
-
10.times do |i|
|
162
|
-
report(:message => 'pixelizing', :type => 'inline', :complete => "#{i*10+10}%") do
|
163
|
-
z = x + y
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|
167
|
-
end
|
168
|
-
end
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
Example.new.run
|
173
|
-
|
174
|
-
```
|
175
|
-
|
176
|
-
This produces the more complex output:
|
177
|
-
|
178
|
-
```
|
179
|
-
[~/scratch]$ ruby example.rb
|
180
|
-
calculating first expression
|
181
|
-
calculating second expression
|
182
|
-
pixelizing...10%
|
183
|
-
pixelizing...20%
|
184
|
-
pixelizing...30%
|
185
|
-
pixelizing...40%
|
186
|
-
pixelizing...50%
|
187
|
-
pixelizing...60%
|
188
|
-
pixelizing...70%
|
189
|
-
pixelizing...80%
|
190
|
-
pixelizing...90%
|
191
|
-
pixelizing...100%
|
192
|
-
complete
|
193
|
-
calculating second expression
|
194
|
-
pixelizing...10%
|
195
|
-
pixelizing...20%
|
196
|
-
pixelizing...30%
|
197
|
-
pixelizing...40%
|
198
|
-
pixelizing...50%
|
199
|
-
pixelizing...60%
|
200
|
-
pixelizing...70%
|
201
|
-
pixelizing...80%
|
202
|
-
pixelizing...90%
|
203
|
-
pixelizing...100%
|
204
|
-
complete
|
205
|
-
complete
|
206
|
-
```
|
207
|
-
|
208
|
-
#### Instance Methods
|
209
|
-
|
210
|
-
* _message_string(string)_ - This defines the string that is displayed as the first part of the
|
211
|
-
message to the user. The default value is "_working_".
|
212
|
-
|
213
|
-
```ruby
|
214
|
-
formatter.message_string('working')
|
215
|
-
```
|
216
|
-
|
217
|
-
* _complete_string(string)_ - This defines the string that completes the message to the user for the
|
218
|
-
report. The default value is "_complete_".
|
219
|
-
|
220
|
-
```ruby
|
221
|
-
formatter.complete_string('done')
|
222
|
-
```
|
223
|
-
|
224
|
-
* _indent_size(int)_ - The number of spaces to indent for a single indentation level. The default
|
225
|
-
value is 2 spaces.
|
226
|
-
|
227
|
-
```ruby
|
228
|
-
formatter.indent_size(4)
|
229
|
-
```
|
230
|
-
|
231
|
-
#### Report Options
|
232
|
-
|
233
|
-
The following are the allowed values of the options hash argument to the _report_ method:
|
234
|
-
|
235
|
-
* _:message_ - The string that is displayed as the first part of the message to the user
|
236
|
-
* _:complete_ - The string that completes the message to the user
|
237
|
-
* _:type_ - Define as 'inline' if you want the message and complete strings on the same line
|
238
|
-
* _:indent_size_ - The number of spaces to indent the current level
|
239
|
-
|
240
|
-
```ruby
|
241
|
-
report(:message => 'running', :complete => 'finished', :type => 'inline', :indent_size => 8) do
|
242
|
-
# code here
|
243
|
-
end
|
244
|
-
```
|
245
|
-
|
246
|
-
### Tables
|
247
|
-
|
248
|
-
Examples are always helpful so let's look at the following:
|
249
|
-
|
250
|
-
```ruby
|
251
|
-
require 'command_line_reporter'
|
252
|
-
|
253
|
-
class Example
|
254
|
-
include CommandLineReporter
|
255
|
-
|
256
|
-
def run
|
257
|
-
table(:border => true) do
|
258
|
-
row do
|
259
|
-
column('NAME', :width => 20)
|
260
|
-
column('ADDRESS', :width => 30, :align => 'right', :padding => 5)
|
261
|
-
column('CITY', :width => 15)
|
262
|
-
end
|
263
|
-
row do
|
264
|
-
column('Ceaser')
|
265
|
-
column('1 Appian Way')
|
266
|
-
column('Rome')
|
267
|
-
end
|
268
|
-
row do
|
269
|
-
column('Richard Feynman')
|
270
|
-
column('1 Golden Gate')
|
271
|
-
column('Quantum Field')
|
272
|
-
end
|
273
|
-
end
|
274
|
-
end
|
275
|
-
end
|
276
|
-
|
277
|
-
Example.new.run
|
278
|
-
```
|
279
|
-
|
280
|
-
This produces the very simple output with 2 rows and 3 columns of data:
|
281
|
-
|
282
|
-
```bash
|
283
|
-
+----------------------+--------------------------------+-----------------+
|
284
|
-
| NAME | ADDRESS | CITY |
|
285
|
-
+----------------------+--------------------------------+-----------------+
|
286
|
-
| Ceaser | 1 Appian Way | Rome |
|
287
|
-
+----------------------+--------------------------------+-----------------+
|
288
|
-
| Richard Feynman | 1 Golden Gate | Quantum Field |
|
289
|
-
+----------------------+--------------------------------+-----------------+
|
290
|
-
```
|
291
|
-
|
292
|
-
Notice how the properties of the columns for the second and third rows have been inherited from the
|
293
|
-
first like in HTML. This makes it a lot easier to write in freeform. What if you have data to
|
294
|
-
iterate over and have text that is wider than the column width you have selected? Not a problem as
|
295
|
-
the following example demonstrates all of the combinations of the various options:
|
296
|
-
|
297
|
-
```ruby
|
298
|
-
require 'command_line_reporter'
|
299
|
-
|
300
|
-
class Example
|
301
|
-
include CommandLineReporter
|
95
|
+
### To Do
|
302
96
|
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
row do
|
307
|
-
i = 0
|
308
|
-
3.times do
|
309
|
-
i += 10
|
310
|
-
column('x' * (0 + rand(50)), :align => %w[left right center][rand(3)], :width => i, :padding => rand(5))
|
311
|
-
end
|
312
|
-
end
|
313
|
-
end
|
314
|
-
end
|
315
|
-
end
|
316
|
-
end
|
317
|
-
```
|
97
|
+
* Add the ability for a column to span across others
|
98
|
+
* Add the progress method to the top level mixin so that there is no need to invoke through the
|
99
|
+
formatter.
|
318
100
|
|
319
|
-
|
320
|
-
by 10 characters. The alignment of the column is demonstrated and you can see where some data
|
321
|
-
elements have padding around them.
|
101
|
+
### License
|
322
102
|
|
323
|
-
|
324
|
-
+------------+----------------------+--------------------------------+
|
325
|
-
| xxxxxxxxxx | xxxxxxxxxxxxxx | xxxxxxxxxxxxxxxxxxxxxxxxxx |
|
326
|
-
| xxxxxx | xxxxxxxxx | xxxxxx |
|
327
|
-
+------------+----------------------+--------------------------------+
|
328
|
-
| xxxxxxxxxx | xxxxxxxxxxxxxx | xxxxxxxxxxxxxxxxxxxxxxxxxx |
|
329
|
-
| xxxxxxxxxx | xxxxxxxxxxxxxx | xxxxxxxxxxxxxxxxx |
|
330
|
-
| xxxxxxxxxx | xxxxxxxxxxxxxx | |
|
331
|
-
| xxxxxxx | xxxx | |
|
332
|
-
+------------+----------------------+--------------------------------+
|
333
|
-
| xxxxxxxxxx | xxxx | xxxxxxxxxxxxxxxxxxx |
|
334
|
-
| xxxxxx | | |
|
335
|
-
+------------+----------------------+--------------------------------+
|
336
|
-
```
|
337
|
-
|
338
|
-
This is all generated randomly to illustrate the features but you get the idea of how to use
|
339
|
-
alignment, width and padding.
|
103
|
+
Copyright (c) 2011-2012 Wes Bailey
|
340
104
|
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
105
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
106
|
+
associated documentation files (the "Software"), to deal in the Software without restriction,
|
107
|
+
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
108
|
+
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
109
|
+
furnished to do so, subject to the following conditions:
|
345
110
|
|
346
|
-
|
111
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial
|
112
|
+
portions of the Software.
|
347
113
|
|
348
|
-
|
349
|
-
|
350
|
-
|
114
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
115
|
+
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
116
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
|
117
|
+
OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
118
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/examples/quiet.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'command_line_reporter'
|
2
|
+
require 'ostruct'
|
3
|
+
require 'optparse'
|
4
|
+
|
5
|
+
class Example
|
6
|
+
include CommandLineReporter
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
self.formatter = 'progress'
|
10
|
+
end
|
11
|
+
|
12
|
+
def run(options = {})
|
13
|
+
x = 0
|
14
|
+
|
15
|
+
suppress_output if options.quiet
|
16
|
+
|
17
|
+
report do
|
18
|
+
10.times do
|
19
|
+
x += 1
|
20
|
+
sleep 0.1
|
21
|
+
formatter.progress
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
restore_output if options.quiet
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
options = OpenStruct.new({:quiet => false})
|
31
|
+
|
32
|
+
OptionParser.new do |opts|
|
33
|
+
opts.banner = "Usage: ruby -I lib example/quiet.rb [-q|--quiet]"
|
34
|
+
|
35
|
+
opts.on('-q', '--quiet', 'do not print any output') do
|
36
|
+
options.quiet = true
|
37
|
+
end
|
38
|
+
end.parse!
|
39
|
+
|
40
|
+
Example.new.run(options)
|
data/examples/simple.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
require 'command_line_reporter'
|
2
2
|
|
3
|
+
include CommandLineReporter
|
4
|
+
|
3
5
|
class Example
|
4
|
-
|
6
|
+
def initialize
|
7
|
+
self.formatter = 'progress'
|
8
|
+
end
|
5
9
|
|
6
10
|
def run
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
z = x + y
|
11
|
+
report do
|
12
|
+
sum = 0
|
13
|
+
10.times do
|
14
|
+
sum += 10
|
15
|
+
self.formatter.progress
|
16
|
+
end
|
17
|
+
aligned("Sum: #{sum}")
|
15
18
|
end
|
16
|
-
|
17
|
-
footer(:title => 'Values', :width => 15)
|
18
|
-
%w(x y z).each {|v| aligned("#{v}: #{eval v}")}
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
data/examples/table.rb
CHANGED
@@ -24,7 +24,7 @@ class Example
|
|
24
24
|
vertical_spacing(2)
|
25
25
|
end
|
26
26
|
|
27
|
-
header(:title => 'A simple example of how column properties are
|
27
|
+
header(:title => 'A simple example of how column properties are inherited from the first row')
|
28
28
|
|
29
29
|
table(:border => true) do
|
30
30
|
row do
|
data/lib/column.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'stringio'
|
1
2
|
require 'table'
|
2
3
|
|
3
4
|
Dir[File.join(File.dirname(__FILE__), '*_formatter.rb')].each {|r| require r}
|
@@ -12,6 +13,14 @@ module CommandLineReporter
|
|
12
13
|
:align => 'left',
|
13
14
|
}
|
14
15
|
|
16
|
+
def suppress_output
|
17
|
+
$stdout = StringIO.new
|
18
|
+
end
|
19
|
+
|
20
|
+
def restore_output
|
21
|
+
$stdout = STDOUT
|
22
|
+
end
|
23
|
+
|
15
24
|
def formatter=(type = 'nested')
|
16
25
|
name = type.capitalize + 'Formatter'
|
17
26
|
klass = %W{CommandLineReporter #{name}}.inject(Kernel) {|s,c| s.const_get(c)}
|
@@ -85,7 +94,7 @@ module CommandLineReporter
|
|
85
94
|
def table(options = {})
|
86
95
|
@table = Table.new(options)
|
87
96
|
yield
|
88
|
-
@table.
|
97
|
+
@table.output
|
89
98
|
end
|
90
99
|
|
91
100
|
def row(options = {})
|
data/lib/row.rb
CHANGED
data/lib/table.rb
CHANGED
@@ -32,12 +32,12 @@ class Table
|
|
32
32
|
self.rows << row
|
33
33
|
end
|
34
34
|
|
35
|
-
def
|
35
|
+
def output
|
36
36
|
return if self.rows.size == 0 # we got here with nothing to print to the screen
|
37
37
|
|
38
38
|
puts self.rows[0].separator if self.border
|
39
39
|
self.rows.each do |row|
|
40
|
-
row.
|
40
|
+
row.output
|
41
41
|
puts self.rows[0].separator if self.border
|
42
42
|
end
|
43
43
|
end
|
data/lib/version.rb
CHANGED
data/spec/column_spec.rb
CHANGED
@@ -46,22 +46,6 @@ describe Column do
|
|
46
46
|
Column.new('test', :padding => 'asdf')
|
47
47
|
}.to raise_error ArgumentError
|
48
48
|
end
|
49
|
-
|
50
|
-
# it 'is immutable' do
|
51
|
-
# c = Column.new('test')
|
52
|
-
|
53
|
-
# expect {
|
54
|
-
# c.text = 'asdf'
|
55
|
-
# }.to raise_error RuntimeError, /frozen object/
|
56
|
-
|
57
|
-
# expect {
|
58
|
-
# c.width = 123
|
59
|
-
# }.to raise_error RuntimeError, /frozen object/
|
60
|
-
|
61
|
-
# expect {
|
62
|
-
# c.padding = 123
|
63
|
-
# }.to raise_error RuntimeError, /frozen object/
|
64
|
-
# end
|
65
49
|
end
|
66
50
|
|
67
51
|
describe '#screen_rows' do
|
data/spec/row_spec.rb
CHANGED
@@ -18,7 +18,7 @@ describe Row do
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
describe '#
|
21
|
+
describe '#output' do
|
22
22
|
before :each do
|
23
23
|
@cols = [
|
24
24
|
Column.new('asdf'),
|
@@ -41,46 +41,46 @@ describe Row do
|
|
41
41
|
|
42
42
|
context 'no border' do
|
43
43
|
context 'no wrap' do
|
44
|
-
it '
|
44
|
+
it 'outputs a single column' do
|
45
45
|
subject.add(@cols[0])
|
46
46
|
subject.should_receive(:puts).with(/^asdf#{@six_pieces}/)
|
47
|
-
subject.
|
47
|
+
subject.output
|
48
48
|
end
|
49
|
-
it '
|
49
|
+
it 'outputs three columns' do
|
50
50
|
subject.add(@cols[0])
|
51
51
|
subject.add(@cols[1])
|
52
52
|
subject.add(@cols[2])
|
53
53
|
subject.should_receive(:puts).with(/^asdf#{@six_spaces}#{@one_space}#{@three_spaces}qwer#{@three_spaces}#{@one_space}#{@six_spaces}zxcv $/)
|
54
|
-
subject.
|
54
|
+
subject.output
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
58
|
context 'with wrapping' do
|
59
|
-
it '
|
59
|
+
it 'outputs a single column' do
|
60
60
|
subject.add(@cols[3])
|
61
61
|
subject.should_receive(:puts).with(/^#{@ten_xs}#{@one_space}$/)
|
62
62
|
subject.should_receive(:puts).with(/^#{@ten_xs}#{@one_space}$/)
|
63
63
|
subject.should_receive(:puts).with(/^#{@five_xs}#{@six_spaces}$/)
|
64
|
-
subject.
|
64
|
+
subject.output
|
65
65
|
end
|
66
66
|
|
67
|
-
it '
|
67
|
+
it 'outputs multiple columns of the same size' do
|
68
68
|
subject.add(@cols[3])
|
69
69
|
subject.add(@cols[4])
|
70
70
|
subject.should_receive(:puts).with(/^#{@ten_xs}#{@one_space}#{@ten_xs}#{@one_space}$/)
|
71
71
|
subject.should_receive(:puts).with(/^#{@ten_xs}#{@one_space}#{@ten_xs}#{@one_space}$/)
|
72
72
|
subject.should_receive(:puts).with(/^#{@five_xs}#{@nine_spaces}#{@five_xs}#{@three_spaces}$/)
|
73
|
-
subject.
|
73
|
+
subject.output
|
74
74
|
end
|
75
75
|
|
76
|
-
it '
|
76
|
+
it 'outputs multiple columns with different sizes' do
|
77
77
|
subject.add(@cols[5])
|
78
78
|
subject.add(@cols[3])
|
79
79
|
subject.should_receive(:puts).with(/^#{@ten_xs}#{@one_space}#{@ten_xs}#{@one_space}$/)
|
80
80
|
subject.should_receive(:puts).with(/^#{@ten_xs}#{@one_space}#{@ten_xs}#{@one_space}$/)
|
81
81
|
subject.should_receive(:puts).with(/^#{@ten_xs}#{@one_space}#{@five_xs}#{@six_spaces}$/)
|
82
82
|
subject.should_receive(:puts).with(/^#{@five_xs} {5,17}$/)
|
83
|
-
subject.
|
83
|
+
subject.output
|
84
84
|
end
|
85
85
|
end
|
86
86
|
end
|
data/spec/table_spec.rb
CHANGED
metadata
CHANGED
@@ -1,37 +1,41 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: command_line_reporter
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: '2.0'
|
3
|
+
version: !ruby/object:Gem::Version
|
5
4
|
prerelease:
|
5
|
+
version: "2.1"
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Wes
|
9
9
|
- Bailey
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
|
14
|
+
date: 2012-01-29 00:00:00 Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
16
17
|
name: bundler
|
17
|
-
requirement: &
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
18
19
|
none: false
|
19
|
-
requirements:
|
20
|
-
- -
|
21
|
-
- !ruby/object:Gem::Version
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
22
23
|
version: 1.0.0
|
23
24
|
type: :development
|
24
25
|
prerelease: false
|
25
|
-
version_requirements: *
|
26
|
-
description: This gem makes it easy to provide a report while your ruby script is
|
27
|
-
executing
|
26
|
+
version_requirements: *id001
|
27
|
+
description: This gem makes it easy to provide a report while your ruby script is executing
|
28
28
|
email: baywes@gmail.com
|
29
29
|
executables: []
|
30
|
+
|
30
31
|
extensions: []
|
32
|
+
|
31
33
|
extra_rdoc_files: []
|
32
|
-
|
34
|
+
|
35
|
+
files:
|
33
36
|
- examples/nested.rb
|
34
37
|
- examples/progress.rb
|
38
|
+
- examples/quiet.rb
|
35
39
|
- examples/simple.rb
|
36
40
|
- examples/table.rb
|
37
41
|
- lib/column.rb
|
@@ -55,32 +59,35 @@ files:
|
|
55
59
|
- spec/table_spec.rb
|
56
60
|
homepage: http://github.com/wbailey/command_line_reporter
|
57
61
|
licenses: []
|
62
|
+
|
58
63
|
post_install_message:
|
59
64
|
rdoc_options: []
|
60
|
-
|
65
|
+
|
66
|
+
require_paths:
|
61
67
|
- lib
|
62
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
69
|
none: false
|
64
|
-
requirements:
|
65
|
-
- -
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
|
68
|
-
segments:
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
hash: -154884230452992637
|
74
|
+
segments:
|
69
75
|
- 0
|
70
|
-
|
71
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
version: "0"
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
78
|
none: false
|
73
|
-
requirements:
|
74
|
-
- -
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version:
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: "0"
|
77
83
|
requirements: []
|
84
|
+
|
78
85
|
rubyforge_project:
|
79
|
-
rubygems_version: 1.8.
|
86
|
+
rubygems_version: 1.8.15
|
80
87
|
signing_key:
|
81
88
|
specification_version: 3
|
82
89
|
summary: A tool for providing interactive command line applications
|
83
|
-
test_files:
|
90
|
+
test_files:
|
84
91
|
- spec/column_spec.rb
|
85
92
|
- spec/command_line_reporter_spec.rb
|
86
93
|
- spec/nested_formatter_spec.rb
|