vedeu 0.6.11 → 0.6.12

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: fd5d4c600e6a615165182a1f701d54b8f073b33a
4
- data.tar.gz: 30af16d08fc9b2d86a2a4aa998b205cb15f32bd1
3
+ metadata.gz: 3baa951de557aa4e39a7c9414fae7caea7c9efef
4
+ data.tar.gz: 58355bdd2dabc9b59d5c52fc99306a81afcc934b
5
5
  SHA512:
6
- metadata.gz: f3b9d230aa8dea217cb114e762be87c5cac80008dc7530522efe51c419358415e5e839139005d8bb2bd898531c1688a03f1e0a8762294e12fd56ae4232349151
7
- data.tar.gz: f5f59df013fe45ee4d7aa4241768cea05acd733b45e2a999a235a8916f95beae94bd8137fdd70fbe297a4eae931d01fa14b9510bcf4cfb3622a07f69f2d3ea78
6
+ metadata.gz: b9f5da3a38e66ce269b8233084bfbec48fb67c2cd32abe33e71e12b03d2f77d85f816188b050b7f8d1ec92c8fdc14dcb00e5019efd8095c645de54cc39418e9c
7
+ data.tar.gz: 2c44e1296ac86195023e72bc5f40cc6428de275c9115b2322f3c756f25145bb5a7c3e3efd6a3eb33c059c66d3bde4b0dca1491f8ac5d8f36df1b5276dca0186a
@@ -42,7 +42,6 @@ module Vedeu
42
42
  Vedeu::Clear::NamedInterface.render(name)
43
43
 
44
44
  else
45
- Vedeu::Terminal.clear
46
45
  Vedeu::Terminal::Buffer.clear
47
46
 
48
47
  end
@@ -68,10 +67,7 @@ module Vedeu
68
67
 
69
68
  # See {file:docs/events/system.md#\_initialize_}
70
69
  def initialize!
71
- Vedeu.bind(:_initialize_) do
72
- Vedeu.ready!
73
- Vedeu.trigger(:_refresh_)
74
- end
70
+ Vedeu.bind(:_initialize_) { Vedeu.ready! }
75
71
  end
76
72
 
77
73
  # See {file:docs/events/system.md#\_keypress_}
@@ -30,7 +30,7 @@ module Vedeu
30
30
  def by_name
31
31
  Vedeu.timer("Refresh Buffer: '#{buffer_name}'") do
32
32
  Vedeu.buffers.by_name(buffer_name).render
33
- end
33
+ end if Vedeu.ready?
34
34
  end
35
35
 
36
36
  protected
@@ -7,6 +7,19 @@ module Vedeu
7
7
  extend Enumerable
8
8
  extend self
9
9
 
10
+ def clear
11
+ threads = storage.map do |renderer|
12
+ Thread.new(renderer) do
13
+ mutex.synchronize do
14
+ renderer.clear
15
+ end
16
+ end
17
+ end
18
+ threads.each(&:join)
19
+
20
+ ''
21
+ end
22
+
10
23
  # Provides access to the list of renderers.
11
24
  #
12
25
  # @example
@@ -16,6 +16,13 @@ module Vedeu
16
16
  @options = options || {}
17
17
  end
18
18
 
19
+ # Render a cleared output.
20
+ #
21
+ # @return [String]
22
+ def clear
23
+ ''
24
+ end
25
+
19
26
  # Render the output with the escape sequences escaped.
20
27
  #
21
28
  # @param output [Vedeu::Models::Page]
@@ -22,6 +22,15 @@ module Vedeu
22
22
  @options = options || {}
23
23
  end
24
24
 
25
+ # Render a cleared output.
26
+ #
27
+ # @return [String]
28
+ def clear
29
+ ::File.write(filename, '') if write_file?
30
+
31
+ ''
32
+ end
33
+
25
34
  # @param output [Vedeu::Models::Page]
26
35
  # @return [String]
27
36
  def render(output)
@@ -30,6 +30,15 @@ module Vedeu
30
30
  @output = nil
31
31
  end
32
32
 
