fuubar 2.2.0 → 2.3.0.beta1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ddf54b4c579c32bbd4cbdf14cb70268207516cca
4
- data.tar.gz: b3d92bd30de59be3101bc466d7aaf9ddac6ab4a8
3
+ metadata.gz: 731a08e3acb3e7640f3d9e88791a9e312eecffb8
4
+ data.tar.gz: 68d93a5bdd40004a3dc5ef9b8e7f95c6d8772698
5
5
  SHA512:
6
- metadata.gz: 905c5d07754f19bc22a5ed8b703bb3369c6b18fb9a6f0b3e7dfd66518507053bb5a6da6068b1e566f6f2db11deb6010b6827e2a5d1e2d38f1259d01605ea108e
7
- data.tar.gz: c6e6a21b668654d46654b1309641c88fd22cc21ed8801a63f14ef5ee41c8dbef6fbc7b97d1ca183519deb8c890441e83d7c88ed2c6ddaeb54cebd27b78422a63
6
+ metadata.gz: 3dbfbb4396ca66e950b7808800e9e6435759d1cd6b8ac4f0e10129b3a740713b6b462b1938270f65c445d359964e81bc97d3c7a5d3a10043c002ae82307e1d5f
7
+ data.tar.gz: 1de02b998161ecaf7add33120276d9fee4461394ee7625e8c9c4fe4a735eb3207c7efb11848d25a9c599de6c854af5a80537faf9e9c83f1da6edde9b6168e52b
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -11,8 +11,11 @@ Supported Rubies
11
11
  * MRI Ruby 1.8.7
12
12
  * MRI Ruby 1.9.2
13
13
  * MRI Ruby 1.9.3
14
- * MRI Ruby 2.0.0
15
- * MRI Ruby 2.1.0
14
+ * MRI Ruby 2.0.x
15
+ * MRI Ruby 2.1.x
16
+ * MRI Ruby 2.2.x
17
+ * MRI Ruby 2.3.x
18
+ * MRI Ruby 2.4.x
16
19
  * JRuby (in 1.8 compat mode)
17
20
  * JRuby (in 1.9 compat mode)
18
21
 
data/lib/fuubar.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'rspec/core'
3
4
  require 'rspec/core/formatters/base_text_formatter'
4
5
  require 'ruby-progressbar'
@@ -9,14 +10,19 @@ RSpec.configuration.add_setting :fuubar_progress_bar_options, :default => {}
9
10
  class Fuubar < RSpec::Core::Formatters::BaseTextFormatter
10
11
  DEFAULT_PROGRESS_BAR_OPTIONS = { :format => ' %c/%C |%w>%i| %e ' }.freeze
11
12
 
12
- RSpec::Core::Formatters.register self, :start,
13
+ RSpec::Core::Formatters.register self,
14
+ :start,
13
15
  :message,
14
16
  :example_passed,
15
17
  :example_pending,
16
18
  :example_failed,
19
+ :example_started,
20
+ :example_finished,
17
21
  :dump_failures
18
22
 
19
- attr_accessor :progress,
23
+ attr_accessor :example_tick_thread,
24
+ :example_tick_lock,
25
+ :progress,
20
26
  :passed_count,
21
27
  :pending_count,
22
28
  :failed_count
@@ -24,22 +30,23 @@ class Fuubar < RSpec::Core::Formatters::BaseTextFormatter
24
30
  def initialize(*args)
25
31
  super
26
32
 
33
+ self.example_tick_lock = Mutex.new
27
34
  self.progress = ProgressBar.create(
28
- DEFAULT_PROGRESS_BAR_OPTIONS.
29
- merge(:throttle_rate => continuous_integration? ? 1.0 : nil).
30
- merge(:total => 0,
31
- :output => output,
32
- :autostart => false)
35
+ DEFAULT_PROGRESS_BAR_OPTIONS
36
+ .merge(:throttle_rate => continuous_integration? ? 1.0 : nil)
37
+ .merge(:total => 0,
38
+ :output => output,
39
+ :autostart => false)
33
40
  )
