vedeu 0.6.28 → 0.6.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/README.md +1 -0
- data/docs/dsl.md +4 -4
- data/docs/keymaps.md +25 -0
- data/lib/vedeu/all.rb +1 -1
- data/lib/vedeu/borders/border.rb +1 -1
- data/lib/vedeu/borders/refresh.rb +1 -1
- data/lib/vedeu/common.rb +1 -1
- data/lib/vedeu/dsl/all.rb +0 -2
- data/lib/vedeu/dsl/presentation.rb +1 -1
- data/lib/vedeu/dsl/shared.rb +1 -1
- data/lib/vedeu/dsl/text.rb +1 -1
- data/lib/vedeu/dsl/view.rb +11 -13
- data/lib/vedeu/editor/cropper.rb +1 -1
- data/lib/vedeu/editor/document.rb +6 -8
- data/lib/vedeu/geometry/geometry.rb +6 -0
- data/lib/vedeu/geometry/position.rb +2 -0
- data/lib/vedeu/groups/group.rb +1 -1
- data/lib/vedeu/input/all.rb +1 -0
- data/lib/vedeu/{dsl/keymap.rb → input/dsl.rb} +6 -6
- data/lib/vedeu/interfaces/all.rb +12 -0
- data/lib/vedeu/{dsl/interface.rb → interfaces/dsl.rb} +10 -10
- data/lib/vedeu/{models → interfaces}/interface.rb +6 -6
- data/lib/vedeu/{null/interface.rb → interfaces/null.rb} +6 -6
- data/lib/vedeu/{models/interfaces.rb → interfaces/repository.rb} +10 -10
- data/lib/vedeu/logging/log.rb +18 -12
- data/lib/vedeu/models/focus.rb +1 -1
- data/lib/vedeu/models/toggleable.rb +1 -1
- data/lib/vedeu/models/views/all.rb +0 -2
- data/lib/vedeu/models/views/composition.rb +12 -7
- data/lib/vedeu/models/views/line.rb +1 -0
- data/lib/vedeu/models/views/stream.rb +1 -0
- data/lib/vedeu/null/all.rb +0 -1
- data/lib/vedeu/output/clear/interface.rb +1 -1
- data/lib/vedeu/output/output.rb +28 -10
- data/lib/vedeu/output/refresh/refresh.rb +1 -1
- data/lib/vedeu/output/renderers/all.rb +11 -2
- data/lib/vedeu/output/text.rb +9 -2
- data/lib/vedeu/repositories/model.rb +9 -7
- data/lib/vedeu/repositories/repositories.rb +7 -7
- data/lib/vedeu/runtime/main_loop.rb +2 -0
- data/lib/vedeu/templating/view_template.rb +1 -1
- data/lib/vedeu/terminal/buffer.rb +2 -0
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/borders/refresh_test.rb +1 -1
- data/test/lib/vedeu/dsl/presentation_test.rb +2 -2
- data/test/lib/vedeu/dsl/text_test.rb +2 -1
- data/test/lib/vedeu/editor/cropper_test.rb +1 -1
- data/test/lib/vedeu/editor/document_test.rb +1 -1
- data/test/lib/vedeu/geometry/geometry_test.rb +3 -0
- data/test/lib/vedeu/groups/group_test.rb +3 -3
- data/test/lib/vedeu/{dsl/keymap_test.rb → input/dsl_test.rb} +5 -5
- data/test/lib/vedeu/{dsl/interface_test.rb → interfaces/dsl_test.rb} +7 -7
- data/test/lib/vedeu/{models → interfaces}/interface_test.rb +3 -3
- data/test/lib/vedeu/{null/interface_test.rb → interfaces/null_test.rb} +5 -5
- data/test/lib/vedeu/{models/interfaces_test.rb → interfaces/repository_test.rb} +5 -5
- data/test/lib/vedeu/logging/log_test.rb +2 -2
- data/test/lib/vedeu/models/views/view_test.rb +1 -1
- data/test/lib/vedeu/output/clear/interface_test.rb +1 -1
- data/test/lib/vedeu/output/output_test.rb +5 -10
- data/test/lib/vedeu/output/presentation/presentation_test.rb +1 -1
- data/test/lib/vedeu/output/refresh/refresh_test.rb +1 -1
- data/test/lib/vedeu/output/renderers/all_test.rb +2 -0
- data/test/lib/vedeu/output/viewport_test.rb +1 -1
- data/test/lib/vedeu/terminal/buffer_test.rb +1 -1
- data/test/test_helper.rb +1 -0
- metadata +19 -20
- data/lib/vedeu/output/direct.rb +0 -64
- data/test/lib/vedeu/output/direct_test.rb +0 -76
@@ -12,10 +12,6 @@ module Vedeu
|
|
12
12
|
collection Vedeu::Views::ViewCollection
|
13
13
|
member Vedeu::Views::View
|
14
14
|
|
15
|
-
# @!attribute [r] attributes
|
16
|
-
# @return [Hash]
|
17
|
-
attr_reader :attributes
|
18
|
-
|
19
15
|
# @!attribute [r] parent
|
20
16
|
# @return [NilClass] Composition objects do not have a parent.
|
21
17
|
attr_reader :parent
|
@@ -29,9 +25,7 @@ module Vedeu
|
|
29
25
|
# @option attributes value [Vedeu::Views::ViewCollection]
|
30
26
|
# @return [Vedeu::Views::Composition]
|
31
27
|
def initialize(attributes = {})
|
32
|
-
|
33
|
-
|
34
|
-
@attributes.each do |key, value|
|
28
|
+
defaults.merge!(attributes).each do |key, value|
|
35
29
|
instance_variable_set("@#{key}", value)
|
36
30
|
end
|
37
31
|
end
|
@@ -43,6 +37,17 @@ module Vedeu
|
|
43
37
|
end
|
44
38
|
alias_method :<<, :add
|
45
39
|
|
40
|
+
# @return [Hash]
|
41
|
+
def attributes
|
42
|
+
{
|
43
|
+
client: @client,
|
44
|
+
colour: @colour,
|
45
|
+
parent: @parent,
|
46
|
+
style: @style,
|
47
|
+
value: value,
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
46
51
|
# @return [Vedeu::Views::ViewCollection]
|
47
52
|
def value
|
48
53
|
collection.coerce(@value, self)
|
@@ -32,6 +32,7 @@ module Vedeu
|
|
32
32
|
# Returns a new instance of Vedeu::Views::Line.
|
33
33
|
#
|
34
34
|
# @param attributes [Hash]
|
35
|
+
# @option attributes client [void]
|
35
36
|
# @option attributes colour [Vedeu::Colours::Colour]
|
36
37
|
# @option attributes parent [Vedeu::Views::View]
|
37
38
|
# @option attributes style [Vedeu::Presentation::Style]
|
@@ -38,6 +38,7 @@ module Vedeu
|
|
38
38
|
# Returns a new instance of Vedeu::Views::Stream.
|
39
39
|
#
|
40
40
|
# @param attributes [Hash]
|
41
|
+
# @option attributes client [void]
|
41
42
|
# @option attributes colour [Vedeu::Colours::Colour]
|
42
43
|
# @option attributes style [Vedeu::Presentation::Style]
|
43
44
|
# @option attributes parent [Vedeu::Views::Line]
|
data/lib/vedeu/null/all.rb
CHANGED
data/lib/vedeu/output/output.rb
CHANGED
@@ -11,9 +11,11 @@ module Vedeu
|
|
11
11
|
|
12
12
|
# Writes output to the defined renderers.
|
13
13
|
#
|
14
|
-
# @return [Array|String]
|
14
|
+
# @return [Array|NilClass|String]
|
15
15
|
# @see #initialize
|
16
16
|
def self.render_output(output)
|
17
|
+
return nil if output.nil?
|
18
|
+
|
17
19
|
new(output).render_output
|
18
20
|
end
|
19
21
|
|
@@ -32,23 +34,39 @@ module Vedeu
|
|
32
34
|
# because escape sequences only make sense to the terminal and
|
33
35
|
# not other renderers.
|
34
36
|
#
|
35
|
-
# @return [Array|NilClass]
|
37
|
+
# @return [Array|String|NilClass]
|
36
38
|
def render_output
|
37
|
-
|
38
|
-
|
39
|
+
if escape_sequence?
|
40
|
+
direct_write!
|
39
41
|
|
40
|
-
|
41
|
-
|
42
|
-
|
42
|
+
else
|
43
|
+
buffer_write!
|
44
|
+
|
45
|
+
end
|
43
46
|
end
|
44
47
|
|
48
|
+
protected
|
49
|
+
|
45
50
|
# @!attribute [r] output
|
46
|
-
# @return [Array<Array<Vedeu::Views::Char
|
51
|
+
# @return [Array<Array<Vedeu::Views::Char>>|
|
52
|
+
# NilClass|Vedeu::Models::Escape]
|
47
53
|
attr_reader :output
|
48
54
|
|
55
|
+
private
|
56
|
+
|
49
57
|
# @return [Array]
|
50
|
-
def
|
51
|
-
Vedeu::Terminal::Buffer.write(output)
|
58
|
+
def buffer_write!
|
59
|
+
Vedeu::Terminal::Buffer.write(output)
|
60
|
+
end
|
61
|
+
|
62
|
+
# @return [Array<String>]
|
63
|
+
def direct_write!
|
64
|
+
Vedeu::Terminal.output(output.to_s)
|
65
|
+
end
|
66
|
+
|
67
|
+
# @return [Boolean]
|
68
|
+
def escape_sequence?
|
69
|
+
output.is_a?(Vedeu::Models::Escape)
|
52
70
|
end
|
53
71
|
|
54
72
|
end # Output
|
@@ -17,7 +17,7 @@ module Vedeu
|
|
17
17
|
|
18
18
|
# Refresh all registered interfaces.
|
19
19
|
#
|
20
|
-
# @return [Array<Vedeu::
|
20
|
+
# @return [Array<Vedeu::Interfaces::Interface>]
|
21
21
|
def all
|
22
22
|
Vedeu.timer('Refreshing all'.freeze) do
|
23
23
|
Vedeu.interfaces.zindexed.each do |interface|
|
@@ -20,7 +20,7 @@ module Vedeu
|
|
20
20
|
threads = storage.map do |renderer|
|
21
21
|
Thread.new(renderer) do
|
22
22
|
mutex.synchronize do
|
23
|
-
renderer.clear
|
23
|
+
toggle_cursor { renderer.clear }
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -51,7 +51,7 @@ module Vedeu
|
|
51
51
|
threads = storage.map do |renderer|
|
52
52
|
Thread.new(renderer) do
|
53
53
|
mutex.synchronize do
|
54
|
-
renderer.render(output)
|
54
|
+
toggle_cursor { renderer.render(output) }
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
@@ -101,6 +101,15 @@ module Vedeu
|
|
101
101
|
@storage ||= in_memory
|
102
102
|
end
|
103
103
|
|
104
|
+
# @return [void]
|
105
|
+
def toggle_cursor
|
106
|
+
Vedeu.hide_cursor(Vedeu.focus)
|
107
|
+
|
108
|
+
yield
|
109
|
+
|
110
|
+
Vedeu.show_cursor(Vedeu.focus)
|
111
|
+
end
|
112
|
+
|
104
113
|
end # Renderers
|
105
114
|
|
106
115
|
# @example
|
data/lib/vedeu/output/text.rb
CHANGED
@@ -83,6 +83,11 @@ module Vedeu
|
|
83
83
|
string.center(width, pad)
|
84
84
|
end
|
85
85
|
|
86
|
+
# @return [Object]
|
87
|
+
def client
|
88
|
+
options[:client]
|
89
|
+
end
|
90
|
+
|
86
91
|
# If a colour, background or foreground option is set, use them
|
87
92
|
# as the colour settings for the new Vedeu::Views::Stream.
|
88
93
|
#
|
@@ -114,6 +119,7 @@ module Vedeu
|
|
114
119
|
# @return [Hash<Symbol => NilClass, String, Symbol>]
|
115
120
|
def defaults
|
116
121
|
{
|
122
|
+
client: nil,
|
117
123
|
anchor: :left,
|
118
124
|
colour: nil,
|
119
125
|
model: nil,
|
@@ -131,7 +137,7 @@ module Vedeu
|
|
131
137
|
|
132
138
|
# @return [Vedeu::Views::Line]
|
133
139
|
def line
|
134
|
-
@line ||= Vedeu::Views::Line.build(parent: parent)
|
140
|
+
@line ||= Vedeu::Views::Line.build(parent: parent, client: client)
|
135
141
|
end
|
136
142
|
|
137
143
|
# Returns the model option when set.
|
@@ -169,7 +175,8 @@ module Vedeu
|
|
169
175
|
#
|
170
176
|
# @return [void]
|
171
177
|
def stream
|
172
|
-
@stream ||= Vedeu::Views::Stream.build(
|
178
|
+
@stream ||= Vedeu::Views::Stream.build(client: client,
|
179
|
+
colour: colour,
|
173
180
|
parent: parent,
|
174
181
|
style: style,
|
175
182
|
value: aligned)
|
@@ -79,8 +79,8 @@ module Vedeu
|
|
79
79
|
# @return [Hash<Symbol => NilClass, String>]
|
80
80
|
def defaults
|
81
81
|
{
|
82
|
-
client:
|
83
|
-
name:
|
82
|
+
client: nil,
|
83
|
+
name: '',
|
84
84
|
}
|
85
85
|
end
|
86
86
|
|
@@ -126,11 +126,13 @@ module Vedeu
|
|
126
126
|
# @return [String]
|
127
127
|
def dsl_class
|
128
128
|
case demodulize(self.class.name)
|
129
|
-
when 'Border'.freeze
|
130
|
-
when 'Buffer'.freeze
|
131
|
-
when 'Geometry'.freeze
|
132
|
-
when 'Group'.freeze
|
133
|
-
when '
|
129
|
+
when 'Border'.freeze then 'Vedeu::Borders::DSL'.freeze
|
130
|
+
when 'Buffer'.freeze then 'Vedeu::Buffers::DSL'.freeze
|
131
|
+
when 'Geometry'.freeze then 'Vedeu::Geometry::DSL'.freeze
|
132
|
+
when 'Group'.freeze then 'Vedeu::Groups::DSL'.freeze
|
133
|
+
when 'Interface'.freeze then 'Vedeu::Interfaces::DSL'.freeze
|
134
|
+
when 'Keymap'.freeze then 'Vedeu::Keymaps::DSL'.freeze
|
135
|
+
when 'Menu'.freeze then 'Vedeu::Menus::DSL'.freeze
|
134
136
|
# when 'ModelTestClass' then 'Vedeu::Repositories::ModelTestClass::DSL'
|
135
137
|
else
|
136
138
|
'Vedeu::DSL::'.freeze + demodulize(self.class.name)
|
@@ -6,6 +6,13 @@ module Vedeu
|
|
6
6
|
|
7
7
|
extend self
|
8
8
|
|
9
|
+
# Access all the repositories stored.
|
10
|
+
#
|
11
|
+
# @return [Array]
|
12
|
+
def all
|
13
|
+
storage.map(&:repository)
|
14
|
+
end
|
15
|
+
|
9
16
|
# Register a repository with the collection of Vedeu repositories.
|
10
17
|
#
|
11
18
|
# @param klass [Class]
|
@@ -40,13 +47,6 @@ module Vedeu
|
|
40
47
|
|
41
48
|
private
|
42
49
|
|
43
|
-
# Access all the repositories stored.
|
44
|
-
#
|
45
|
-
# @return [Array]
|
46
|
-
def all
|
47
|
-
storage.map(&:repository)
|
48
|
-
end
|
49
|
-
|
50
50
|
# Access to the storage for this repository.
|
51
51
|
#
|
52
52
|
# @return [Array]
|
@@ -70,6 +70,7 @@ module Vedeu
|
|
70
70
|
def render
|
71
71
|
Vedeu.renderers.render(output) if Vedeu.ready?
|
72
72
|
end
|
73
|
+
alias_method :refresh, :render
|
73
74
|
|
74
75
|
# Removes all content from the virtual terminal; effectively
|
75
76
|
# clearing it.
|
@@ -142,5 +143,6 @@ module Vedeu
|
|
142
143
|
# @!method clear
|
143
144
|
# @see Vedeu::Terminal::Buffer#clear
|
144
145
|
def_delegators Vedeu::Terminal::Buffer, :clear
|
146
|
+
def_delegators Vedeu::Terminal::Buffer, :refresh
|
145
147
|
|
146
148
|
end # Vedeu
|
data/lib/vedeu/version.rb
CHANGED
@@ -42,7 +42,7 @@ module Vedeu
|
|
42
42
|
Vedeu::Geometry::Geometry.new(name: _name, x: 1, xn: 7, y: 1, yn: 4)
|
43
43
|
}
|
44
44
|
let(:interface) {
|
45
|
-
Vedeu::
|
45
|
+
Vedeu::Interfaces::Interface.new(name: _name, visible: true)
|
46
46
|
}
|
47
47
|
before do
|
48
48
|
Vedeu.borders.stubs(:by_name).returns(border)
|
@@ -7,8 +7,8 @@ module Vedeu
|
|
7
7
|
describe Presentation do
|
8
8
|
|
9
9
|
let(:described) { Vedeu::DSL::Presentation }
|
10
|
-
let(:instance) { Vedeu::DSL
|
11
|
-
let(:model) { Vedeu::
|
10
|
+
let(:instance) { Vedeu::Interfaces::DSL.new(model) }
|
11
|
+
let(:model) { Vedeu::Interfaces::Interface.new }
|
12
12
|
let(:background) { '#00ff00' }
|
13
13
|
let(:foreground) { '#ff00ff' }
|
14
14
|
|
@@ -13,6 +13,7 @@ module Vedeu
|
|
13
13
|
{
|
14
14
|
anchor: anchor,
|
15
15
|
model: model,
|
16
|
+
client: nil,
|
16
17
|
}
|
17
18
|
}
|
18
19
|
let(:anchor) { :text }
|
@@ -30,7 +31,7 @@ module Vedeu
|
|
30
31
|
|
31
32
|
context 'when the model is a Vedeu::Views::View' do
|
32
33
|
let(:model) { Vedeu::Views::View.new }
|
33
|
-
let(:instance) { Vedeu::DSL
|
34
|
+
let(:instance) { Vedeu::Interfaces::DSL.new(model) }
|
34
35
|
|
35
36
|
it { subject.must_be_instance_of(Vedeu::Views::Lines) }
|
36
37
|
|
@@ -11,6 +11,7 @@ module Vedeu
|
|
11
11
|
let(:attributes) {
|
12
12
|
{
|
13
13
|
centred: centred,
|
14
|
+
client: client,
|
14
15
|
height: height,
|
15
16
|
maximised: maximised,
|
16
17
|
name: _name,
|
@@ -23,6 +24,7 @@ module Vedeu
|
|
23
24
|
}
|
24
25
|
}
|
25
26
|
let(:centred) { false }
|
27
|
+
let(:client) {}
|
26
28
|
let(:height) {}
|
27
29
|
let(:maximised) { false }
|
28
30
|
let(:_name) { 'vedeu_geometry_geometry' }
|
@@ -40,6 +42,7 @@ module Vedeu
|
|
40
42
|
instance.instance_variable_get('@attributes').must_equal(attributes)
|
41
43
|
}
|
42
44
|
it { instance.instance_variable_get('@centred').must_equal(centred) }
|
45
|
+
it { instance.instance_variable_get('@client').must_equal(client) }
|
43
46
|
it { instance.instance_variable_get('@height').must_equal(height) }
|
44
47
|
it { instance.instance_variable_get('@maximised').must_equal(maximised) }
|
45
48
|
it { instance.instance_variable_get('@name').must_equal(_name) }
|
@@ -72,9 +72,9 @@ module Vedeu
|
|
72
72
|
describe '#by_zindex' do
|
73
73
|
let(:interfaces) {
|
74
74
|
[
|
75
|
-
Vedeu::
|
76
|
-
Vedeu::
|
77
|
-
Vedeu::
|
75
|
+
Vedeu::Interfaces::Interface.new(zindex: 3, name: 'c'),
|
76
|
+
Vedeu::Interfaces::Interface.new(zindex: 1, name: 'a'),
|
77
|
+
Vedeu::Interfaces::Interface.new(zindex: 2, name: 'b'),
|
78
78
|
]
|
79
79
|
}
|
80
80
|
|
@@ -2,11 +2,11 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
|
5
|
-
module
|
5
|
+
module Keymaps
|
6
6
|
|
7
|
-
describe
|
7
|
+
describe DSL do
|
8
8
|
|
9
|
-
let(:described) { Vedeu::DSL
|
9
|
+
let(:described) { Vedeu::Keymaps::DSL }
|
10
10
|
let(:instance) { described.new(model) }
|
11
11
|
let(:model) { Vedeu::Input::Keymap.new(name: '_test_') }
|
12
12
|
|
@@ -64,8 +64,8 @@ module Vedeu
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
end #
|
67
|
+
end # DSL
|
68
68
|
|
69
|
-
end #
|
69
|
+
end # Keymaps
|
70
70
|
|
71
71
|
end # Vedeu
|
@@ -2,14 +2,14 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
|
5
|
-
module
|
5
|
+
module Interfaces
|
6
6
|
|
7
|
-
describe
|
7
|
+
describe DSL do
|
8
8
|
|
9
|
-
let(:described) { Vedeu::DSL
|
9
|
+
let(:described) { Vedeu::Interfaces::DSL }
|
10
10
|
let(:instance) { described.new(model, client) }
|
11
11
|
let(:model) {
|
12
|
-
Vedeu::
|
12
|
+
Vedeu::Interfaces::Interface.new(name: _name)
|
13
13
|
}
|
14
14
|
let(:_name) { 'actinium' }
|
15
15
|
let(:client) {}
|
@@ -23,7 +23,7 @@ module Vedeu
|
|
23
23
|
end
|
24
24
|
}
|
25
25
|
|
26
|
-
it { subject.must_be_instance_of(Vedeu::
|
26
|
+
it { subject.must_be_instance_of(Vedeu::Interfaces::Interface) }
|
27
27
|
|
28
28
|
context 'when the block is not given' do
|
29
29
|
subject { described.interface('fluorine') }
|
@@ -322,8 +322,8 @@ module Vedeu
|
|
322
322
|
it { instance.must_respond_to(:z) }
|
323
323
|
end
|
324
324
|
|
325
|
-
end #
|
325
|
+
end # DSL
|
326
326
|
|
327
|
-
end #
|
327
|
+
end # Interfaces
|
328
328
|
|
329
329
|
end # Vedeu
|
@@ -2,11 +2,11 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
|
5
|
-
module
|
5
|
+
module Interfaces
|
6
6
|
|
7
7
|
describe Interface do
|
8
8
|
|
9
|
-
let(:described) { Vedeu::
|
9
|
+
let(:described) { Vedeu::Interfaces::Interface }
|
10
10
|
let(:instance) { described.new(attributes) }
|
11
11
|
let(:attributes) {
|
12
12
|
{
|
@@ -93,6 +93,6 @@ module Vedeu
|
|
93
93
|
|
94
94
|
end # Interface
|
95
95
|
|
96
|
-
end #
|
96
|
+
end # Interfaces
|
97
97
|
|
98
98
|
end # Vedeu
|
@@ -2,11 +2,11 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
|
5
|
-
module
|
5
|
+
module Interfaces
|
6
6
|
|
7
|
-
describe
|
7
|
+
describe Null do
|
8
8
|
|
9
|
-
let(:described) { Vedeu::Null
|
9
|
+
let(:described) { Vedeu::Interfaces::Null }
|
10
10
|
let(:instance) { described.new(attributes) }
|
11
11
|
let(:_name) { 'null_interface' }
|
12
12
|
let(:attributes) {
|
@@ -23,8 +23,8 @@ module Vedeu
|
|
23
23
|
it { instance.instance_variable_get('@name').must_equal(_name) }
|
24
24
|
end
|
25
25
|
|
26
|
-
end #
|
26
|
+
end # Null
|
27
27
|
|
28
|
-
end #
|
28
|
+
end # Interfaces
|
29
29
|
|
30
30
|
end # Vedeu
|
@@ -2,11 +2,11 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
|
5
|
-
module
|
5
|
+
module Interfaces
|
6
6
|
|
7
|
-
describe
|
7
|
+
describe Repository do
|
8
8
|
|
9
|
-
let(:described) { Vedeu::
|
9
|
+
let(:described) { Vedeu::Interfaces::Repository }
|
10
10
|
|
11
11
|
it { described.must_respond_to(:interfaces) }
|
12
12
|
|
@@ -31,8 +31,8 @@ module Vedeu
|
|
31
31
|
it { subject.must_equal([@lithium, @hydrogen, @helium]) }
|
32
32
|
end
|
33
33
|
|
34
|
-
end #
|
34
|
+
end # Repository
|
35
35
|
|
36
|
-
end #
|
36
|
+
end # Interfaces
|
37
37
|
|
38
38
|
end # Vedeu
|
@@ -27,7 +27,7 @@ module Vedeu
|
|
27
27
|
|
28
28
|
it {
|
29
29
|
capture_io { subject }.must_equal(
|
30
|
-
["\e[
|
30
|
+
["\e[96m[create] \e[39m\e[36mLogging to stdout...\e[39m\n", ""]
|
31
31
|
)
|
32
32
|
}
|
33
33
|
end
|
@@ -40,7 +40,7 @@ module Vedeu
|
|
40
40
|
|
41
41
|
it {
|
42
42
|
capture_io { subject }.must_equal(
|
43
|
-
["", "\e[
|
43
|
+
["", "\e[97m[debug] \e[39m\e[39mLogging to stderr...\e[39m\n"]
|
44
44
|
)
|
45
45
|
}
|
46
46
|
end
|
@@ -88,7 +88,7 @@ module Vedeu
|
|
88
88
|
subject { instance.visible? }
|
89
89
|
|
90
90
|
context 'when the interface is visible' do
|
91
|
-
let(:interface) { Vedeu::
|
91
|
+
let(:interface) { Vedeu::Interfaces::Interface.new(visible: true) }
|
92
92
|
|
93
93
|
before do
|
94
94
|
Vedeu.interfaces.stubs(:by_name).with(_name).returns(interface)
|
@@ -29,22 +29,17 @@ module Vedeu
|
|
29
29
|
Vedeu::Models::Escape.new(value: "\e[?25h", position: [1, 1])
|
30
30
|
}
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
it {
|
33
|
+
Vedeu::Terminal.expects(:output)
|
34
|
+
subject
|
35
|
+
}
|
35
36
|
end
|
36
37
|
|
37
38
|
context 'and the output is not an escape sequence' do
|
38
39
|
let(:output) { Vedeu::Models::Page.new }
|
39
|
-
let(:buffer) { mock('Vedeu::Terminal::Buffer') }
|
40
|
-
|
41
|
-
before do
|
42
|
-
Vedeu::Terminal::Buffer.stubs(:write)
|
43
|
-
buffer.expects(:render).returns(output)
|
44
|
-
end
|
45
40
|
|
46
41
|
it {
|
47
|
-
Vedeu::Terminal::Buffer.expects(:write).with(output)
|
42
|
+
Vedeu::Terminal::Buffer.expects(:write).with(output)
|
48
43
|
subject
|
49
44
|
}
|
50
45
|
end
|
@@ -24,7 +24,7 @@ module Vedeu
|
|
24
24
|
|
25
25
|
context 'when there are registered interfaces' do
|
26
26
|
let(:interface) {
|
27
|
-
Vedeu::
|
27
|
+
Vedeu::Interfaces::Interface.new(name: 'Vedeu::Output::Refresh')
|
28
28
|
}
|
29
29
|
let(:interfaces) { [interface] }
|
30
30
|
|