33
+ # Render a cleared output.
34
+ #
35
+ # @return [String]
36
+ def clear
37
+ @output = Vedeu::Models::Escape.new
38
+
39
+ ''
40
+ end
41
+
33
42
  # @param output [Vedeu::Models::Page]
34
43
  # @return [String]
35
44
  def render(output)
@@ -14,6 +14,17 @@ module Vedeu
14
14
  @options = options || {}
15
15
  end
16
16
 
17
+ # Render a cleared output.
18
+ #
19
+ # @return [String]
20
+ def clear
21
+ json = parse({})
22
+
23
+ super(json)
24
+
25
+ json
26
+ end
27
+
17
28
  # @param output [Vedeu::Models::Page]
18
29
  # @return [String]
19
30
  def render(output)
@@ -16,6 +16,13 @@ module Vedeu
16
16
  @options = options || {}
17
17
  end
18
18
 
19
+ # Render a cleared output.
20
+ #
21
+ # @return [String]
22
+ def clear
23
+ ''
24
+ end
25
+
19
26
  # @param output [Vedeu::Models::Page]
20
27
  # @return [String]
21
28
  def render(output)
@@ -17,6 +17,13 @@ module Vedeu
17
17
  @options = options || {}
18
18
  end
19
19
 
20
+ # Render a cleared output.
21
+ #
22
+ # @return [String]
23
+ def clear
24
+ Vedeu::Terminal.clear
25
+ end
26
+
20
27
  # @param output [Vedeu::Models::Page]
21
28
  # @return [Array<String>]
22
29
  def render(output)
@@ -17,6 +17,13 @@ module Vedeu
17
17
  @options = options || {}
18
18
  end
19
19
 
20
+ # Render a cleared output.
21
+ #
22
+ # @return [String]
23
+ def clear
24
+ ''
25
+ end
26
+
20
27
  # @param output [Vedeu::Models::Page]
21
28
  # @return [String]
22
29
  def render(output)
@@ -24,6 +24,15 @@ module Vedeu
24
24
  end
25
25
  alias_method :cells, :buffer
26
26
 
27
+ # Clear the output.
28
+ #
29
+ # @return [String|void] Most likely to be a String.
30
+ def clear
31
+ reset
32
+
33
+ Vedeu.renderers.clear if Vedeu.ready?
34
+ end
35
+
27
36
  # @return [Array<Array<Vedeu::Models::Cell>>]
28
37
  def empty_buffer
29
38
  Array.new(Vedeu.height) do |y|
@@ -69,9 +78,8 @@ module Vedeu
69
78
  #
70
79
  # @return [Array<Array<Vedeu::Models::Cell>>]
71
80
  def reset
72
- @output = empty_buffer
81
+ @output = empty_buffer if Vedeu.ready?
73
82
  end
74
- alias_method :clear, :reset
75
83
 
76
84
  # Write a collection of cells to the virtual terminal.
77
85
  #
@@ -1,6 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # The current version of Vedeu.
4
- VERSION = '0.6.11'
4
+ VERSION = '0.6.12'
5
5
 
6
6
  end
@@ -9,6 +9,11 @@ module Vedeu
9
9
  let(:described) { Vedeu::Buffers::Refresh }
10
10
  let(:instance) { described.new(_name) }
11
11
  let(:_name) { 'Vedeu::Buffers::Refresh' }
12
+ let(:ready) { true }
13
+
14
+ before do
15
+ Vedeu.stubs(:ready?).returns(ready)
16
+ end
12
17
 
13
18
  describe '#initialize' do
14
19
  it { instance.must_be_instance_of(described) }
@@ -18,28 +23,23 @@ module Vedeu
18
23
  describe '.by_name' do
19
24
  subject { described.by_name(_name) }
20
25
 
21
- context 'when the name is not present' do
22
- let(:_name) { '' }
26
+ context 'when Vedeu is not yet ready' do
27
+ let(:ready) { false }
23
28
 
24
- it { proc { subject }.must_raise(Vedeu::Error::MissingRequired) }
29
+ it { subject.must_equal(nil) }
25
30
  end