34
41
  end
35
42
 
36
43
  def start(notification)
37
- progress_bar_options = DEFAULT_PROGRESS_BAR_OPTIONS.
38
- merge(:throttle_rate => continuous_integration? ? 1.0 : nil).
39
- merge(configuration.fuubar_progress_bar_options).
40
- merge(:total => notification.count,
41
- :output => output,
42
- :autostart => false)
44
+ progress_bar_options = DEFAULT_PROGRESS_BAR_OPTIONS
45
+ .merge(:throttle_rate => continuous_integration? ? 1.0 : nil)
46
+ .merge(configuration.fuubar_progress_bar_options)
47
+ .merge(:total => notification.count,
48
+ :output => output,
49
+ :autostart => false)
43
50
 
44
51
  self.progress = ProgressBar.create(progress_bar_options)
45
52
  self.passed_count = 0
@@ -51,6 +58,14 @@ class Fuubar < RSpec::Core::Formatters::BaseTextFormatter
51
58
  with_current_color { progress.start }
52
59
  end
53
60
 
61
+ def example_started(notification)
62
+ self.example_tick_thread = start_tick_thread(notification)
63
+ end
64
+
65
+ def example_finished(_notification)
66
+ example_tick_thread.kill
67
+ end
68
+
54
69
  def example_passed(_notification)
55
70
  self.passed_count += 1
56
71
 
@@ -74,6 +89,12 @@ class Fuubar < RSpec::Core::Formatters::BaseTextFormatter
74
89
  increment
75
90
  end
76
91
 
92
+ def example_tick(_notification)
93
+ example_tick_lock.synchronize do
94
+ refresh
95
+ end
96
+ end
97
+
77
98
  def message(notification)
78
99
  if progress.respond_to? :log
79
100
  progress.log(notification.message)
@@ -99,6 +120,10 @@ class Fuubar < RSpec::Core::Formatters::BaseTextFormatter
99
120
  with_current_color { progress.increment }
100
121
  end
101
122
 
123
+ def refresh
124
+ with_current_color { progress.refresh }
125
+ end
126
+
102
127
  def with_current_color
103
128
  output.print "\e[#{color_code_for(current_color)}m" if color_enabled?
104
129
  yield
@@ -129,6 +154,16 @@ class Fuubar < RSpec::Core::Formatters::BaseTextFormatter
129
154
 
130
155
  def continuous_integration?
131
156
  @continuous_integration ||= \
132
- ![nil, '', 'false'].include?(ENV['CONTINUOUS_INTEGRATION'])
157
+ [nil, '', 'false'].exclude?(ENV['CONTINUOUS_INTEGRATION'])
158
+ end
159
+
160
+ def start_tick_thread(notification)
161
+ Thread.new do
162
+ loop do
163
+ sleep(1)
164
+
165
+ example_tick(notification)
166
+ end
167
+ end
133
168
  end
134
169
  end
data/lib/fuubar/output.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'delegate'
3
4
 
4
5
  class Fuubar < RSpec::Core::Formatters::BaseTextFormatter
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'fuubar'
3
4
 
4
5
  class TestNonTtyOutputClass
data/spec/fuubar_spec.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'fuubar'
3
4
  require 'stringio'
4
5
  require 'ostruct'
@@ -8,8 +9,8 @@ describe Fuubar do
8
9
  let(:output) do
9
10
  io = StringIO.new
10
11
 
11
- allow(io).to receive(:tty?).
12
- and_return(true)
12
+ allow(io).to receive(:tty?)
13
+ .and_return(true)
13
14
 
14
15
  io
15
16
  end
@@ -261,3 +262,4 @@ describe Fuubar do
261
262
  end
262
263
  end
263
264
  end
265
+ # rubocop:enable Metrics/LineLength
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fuubar
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicholas Evans
@@ -14,26 +14,26 @@ cert_chain:
14
14
  -----BEGIN CERTIFICATE-----
