command_line_reporter 3.0.1 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,30 @@
1
+ require 'command_line_reporter'
2
+
3
+ include CommandLineReporter
4
+
5
+ class Example
6
+ def initialize
7
+ self.formatter = 'progress'
8
+ end
9
+
10
+ def run
11
+ suppress_output
12
+
13
+ report do
14
+ sum = 0
15
+ 10.times do
16
+ sum += 10
17
+ progress
18
+ end
19
+ vertical_spacing
20
+ aligned("Sum: #{sum}")
21
+ end
22
+
23
+ capture_output
24
+ end
25
+ end
26
+
27
+ out = Example.new.run
28
+
29
+ puts 'this could be stored in a database'
30
+ puts out
@@ -14,6 +14,13 @@ module CommandLineReporter
14
14
  :formatter => 'nested',
15
15
  }
16
16
 
17
+ def capture_output
18
+ $stdout.rewind
19
+ $stdout.read
20
+ ensure
21
+ $stdout = STDOUT
22
+ end
23
+
17
24
  def suppress_output
18
25
  $stdout = StringIO.new
19
26
  end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module CommandLineReporter
2
- VERSION = '3.0.1'
2
+ VERSION = '3.1.0'
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: command_line_reporter
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 3.0.1
5
+ version: 3.1.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Wes
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2012-02-16 00:00:00 Z
14
+ date: 2012-02-21 00:00:00 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -49,6 +49,7 @@ files:
49
49
  - examples/quiet.rb
50
50
  - examples/simple.rb
51
51
  - examples/table.rb
52
+ - examples/variable.rb
52
53
  - lib/column.rb
53
54
  - lib/command_line_reporter.rb
54
55
  - lib/nested_formatter.rb
@@ -81,7 +82,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
82
  requirements:
82
83
  - - ">="
83
84
  - !ruby/object:Gem::Version
84
- hash: -1689801609385813230
85
+ hash: -339870674346797653
85
86
  segments:
86
87
  - 0
87
88
  version: "0"