vedeu 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vedeu/all.rb +1 -1
- data/lib/vedeu/application/controller.rb +2 -2
- data/lib/vedeu/bindings.rb +1 -1
- data/lib/vedeu/bindings/application.rb +2 -2
- data/lib/vedeu/bindings/drb.rb +8 -8
- data/lib/vedeu/bindings/menus.rb +11 -11
- data/lib/vedeu/bindings/movement.rb +12 -12
- data/lib/vedeu/bindings/system.rb +18 -18
- data/lib/vedeu/bindings/visibility.rb +9 -9
- data/lib/vedeu/colours/colour.rb +1 -1
- data/lib/vedeu/common.rb +1 -1
- data/lib/vedeu/dsl/composition.rb +8 -3
- data/lib/vedeu/dsl/interface.rb +41 -17
- data/lib/vedeu/log/debug.rb +5 -1
- data/lib/vedeu/log/log.rb +1 -0
- data/lib/vedeu/models/interface.rb +3 -2
- data/lib/vedeu/plugins.rb +1 -1
- data/lib/vedeu/runtime/bootstrap.rb +0 -3
- data/lib/vedeu/runtime/launcher.rb +3 -2
- data/lib/vedeu/runtime/router.rb +49 -47
- data/lib/vedeu/{traps.rb → runtime/traps.rb} +0 -0
- data/lib/vedeu/templating/decoder.rb +4 -2
- data/lib/vedeu/templating/encoder.rb +4 -2
- data/lib/vedeu/templating/view_template.rb +35 -2
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/application/application_view_test.rb +1 -1
- data/test/lib/vedeu/application/controller_test.rb +4 -0
- data/test/lib/vedeu/bindings_test.rb +2 -0
- data/test/lib/vedeu/borders/border_test.rb +28 -40
- data/test/lib/vedeu/borders/borders_test.rb +0 -2
- data/test/lib/vedeu/borders/render_border_test.rb +11 -13
- data/test/lib/vedeu/buffers/buffer_test.rb +12 -5
- data/test/lib/vedeu/buffers/display_buffer_test.rb +2 -2
- data/test/lib/vedeu/cli/generator/application_test.rb +9 -9
- data/test/lib/vedeu/cli/generator/view_test.rb +10 -7
- data/test/lib/vedeu/cli/main_test.rb +4 -4
- data/test/lib/vedeu/colours/colour_translator_test.rb +2 -4
- data/test/lib/vedeu/common_test.rb +8 -0
- data/test/lib/vedeu/configuration/configuration_test.rb +4 -4
- data/test/lib/vedeu/cursor/cursors_test.rb +4 -4
- data/test/lib/vedeu/cursor/move_test.rb +11 -8
- data/test/lib/vedeu/cursor/refresh_cursor_test.rb +12 -12
- data/test/lib/vedeu/cursor/reposition_test.rb +7 -11
- data/test/lib/vedeu/distributed/client_test.rb +4 -4
- data/test/lib/vedeu/distributed/server_test.rb +4 -5
- data/test/lib/vedeu/dsl/border_test.rb +2 -2
- data/test/lib/vedeu/dsl/composition_test.rb +5 -4
- data/test/lib/vedeu/dsl/geometry_test.rb +6 -4
- data/test/lib/vedeu/dsl/interface_test.rb +9 -27
- data/test/lib/vedeu/dsl/use_test.rb +2 -2
- data/test/lib/vedeu/events/trigger_test.rb +2 -2
- data/test/lib/vedeu/geometry/coordinate_test.rb +9 -9
- data/test/lib/vedeu/geometry/geometry_test.rb +8 -2
- data/test/lib/vedeu/geometry/position_validator_test.rb +11 -14
- data/test/lib/vedeu/input/input_test.rb +5 -5
- data/test/lib/vedeu/input/keymap_test.rb +2 -2
- data/test/lib/vedeu/log/timer_test.rb +2 -2
- data/test/lib/vedeu/models/focus_test.rb +20 -25
- data/test/lib/vedeu/models/interface_test.rb +2 -2
- data/test/lib/vedeu/models/interfaces_test.rb +7 -5
- data/test/lib/vedeu/models/line_test.rb +0 -5
- data/test/lib/vedeu/models/menu_test.rb +0 -2
- data/test/lib/vedeu/null/geometry_test.rb +1 -4
- data/test/lib/vedeu/output/clear/named_interface_test.rb +2 -2
- data/test/lib/vedeu/output/esc_test.rb +7 -4
- data/test/lib/vedeu/output/output_test.rb +3 -6
- data/test/lib/vedeu/output/refresh_test.rb +2 -2
- data/test/lib/vedeu/output/renderers/file_test.rb +1 -3
- data/test/lib/vedeu/output/renderers/html_test.rb +1 -3
- data/test/lib/vedeu/output/renderers/json_test.rb +1 -3
- data/test/lib/vedeu/output/renderers_test.rb +2 -2
- data/test/lib/vedeu/output/viewport_test.rb +70 -71
- data/test/lib/vedeu/repositories/model_test.rb +0 -19
- data/test/lib/vedeu/repositories/repository_test.rb +8 -8
- data/test/lib/vedeu/runtime/application_test.rb +2 -2
- data/test/lib/vedeu/runtime/launcher_test.rb +7 -7
- data/test/lib/vedeu/runtime/router_test.rb +33 -33
- data/test/lib/vedeu/{traps_test.rb → runtime/traps_test.rb} +2 -2
- data/test/lib/vedeu/templating/decoder_test.rb +1 -0
- data/test/lib/vedeu/templating/encoder_test.rb +1 -0
- data/test/lib/vedeu/templating/template_test.rb +8 -1
- data/test/lib/vedeu/templating/view_template_test.rb +108 -22
- data/test/lib/vedeu/terminal_mode_test.rb +2 -2
- data/test/lib/vedeu/terminal_test.rb +6 -6
- data/test/support/helpers/model_test_class.rb +19 -0
- metadata +5 -17
- data/test/support/templates/background.erb +0 -1
- data/test/support/templates/colour.erb +0 -1
- data/test/support/templates/foreground.erb +0 -1
- data/test/support/templates/multiple.erb +0 -2
- data/test/support/templates/plain.erb +0 -1
- data/test/support/templates/style.erb +0 -1
@@ -15,7 +15,7 @@ module Vedeu
|
|
15
15
|
let(:described) { Vedeu::DSL::Use }
|
16
16
|
let(:model_instance) { Vedeu::DSL::TestUseClass }
|
17
17
|
|
18
|
-
# before
|
18
|
+
# before {
|
19
19
|
# Vedeu.interfaces.reset
|
20
20
|
# Vedeu.interface('hydrogen') do
|
21
21
|
# delay 0.75
|
@@ -23,7 +23,7 @@ module Vedeu
|
|
23
23
|
# Vedeu.interface('helium') do
|
24
24
|
# duplicate('hydrogen')
|
25
25
|
# end
|
26
|
-
#
|
26
|
+
# }
|
27
27
|
|
28
28
|
describe '#duplicate' do
|
29
29
|
subject { model_instance.duplicate(_name) }
|
@@ -40,10 +40,10 @@ module Vedeu
|
|
40
40
|
context 'when multiple results occur from triggering an event' do
|
41
41
|
let(:event_name) { :_multiple_results_ }
|
42
42
|
|
43
|
-
before
|
43
|
+
before {
|
44
44
|
Vedeu::Event.register(event_name) { :_result_one_ }
|
45
45
|
Vedeu::Event.register(event_name) { :_result_two_ }
|
46
|
-
|
46
|
+
}
|
47
47
|
|
48
48
|
it { subject.must_equal([:_result_one_, :_result_two_]) }
|
49
49
|
end
|
@@ -13,19 +13,19 @@ module Vedeu
|
|
13
13
|
let(:width) { 6 }
|
14
14
|
let(:x) { 7 }
|
15
15
|
let(:y) { 5 }
|
16
|
-
|
17
|
-
|
18
|
-
Vedeu::Border.new(name: _name, enabled: true).store
|
16
|
+
let(:border) { Vedeu::Border.new(name: _name, enabled: true) }
|
17
|
+
let(:geometry) {
|
19
18
|
Vedeu::Geometry.new(name: _name,
|
20
19
|
height: height,
|
21
20
|
width: width,
|
22
21
|
x: x,
|
23
|
-
y: y)
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
Vedeu.
|
28
|
-
|
22
|
+
y: y)
|
23
|
+
}
|
24
|
+
|
25
|
+
before {
|
26
|
+
Vedeu.borders.stubs(:by_name).returns(border)
|
27
|
+
Vedeu.geometries.stubs(:by_name).returns(geometry)
|
28
|
+
}
|
29
29
|
|
30
30
|
describe '#initialize' do
|
31
31
|
it { instance.must_be_instance_of(described) }
|
@@ -30,8 +30,6 @@ module Vedeu
|
|
30
30
|
let(:y) {}
|
31
31
|
let(:yn) {}
|
32
32
|
|
33
|
-
before { Terminal.stubs(:size).returns([12, 40]) }
|
34
|
-
|
35
33
|
describe '#initialize' do
|
36
34
|
it { instance.must_be_instance_of(described) }
|
37
35
|
it {
|
@@ -70,6 +68,8 @@ module Vedeu
|
|
70
68
|
end
|
71
69
|
|
72
70
|
describe '#inspect' do
|
71
|
+
before { Terminal.stubs(:size).returns([12, 40]) }
|
72
|
+
|
73
73
|
subject { instance.inspect }
|
74
74
|
|
75
75
|
it { subject.must_be_instance_of(String) }
|
@@ -119,6 +119,8 @@ module Vedeu
|
|
119
119
|
end
|
120
120
|
|
121
121
|
describe '#top, #right, #bottom, #left' do
|
122
|
+
before { Terminal.stubs(:size).returns([12, 40]) }
|
123
|
+
|
122
124
|
context 'maximised is true' do
|
123
125
|
let(:attributes) { { maximised: true } }
|
124
126
|
|
@@ -195,6 +197,8 @@ module Vedeu
|
|
195
197
|
describe '#maximise' do
|
196
198
|
let(:attributes) { { maximised: true } }
|
197
199
|
|
200
|
+
before { Terminal.stubs(:size).returns([12, 40]) }
|
201
|
+
|
198
202
|
subject { instance.maximise }
|
199
203
|
|
200
204
|
it { instance.top.must_equal(1) }
|
@@ -206,6 +210,8 @@ module Vedeu
|
|
206
210
|
describe '#unmaximise' do
|
207
211
|
let(:attributes) { { maximised: false } }
|
208
212
|
|
213
|
+
before { Terminal.stubs(:size).returns([12, 40]) }
|
214
|
+
|
209
215
|
subject { instance.unmaximise }
|
210
216
|
|
211
217
|
it { instance.top.must_equal(1) }
|
@@ -10,25 +10,22 @@ module Vedeu
|
|
10
10
|
let(:x) { 1 }
|
11
11
|
let(:y) { 1 }
|
12
12
|
let(:enabled) { true }
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
Vedeu::Border.new({
|
17
|
-
name: _name,
|
18
|
-
enabled: enabled,
|
19
|
-
}).store
|
20
|
-
Vedeu::Geometry.new({
|
13
|
+
let(:border) { Vedeu::Border.new(name: _name, enabled: enabled) }
|
14
|
+
let(:geometry) {
|
15
|
+
Vedeu::Geometry.new(
|
21
16
|
name: _name,
|
22
17
|
x: 5,
|
23
18
|
xn: 35,
|
24
19
|
y: 5,
|
25
20
|
yn: 10
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
21
|
+
)
|
22
|
+
}
|
23
|
+
|
24
|
+
before {
|
25
|
+
IO.console.stubs(:size).returns([15, 40])
|
26
|
+
Vedeu.borders.stubs(:by_name).returns(border)
|
27
|
+
Vedeu.geometries.stubs(:by_name).returns(geometry)
|
28
|
+
}
|
32
29
|
|
33
30
|
describe '#initialize' do
|
34
31
|
it { instance.must_be_instance_of(described) }
|
@@ -10,17 +10,17 @@ module Vedeu
|
|
10
10
|
let(:instance) { described.new(reader) }
|
11
11
|
let(:raw_mode) { true }
|
12
12
|
|
13
|
-
before do
|
14
|
-
reader.stubs(:raw_mode?).returns(raw_mode)
|
15
|
-
Vedeu.stubs(:trigger).returns([false])
|
16
|
-
end
|
17
|
-
|
18
13
|
describe '#initialize' do
|
19
14
|
it { instance.must_be_instance_of(described) }
|
20
15
|
it { instance.instance_variable_get('@reader').must_equal(reader) }
|
21
16
|
end
|
22
17
|
|
23
18
|
describe '.capture' do
|
19
|
+
before {
|
20
|
+
reader.stubs(:raw_mode?).returns(raw_mode)
|
21
|
+
Vedeu.stubs(:trigger).returns([false])
|
22
|
+
}
|
23
|
+
|
24
24
|
subject { described.capture(reader) }
|
25
25
|
|
26
26
|
context 'when in cooked mode' do
|
@@ -10,10 +10,10 @@ module Vedeu
|
|
10
10
|
let(:_time) { mock('Time') }
|
11
11
|
let(:started) { 1434492219.5238185 }
|
12
12
|
|
13
|
-
before
|
13
|
+
before {
|
14
14
|
Time.stubs(:now).returns(_time)
|
15
15
|
_time.stubs(:to_f).returns(started)
|
16
|
-
|
16
|
+
}
|
17
17
|
|
18
18
|
describe '#initialize' do
|
19
19
|
it { instance.must_be_instance_of(described) }
|
@@ -6,21 +6,16 @@ module Vedeu
|
|
6
6
|
|
7
7
|
let(:described) { Vedeu::Focus }
|
8
8
|
|
9
|
-
before
|
9
|
+
before {
|
10
10
|
Focus.reset
|
11
11
|
Vedeu.interfaces.reset
|
12
|
-
|
13
|
-
after
|
12
|
+
}
|
13
|
+
after {
|
14
14
|
Vedeu::Focus.reset
|
15
15
|
Vedeu.interfaces.reset
|
16
|
-
|
16
|
+
}
|
17
17
|
|
18
18
|
describe '#add' do
|
19
|
-
before do
|
20
|
-
Focus.reset
|
21
|
-
Vedeu.interfaces.reset
|
22
|
-
end
|
23
|
-
|
24
19
|
context 'adds an interface to storage' do
|
25
20
|
it {
|
26
21
|
Focus.add('thallium').must_equal(['thallium'])
|
@@ -28,9 +23,9 @@ module Vedeu
|
|
28
23
|
end
|
29
24
|
|
30
25
|
context 'does not add it again if already exists' do
|
31
|
-
before
|
26
|
+
before {
|
32
27
|
Vedeu.interface('thallium') {}
|
33
|
-
|
28
|
+
}
|
34
29
|
|
35
30
|
it {
|
36
31
|
Focus.add('thallium')
|
@@ -47,9 +42,9 @@ module Vedeu
|
|
47
42
|
end
|
48
43
|
|
49
44
|
context 'adds the interface to storage focussed' do
|
50
|
-
before
|
45
|
+
before {
|
51
46
|
Vedeu.interface('thallium') {}
|
52
|
-
|
47
|
+
}
|
53
48
|
|
54
49
|
it {
|
55
50
|
Focus.add('thallium')
|
@@ -59,9 +54,9 @@ module Vedeu
|
|
59
54
|
end
|
60
55
|
|
61
56
|
context 'adds the interface to storage unfocussed' do
|
62
|
-
before
|
57
|
+
before {
|
63
58
|
Vedeu.interface('thallium') {}
|
64
|
-
|
59
|
+
}
|
65
60
|
|
66
61
|
it {
|
67
62
|
Focus.add('thallium')
|
@@ -161,23 +156,23 @@ module Vedeu
|
|
161
156
|
end
|
162
157
|
|
163
158
|
describe '#next_visible_item' do
|
164
|
-
before
|
159
|
+
before {
|
165
160
|
Vedeu.stubs(:trigger)
|
166
161
|
Vedeu.interface('gold') { visible true }
|
167
162
|
Vedeu.interface('silver') { visible true }
|
168
163
|
Vedeu.interface('platinum') { visible false }
|
169
|
-
|
164
|
+
}
|
170
165
|
|
171
166
|
it 'the next visible interface is focussed when the method is called' do
|
172
167
|
Focus.next_visible_item.must_equal('silver')
|
173
168
|
end
|
174
169
|
|
175
170
|
context 'when there are no visible interfaces' do
|
176
|
-
before
|
171
|
+
before {
|
177
172
|
Vedeu.interface('gold') { visible false }
|
178
173
|
Vedeu.interface('silver') { visible false }
|
179
174
|
Vedeu.interface('platinum') { visible false }
|
180
|
-
|
175
|
+
}
|
181
176
|
|
182
177
|
it 'puts the first interface defined in focus' do
|
183
178
|
Focus.next_visible_item.must_equal('gold')
|
@@ -208,23 +203,23 @@ module Vedeu
|
|
208
203
|
end
|
209
204
|
|
210
205
|
describe '#prev_visible_item' do
|
211
|
-
before
|
206
|
+
before {
|
212
207
|
Vedeu.stubs(:trigger)
|
213
208
|
Vedeu.interface('gold') { visible true }
|
214
209
|
Vedeu.interface('silver') { visible true }
|
215
210
|
Vedeu.interface('platinum') { visible false }
|
216
|
-
|
211
|
+
}
|
217
212
|
|
218
213
|
it 'the previous visible interface is focussed when the method is called' do
|
219
214
|
Focus.prev_visible_item.must_equal('silver')
|
220
215
|
end
|
221
216
|
|
222
217
|
context 'when there are no visible interfaces' do
|
223
|
-
before
|
218
|
+
before {
|
224
219
|
Vedeu.interface('gold') { visible false }
|
225
220
|
Vedeu.interface('silver') { visible false }
|
226
221
|
Vedeu.interface('platinum') { visible false }
|
227
|
-
|
222
|
+
}
|
228
223
|
|
229
224
|
it 'puts the first interface defined in focus' do
|
230
225
|
Focus.prev_visible_item.must_equal('gold')
|
@@ -239,10 +234,10 @@ module Vedeu
|
|
239
234
|
end
|
240
235
|
|
241
236
|
describe '#refresh' do
|
242
|
-
before
|
237
|
+
before {
|
243
238
|
Focus.add('thallium')
|
244
239
|
Vedeu.stubs(:trigger).returns([])
|
245
|
-
|
240
|
+
}
|
246
241
|
|
247
242
|
it 'triggers the event to refresh the interface current in focus' do
|
248
243
|
Focus.refresh.must_equal([])
|
@@ -137,14 +137,14 @@ module Vedeu
|
|
137
137
|
let(:border) { mock('Vedeu::Border') }
|
138
138
|
let(:view) { mock('Vedeu::Viewport') }
|
139
139
|
|
140
|
-
before
|
140
|
+
before {
|
141
141
|
Vedeu::Clear::NamedInterface.stubs(:render).returns(:clear)
|
142
142
|
|
143
143
|
Vedeu.borders.stubs(:by_name).returns(border)
|
144
144
|
border.stubs(:render).returns(:border)
|
145
145
|
Vedeu::Viewport.stubs(:new).returns(view)
|
146
146
|
view.stubs(:render).returns(:view)
|
147
|
-
|
147
|
+
}
|
148
148
|
|
149
149
|
subject { instance.render }
|
150
150
|
|
@@ -9,17 +9,19 @@ module Vedeu
|
|
9
9
|
it { described.must_respond_to(:interfaces) }
|
10
10
|
|
11
11
|
describe '#zindexed' do
|
12
|
-
before
|
13
|
-
|
12
|
+
before {
|
13
|
+
Vedeu.interfaces.reset
|
14
|
+
|
15
|
+
@hydrogen = Vedeu.interface('hydrogen') do
|
14
16
|
zindex 2
|
15
17
|
end
|
16
|
-
@helium = Vedeu.interface
|
18
|
+
@helium = Vedeu.interface('helium') do
|
17
19
|
zindex 3
|
18
20
|
end
|
19
|
-
@lithium = Vedeu.interface
|
21
|
+
@lithium = Vedeu.interface('lithium') do
|
20
22
|
zindex 1
|
21
23
|
end
|
22
|
-
|
24
|
+
}
|
23
25
|
after { Vedeu.interfaces.reset }
|
24
26
|
|
25
27
|
subject { Vedeu.interfaces.zindexed }
|
@@ -39,11 +39,6 @@ module Vedeu
|
|
39
39
|
let(:colour) { Colour.new(foreground: '#ff0000', background: '#000000') }
|
40
40
|
let(:style) { Style.new('normal') }
|
41
41
|
|
42
|
-
before do
|
43
|
-
parent.stubs(:colour)
|
44
|
-
parent.stubs(:style)
|
45
|
-
end
|
46
|
-
|
47
42
|
describe '#initialize' do
|
48
43
|
it { instance.must_be_instance_of(described) }
|
49
44
|
it { instance.instance_variable_get('@streams').must_equal(streams) }
|
@@ -15,10 +15,7 @@ module Vedeu
|
|
15
15
|
}
|
16
16
|
let(:_name) { 'null_geometry' }
|
17
17
|
|
18
|
-
before
|
19
|
-
Vedeu::Terminal.stubs(:height).returns(25)
|
20
|
-
Vedeu::Terminal.stubs(:width).returns(40)
|
21
|
-
end
|
18
|
+
before { Vedeu::Terminal.stubs(:size).returns([25, 40]) }
|
22
19
|
|
23
20
|
describe '#initialize' do
|
24
21
|
it { instance.must_be_instance_of(described) }
|
@@ -28,10 +28,10 @@ module Vedeu
|
|
28
28
|
Vedeu::Geometry.new(name: _name, x: 1, y: 1, xn: 2, yn: 2)
|
29
29
|
}
|
30
30
|
|
31
|
-
before
|
31
|
+
before {
|
32
32
|
Vedeu.interfaces.stubs(:by_name).returns(interface)
|
33
33
|
Vedeu.geometries.stubs(:by_name).returns(geometry)
|
34
|
-
|
34
|
+
}
|
35
35
|
|
36
36
|
subject { instance.render }
|
37
37
|
|
@@ -6,8 +6,6 @@ module Vedeu
|
|
6
6
|
|
7
7
|
let(:described) { Vedeu::Esc }
|
8
8
|
|
9
|
-
before { Vedeu::Terminal.stubs(:size).returns([80, 25]) }
|
10
|
-
|
11
9
|
describe '.escape' do
|
12
10
|
let(:stream) { "\e[0m\e[38;2;39m\e[48;2;49m\e[2J\e[?25l" }
|
13
11
|
|
@@ -54,8 +52,6 @@ module Vedeu
|
|
54
52
|
it { described.string('hide_cursor').must_equal("\e[?25l") }
|
55
53
|
it { described.string('screen_init').
|
56
54
|
must_equal("\e[0m\e[39m\e[49m\e[2J\e[?25l") }
|
57
|
-
it { described.string('screen_exit').
|
58
|
-
must_equal("\e[?25h\e[39m\e[49m\e[0m\e[80;25H\n") }
|
59
55
|
it { described.string('negative').must_equal("\e[7m") }
|
60
56
|
it { described.string('positive').must_equal("\e[27m") }
|
61
57
|
it { described.string('reset').must_equal("\e[0m") }
|
@@ -66,6 +62,13 @@ module Vedeu
|
|
66
62
|
it { described.string('underline_off').must_equal("\e[24m") }
|
67
63
|
it { described.string('cursor_position').must_equal("\e[6n") }
|
68
64
|
end
|
65
|
+
|
66
|
+
context 'screen_exit' do
|
67
|
+
before { Vedeu::Terminal.stubs(:size).returns([80, 25]) }
|
68
|
+
|
69
|
+
it { described.string('screen_exit').
|
70
|
+
must_equal("\e[?25h\e[39m\e[49m\e[0m\e[80;25H\n") }
|
71
|
+
end
|
69
72
|
end
|
70
73
|
|
71
74
|
end # Esc
|