15
15
  MIIDrjCCApagAwIBAgIBATANBgkqhkiG9w0BAQUFADBOMRowGAYDVQQDDBFhY2Nv
16
16
  dW50c19ydWJ5Z2VtczEbMBkGCgmSJomT8ixkARkWC3RoZWtvbXBhbmVlMRMwEQYK
17
- CZImiZPyLGQBGRYDY29tMB4XDTE2MDQyNDAyNTEyM1oXDTE3MDQyNDAyNTEyM1ow
17
+ CZImiZPyLGQBGRYDY29tMB4XDTE3MTIzMTIzMzUwNloXDTE4MTIzMTIzMzUwNlow
18
18
  TjEaMBgGA1UEAwwRYWNjb3VudHNfcnVieWdlbXMxGzAZBgoJkiaJk/IsZAEZFgt0
19
19
  aGVrb21wYW5lZTETMBEGCgmSJomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEB
20
- BQADggEPADCCAQoCggEBANklzdaVeHtut6L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FjY291bnRzK3J1YnlnZW1zQHRoZWtvbXBhbmVlLmNvbTAN
29
- BgkqhkiG9w0BAQUFAAOCAQEASqdfJKMun1twosHfvdDH7Vgrb5VqX28qJ6MgnhjF
30
- p+3HYTjYo/KMQqu78TegUFO5xQ4oumU0FTXADW0ryXZvUGV74M0zwqpFqeo8onII
31
- lsVsWdMCLZS21M0uCQmcV+OQMNxL8jV3c0D3x9Srr9yO4oamW3seIdb+b9RfhmV2
32
- ryr+NH8U/4xgzdJ4hWV4qk93nwigp4lwJ4u93XJ7Cdyw7itvaEPnn8HpCfzsiLcw
33
- QwSfDGz6+zsImi5N3UT71+mk7YcviQSgvMRl3VkAv8MZ6wcJ5SQRpf9w0OeFH6Ln
34
- nNbCoHiYeXX/lz/M6AIbxDIZZTwxcyvF7bdrQ2fbH5MsfQ==
29
+ BgkqhkiG9w0BAQUFAAOCAQEAoiXGZB5aUV/31MOlrY6Jmfk/4+kIBcgrOCMCi3Nn
30
+ 58fZ/LJDmxs+C3zdW0wHxYf06r3ZcHTulhk1suztLCWyUxyOkGj4IW+LXPRGP66o
31
+ 6qcofBVFh7GXatsgbj87f7a8/opXaeQHqC2X18sCTwOCcO5PjtFrXK7A3v1u2yRj
32
+ rEe6qyTkY77mRgG3f/feAizAvYYkPxOngUwN8rpfKpU5iESS4UUaxIi3AGJHgTw2
33
+ etYUO0DlNY/qYfSfExrgt0W5dZeT09V++WPlYauHw/EZtAB0AsJwVdtIscq0HSvX
34
+ yH9AFp3KIe0v70EXzao/94n+XoDULrHEhqGMo34iS+37ZA==
35
35
  -----END CERTIFICATE-----
36
- date: 2016-08-23 00:00:00.000000000 Z
36
+ date: 2017-12-31 00:00:00.000000000 Z
37
37
  dependencies:
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: rspec-core
@@ -133,16 +133,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
133
133
  version: '0'
134
134
  required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ">="
136
+ - - ">"
137
137
  - !ruby/object:Gem::Version
138
- version: '0'
138
+ version: 1.3.1
139
139
  requirements: []
140
140
  rubyforge_project:
141
- rubygems_version: 2.5.1
141
+ rubygems_version: 2.6.14
142
142
  signing_key:
143
143
  specification_version: 4
144
144
  summary: the instafailing RSpec progress bar formatter
145
145
  test_files:
146
146
  - spec/fuubar/output_spec.rb
147
147
  - spec/fuubar_spec.rb
148
- has_rdoc:
metadata.gz.sig CHANGED
Binary file