26
31
 
27
- # describe '.by_name' do
28
- # let(:_name) { 'aluminium' }
29
- # let(:buffer) { Vedeu::Buffers::Null.new(name: _name) }
30
- #
31
- # subject { described.by_name(_name) }
32
- #
33
- # it {
34
- # Vedeu.buffers.expects(:by_name).with(_name).returns(buffer)
35
- # buffer.expects(:render)
36
- # subject
37
- # }
38
- # end
39
-
40
- context 'when the name is present' do
41
- # @todo Add more tests.
42
- # it { skip }
32
+ context 'when Vedeu is ready' do
33
+ context 'when the name is not present' do
34
+ let(:_name) { '' }
35
+
36
+ it { proc { subject }.must_raise(Vedeu::Error::MissingRequired) }
37
+ end
38
+
39
+ context 'when the name is present' do
40
+ # @todo Add more tests.
41
+ # it { skip }
42
+ end
43
43
  end
44
44
  end
45
45
 
@@ -24,7 +24,7 @@ class VedeuMaterialColoursApp
24
24
  # Be aware that running an application with debugging enabled will affect
25
25
  # performance.
26
26
  Vedeu.configure do
27
- debug!
27
+ # debug!
28
28
  log '/tmp/vedeu_material_colours_app.log'
29
29
  end
30
30
 
@@ -92,13 +92,13 @@ require 'support/helpers/model_test_class'
92
92
  # require 'minitest/reporters'
93
93
  # require 'support/average_duration_reporter'
94
94
  # Minitest::Reporters.use!(
95
- # commented out by default (makes tests slower)
96
- # Minitest::Reporters::MeanTimeReporter.new({
97
- # previous_runs_filename: "/tmp/reports/durations",
98
- # report_filename: "/tmp/reports/durations_results"})
99
- # Minitest::Reporters::DefaultReporter.new({ color: true,
100
- # slow_suite_count: 15 }),
101
- # Minitest::Reporters::SpecReporter.new
95
+ # # # commented out by default (makes tests slower)
96
+ # # Minitest::Reporters::MeanTimeReporter.new({
97
+ # # previous_runs_filename: "/tmp/reports/durations",
98
+ # # report_filename: "/tmp/reports/durations_results"})
99
+ # # Minitest::Reporters::DefaultReporter.new({ color: true,
100
+ # # slow_suite_count: 15 }),
101
+ # # Minitest::Reporters::SpecReporter.new
102
102
  # )
103
103
 
104
104
  def test_configuration
@@ -24,10 +24,10 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency 'guard-minitest', '2.4.4'
25
25
  spec.add_development_dependency 'guard-rubocop', '1.2.0'
26
26
  spec.add_development_dependency 'minitest', '5.8.0'
27
- # spec.add_development_dependency 'minitest-reporters', '1.1.0'
27
+ spec.add_development_dependency 'minitest-reporters', '1.1.1'
28
28
  spec.add_development_dependency 'mocha', '1.1.0'
29
29
  spec.add_development_dependency 'pry', '0.10.1'
30
- spec.add_development_dependency 'rubocop', '0.34.1'
30
+ spec.add_development_dependency 'rubocop', '0.34.2'
31
31
 
32
32
  spec.add_development_dependency 'ruby-prof', '0.15.8'
33
33
  spec.add_development_dependency 'simplecov', '0.10.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vedeu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.11
4
+ version: 0.6.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Laking
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-21 00:00:00.000000000 Z
11
+ date: 2015-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
68
  version: 5.8.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest-reporters
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '='
74
+ - !ruby/object:Gem::Version
75
+ version: 1.1.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 1.1.1
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: mocha
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +114,14 @@ dependencies:
100
114
  requirements:
101
115
  - - '='
102
116
  - !ruby/object:Gem::Version
103
- version: 0.34.1
117
+ version: 0.34.2
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
122
  - - '='
109
123
  - !ruby/object:Gem::Version
110
- version: 0.34.1
124
+ version: 0.34.2
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: ruby-prof
113
127
  requirement: !ruby/object:Gem::Requirement