vedeu 0.6.19 → 0.6.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/configuration.md +6 -4
- data/docs/dsl.md +23 -21
- data/docs/events/system.md +9 -9
- data/docs/getting_started.md +54 -48
- data/docs/object_graph.md +4 -4
- data/lib/vedeu/all.rb +1 -1
- data/lib/vedeu/api/external.rb +10 -10
- data/lib/vedeu/api/internal.rb +2 -2
- data/lib/vedeu/bindings/application.rb +5 -2
- data/lib/vedeu/bindings/bindings.rb +15 -2
- data/lib/vedeu/bindings/movement.rb +10 -5
- data/lib/vedeu/bindings/refresh.rb +1 -1
- data/lib/vedeu/bindings/system.rb +1 -1
- data/lib/vedeu/bindings/visibility.rb +20 -37
- data/lib/vedeu/cursors/cursor.rb +1 -14
- data/lib/vedeu/dsl/all.rb +0 -1
- data/lib/vedeu/dsl/interface.rb +1 -1
- data/lib/vedeu/esc/colours.rb +1 -1
- data/lib/vedeu/geometry/geometry.rb +19 -25
- data/lib/vedeu/groups/all.rb +16 -0
- data/lib/vedeu/{output/clear/group.rb → groups/clear.rb} +7 -7
- data/lib/vedeu/{dsl/group.rb → groups/dsl.rb} +10 -10
- data/lib/vedeu/{models → groups}/group.rb +14 -31
- data/lib/vedeu/{output/refresh/refresh_group.rb → groups/refresh.rb} +7 -7
- data/lib/vedeu/groups/repository.rb +24 -0
- data/lib/vedeu/models/all.rb +0 -2
- data/lib/vedeu/models/interface.rb +0 -12
- data/lib/vedeu/models/toggleable.rb +1 -1
- data/lib/vedeu/output/clear/all.rb +0 -1
- data/lib/vedeu/output/wordwrap.rb +3 -5
- data/lib/vedeu/repositories/model.rb +8 -1
- data/lib/vedeu/runtime/main_loop.rb +2 -2
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/api/external_test.rb +1 -1
- data/test/lib/vedeu/bindings/application_test.rb +1 -0
- data/test/lib/vedeu/bindings/bindings_test.rb +27 -0
- data/test/lib/vedeu/borders/border_test.rb +43 -37
- data/test/lib/vedeu/borders/render_test.rb +5 -1
- data/test/lib/vedeu/buffers/buffer_test.rb +9 -7
- data/test/lib/vedeu/cursors/cursor_test.rb +11 -9
- data/test/lib/vedeu/distributed/test_application_test.rb +18 -16
- data/test/lib/vedeu/dsl/interface_test.rb +2 -2
- data/test/lib/vedeu/editor/cursor_test.rb +18 -16
- data/test/lib/vedeu/editor/document_test.rb +7 -5
- data/test/lib/vedeu/esc/actions_test.rb +0 -2
- data/test/lib/vedeu/esc/borders_test.rb +0 -2
- data/test/lib/vedeu/esc/colours_test.rb +0 -2
- data/test/lib/vedeu/events/aliases_test.rb +1 -1
- data/test/lib/vedeu/geometry/area_test.rb +10 -8
- data/test/lib/vedeu/geometry/dsl_test.rb +2 -2
- data/test/lib/vedeu/geometry/geometry_test.rb +18 -30
- data/test/lib/vedeu/geometry/position_test.rb +6 -4
- data/test/lib/vedeu/{output/clear/group_test.rb → groups/clear_test.rb} +8 -8
- data/test/lib/vedeu/{dsl/group_test.rb → groups/dsl_test.rb} +8 -8
- data/test/lib/vedeu/{models → groups}/group_test.rb +12 -10
- data/test/lib/vedeu/{output/refresh/refresh_group_test.rb → groups/refresh_test.rb} +7 -7
- data/test/lib/vedeu/{models/groups_test.rb → groups/repository_test.rb} +6 -6
- data/test/lib/vedeu/menus/menu_test.rb +7 -5
- data/test/lib/vedeu/models/cell_test.rb +5 -3
- data/test/lib/vedeu/models/interface_test.rb +18 -42
- data/test/lib/vedeu/models/toggleable_test.rb +5 -3
- data/test/lib/vedeu/models/views/char_test.rb +8 -6
- data/test/lib/vedeu/models/views/composition_test.rb +6 -4
- data/test/lib/vedeu/models/views/line_test.rb +5 -3
- data/test/lib/vedeu/models/views/stream_test.rb +9 -7
- data/test/lib/vedeu/models/views/view_test.rb +30 -12
- data/test/lib/vedeu/output/presentation/style_test.rb +4 -2
- data/test/lib/vedeu/plugins/plugin_test.rb +8 -6
- data/test/lib/vedeu/repositories/collection_test.rb +8 -6
- data/test/lib/vedeu/runtime/application_test.rb +1 -1
- data/test/test_helper.rb +1 -0
- metadata +18 -17
- data/lib/vedeu/models/groups.rb +0 -24
@@ -36,6 +36,10 @@ module Vedeu
|
|
36
36
|
end
|
37
37
|
|
38
38
|
describe '#render' do
|
39
|
+
it { instance.must_respond_to(:render) }
|
40
|
+
end
|
41
|
+
|
42
|
+
describe '.with' do
|
39
43
|
let(:geometry) {
|
40
44
|
Vedeu::Geometry::Geometry.new(name: _name, x: 1, xn: 7, y: 1, yn: 4)
|
41
45
|
}
|
@@ -47,7 +51,7 @@ module Vedeu
|
|
47
51
|
Vedeu.interfaces.stubs(:by_name).returns(interface)
|
48
52
|
end
|
49
53
|
|
50
|
-
subject {
|
54
|
+
subject { described.with(border) }
|
51
55
|
|
52
56
|
context 'when the interface is not visible' do
|
53
57
|
it { subject.must_equal([]) }
|
@@ -34,13 +34,15 @@ module Vedeu
|
|
34
34
|
end
|
35
35
|
|
36
36
|
describe 'accessors' do
|
37
|
-
it {
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
37
|
+
it {
|
38
|
+
instance.must_respond_to(:back)
|
39
|
+
instance.must_respond_to(:back=)
|
40
|
+
instance.must_respond_to(:front)
|
41
|
+
instance.must_respond_to(:front=)
|
42
|
+
instance.must_respond_to(:previous)
|
43
|
+
instance.must_respond_to(:previous=)
|
44
|
+
instance.must_respond_to(:name)
|
45
|
+
}
|
44
46
|
end
|
45
47
|
|
46
48
|
describe '#add' do
|
@@ -61,15 +61,17 @@ module Vedeu
|
|
61
61
|
end
|
62
62
|
|
63
63
|
describe 'accessors' do
|
64
|
-
it {
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
64
|
+
it {
|
65
|
+
instance.must_respond_to(:attributes)
|
66
|
+
instance.must_respond_to(:name)
|
67
|
+
instance.must_respond_to(:ox)
|
68
|
+
instance.must_respond_to(:ox=)
|
69
|
+
instance.must_respond_to(:oy)
|
70
|
+
instance.must_respond_to(:oy=)
|
71
|
+
instance.must_respond_to(:state)
|
72
|
+
instance.must_respond_to(:x=)
|
73
|
+
instance.must_respond_to(:y=)
|
74
|
+
}
|
73
75
|
end
|
74
76
|
|
75
77
|
describe '.store' do
|
@@ -13,22 +13,24 @@ module Vedeu
|
|
13
13
|
end
|
14
14
|
|
15
15
|
describe 'accessors' do
|
16
|
-
it {
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
16
|
+
it {
|
17
|
+
instance.must_respond_to(:borders)
|
18
|
+
instance.must_respond_to(:borders=)
|
19
|
+
instance.must_respond_to(:configuration)
|
20
|
+
instance.must_respond_to(:configuration=)
|
21
|
+
instance.must_respond_to(:events)
|
22
|
+
instance.must_respond_to(:events=)
|
23
|
+
instance.must_respond_to(:geometries)
|
24
|
+
instance.must_respond_to(:geometries=)
|
25
|
+
instance.must_respond_to(:interfaces)
|
26
|
+
instance.must_respond_to(:interfaces=)
|
27
|
+
instance.must_respond_to(:keymaps)
|
28
|
+
instance.must_respond_to(:keymaps=)
|
29
|
+
instance.must_respond_to(:menus)
|
30
|
+
instance.must_respond_to(:menus=)
|
31
|
+
instance.must_respond_to(:views)
|
32
|
+
instance.must_respond_to(:views=)
|
33
|
+
}
|
32
34
|
end
|
33
35
|
|
34
36
|
describe '.build' do
|
@@ -213,7 +213,7 @@ module Vedeu
|
|
213
213
|
|
214
214
|
subject { instance.group(_value) }
|
215
215
|
|
216
|
-
it { subject.must_be_instance_of(Vedeu::
|
216
|
+
it { subject.must_be_instance_of(Vedeu::Groups::Group) }
|
217
217
|
|
218
218
|
context 'when the value is empty or nil' do
|
219
219
|
let(:_value) { '' }
|
@@ -225,7 +225,7 @@ module Vedeu
|
|
225
225
|
let(:members) { Set['actinium', 'lanthanum'] }
|
226
226
|
|
227
227
|
before do
|
228
|
-
Vedeu::
|
228
|
+
Vedeu::Groups::Group.new(name: 'elements',
|
229
229
|
members: ['lanthanum']).store
|
230
230
|
end
|
231
231
|
|
@@ -62,22 +62,24 @@ module Vedeu
|
|
62
62
|
end
|
63
63
|
|
64
64
|
describe '#accessors' do
|
65
|
-
it {
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
65
|
+
it {
|
66
|
+
instance.must_respond_to(:bx)
|
67
|
+
instance.must_respond_to(:bx=)
|
68
|
+
instance.must_respond_to(:by)
|
69
|
+
instance.must_respond_to(:by=)
|
70
|
+
instance.must_respond_to(:bxn)
|
71
|
+
instance.must_respond_to(:bxn=)
|
72
|
+
instance.must_respond_to(:byn)
|
73
|
+
instance.must_respond_to(:byn=)
|
74
|
+
instance.must_respond_to(:ox)
|
75
|
+
instance.must_respond_to(:ox=)
|
76
|
+
instance.must_respond_to(:oy)
|
77
|
+
instance.must_respond_to(:oy=)
|
78
|
+
instance.must_respond_to(:x)
|
79
|
+
instance.must_respond_to(:x=)
|
80
|
+
instance.must_respond_to(:y)
|
81
|
+
instance.must_respond_to(:y=)
|
82
|
+
}
|
81
83
|
end
|
82
84
|
|
83
85
|
describe '#bol' do
|
@@ -34,11 +34,13 @@ module Vedeu
|
|
34
34
|
end
|
35
35
|
|
36
36
|
describe 'accessors' do
|
37
|
-
it {
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
it {
|
38
|
+
instance.must_respond_to(:attributes)
|
39
|
+
instance.must_respond_to(:data)
|
40
|
+
instance.must_respond_to(:data=)
|
41
|
+
instance.must_respond_to(:name)
|
42
|
+
instance.must_respond_to(:name=)
|
43
|
+
}
|
42
44
|
end
|
43
45
|
|
44
46
|
describe '#clear' do
|
@@ -8,8 +8,6 @@ module Vedeu
|
|
8
8
|
|
9
9
|
let(:described) { Vedeu::EscapeSequences::Actions }
|
10
10
|
|
11
|
-
before { Vedeu::Terminal.stubs(:size).returns([80, 25]) }
|
12
|
-
|
13
11
|
describe 'action methods' do
|
14
12
|
it { described.hide_cursor.must_equal("\e[?25l") }
|
15
13
|
it { described.show_cursor.must_equal("\e[?25h") }
|
@@ -8,8 +8,6 @@ module Vedeu
|
|
8
8
|
|
9
9
|
let(:described) { Vedeu::EscapeSequences::Borders }
|
10
10
|
|
11
|
-
before { Vedeu::Terminal.stubs(:size).returns([80, 25]) }
|
12
|
-
|
13
11
|
describe 'border methods' do
|
14
12
|
it { described.border_on.must_equal("\e(0") }
|
15
13
|
it { described.border_off.must_equal("\e(B") }
|
@@ -8,8 +8,6 @@ module Vedeu
|
|
8
8
|
|
9
9
|
let(:described) { Vedeu::EscapeSequences::Colours }
|
10
10
|
|
11
|
-
before { Vedeu::Terminal.stubs(:size).returns([80, 25]) }
|
12
|
-
|
13
11
|
describe 'foreground colour methods' do
|
14
12
|
it { described.black.must_equal("\e[30m") }
|
15
13
|
it { described.red.must_equal("\e[31m") }
|
@@ -15,14 +15,16 @@ module Vedeu
|
|
15
15
|
let(:offset) { 1 }
|
16
16
|
|
17
17
|
describe 'accessors' do
|
18
|
-
it {
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
18
|
+
it {
|
19
|
+
instance.must_respond_to(:y)
|
20
|
+
instance.must_respond_to(:yn)
|
21
|
+
instance.must_respond_to(:x)
|
22
|
+
instance.must_respond_to(:xn)
|
23
|
+
instance.must_respond_to(:top)
|
24
|
+
instance.must_respond_to(:bottom)
|
25
|
+
instance.must_respond_to(:left)
|
26
|
+
instance.must_respond_to(:right)
|
27
|
+
}
|
26
28
|
end
|
27
29
|
|
28
30
|
describe '#initialize' do
|
@@ -55,7 +55,7 @@ module Vedeu
|
|
55
55
|
end
|
56
56
|
|
57
57
|
describe '#columns' do
|
58
|
-
before { Terminal.stubs(:size).returns([25, 80]) }
|
58
|
+
before { Vedeu::Terminal.stubs(:size).returns([25, 80]) }
|
59
59
|
|
60
60
|
subject { instance.columns(3) }
|
61
61
|
|
@@ -99,7 +99,7 @@ module Vedeu
|
|
99
99
|
end
|
100
100
|
|
101
101
|
describe '#rows' do
|
102
|
-
before { Terminal.stubs(:size).returns([25, 80]) }
|
102
|
+
before { Vedeu::Terminal.stubs(:size).returns([25, 80]) }
|
103
103
|
|
104
104
|
subject { instance.rows(3) }
|
105
105
|
|
@@ -32,6 +32,8 @@ module Vedeu
|
|
32
32
|
let(:y) {}
|
33
33
|
let(:yn) {}
|
34
34
|
|
35
|
+
before { Vedeu::Terminal.stubs(:size).returns([12, 40]) }
|
36
|
+
|
35
37
|
describe '#initialize' do
|
36
38
|
it { instance.must_be_instance_of(described) }
|
37
39
|
it {
|
@@ -53,20 +55,22 @@ module Vedeu
|
|
53
55
|
end
|
54
56
|
|
55
57
|
describe 'accessors' do
|
56
|
-
it {
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
58
|
+
it {
|
59
|
+
instance.must_respond_to(:centred)
|
60
|
+
instance.must_respond_to(:centred=)
|
61
|
+
instance.must_respond_to(:attributes)
|
62
|
+
instance.must_respond_to(:name)
|
63
|
+
instance.must_respond_to(:name=)
|
64
|
+
instance.must_respond_to(:height=)
|
65
|
+
instance.must_respond_to(:maximised)
|
66
|
+
instance.must_respond_to(:maximised?)
|
67
|
+
instance.must_respond_to(:maximised=)
|
68
|
+
instance.must_respond_to(:width=)
|
69
|
+
instance.must_respond_to(:x=)
|
70
|
+
instance.must_respond_to(:xn=)
|
71
|
+
instance.must_respond_to(:y=)
|
72
|
+
instance.must_respond_to(:yn=)
|
73
|
+
}
|
70
74
|
end
|
71
75
|
|
72
76
|
describe '.store' do
|
@@ -113,8 +117,6 @@ module Vedeu
|
|
113
117
|
let(:y) { 4 }
|
114
118
|
let(:yn) { 8 }
|
115
119
|
|
116
|
-
before { Terminal.stubs(:size).returns([12, 40]) }
|
117
|
-
|
118
120
|
subject { instance.move_down }
|
119
121
|
|
120
122
|
it { subject.must_be_instance_of(described) }
|
@@ -139,8 +141,6 @@ module Vedeu
|
|
139
141
|
let(:y) { 4 }
|
140
142
|
let(:yn) { 8 }
|
141
143
|
|
142
|
-
before { Terminal.stubs(:size).returns([12, 40]) }
|
143
|
-
|
144
144
|
subject { instance.move_left }
|
145
145
|
|
146
146
|
it { subject.must_be_instance_of(described) }
|
@@ -165,8 +165,6 @@ module Vedeu
|
|
165
165
|
let(:y) { 4 }
|
166
166
|
let(:yn) { 8 }
|
167
167
|
|
168
|
-
before { Terminal.stubs(:size).returns([12, 40]) }
|
169
|
-
|
170
168
|
subject { instance.move_origin }
|
171
169
|
|
172
170
|
it { subject.must_be_instance_of(described) }
|
@@ -182,8 +180,6 @@ module Vedeu
|
|
182
180
|
let(:y) { 4 }
|
183
181
|
let(:yn) { 8 }
|
184
182
|
|
185
|
-
before { Terminal.stubs(:size).returns([12, 40]) }
|
186
|
-
|
187
183
|
subject { instance.move_right }
|
188
184
|
|
189
185
|
it { subject.must_be_instance_of(described) }
|
@@ -208,8 +204,6 @@ module Vedeu
|
|
208
204
|
let(:y) { 4 }
|
209
205
|
let(:yn) { 8 }
|
210
206
|
|
211
|
-
before { Terminal.stubs(:size).returns([12, 40]) }
|
212
|
-
|
213
207
|
subject { instance.move_up }
|
214
208
|
|
215
209
|
it { subject.must_be_instance_of(described) }
|
@@ -247,8 +241,6 @@ module Vedeu
|
|
247
241
|
end
|
248
242
|
|
249
243
|
describe '#top, #right, #bottom, #left' do
|
250
|
-
before { Terminal.stubs(:size).returns([12, 40]) }
|
251
|
-
|
252
244
|
context 'maximised is true' do
|
253
245
|
let(:attributes) { { maximised: true } }
|
254
246
|
|
@@ -325,8 +317,6 @@ module Vedeu
|
|
325
317
|
describe '#maximise' do
|
326
318
|
let(:attributes) { { maximised: true } }
|
327
319
|
|
328
|
-
before { Terminal.stubs(:size).returns([12, 40]) }
|
329
|
-
|
330
320
|
subject { instance.maximise }
|
331
321
|
|
332
322
|
it { instance.top.must_equal(1) }
|
@@ -338,8 +328,6 @@ module Vedeu
|
|
338
328
|
describe '#unmaximise' do
|
339
329
|
let(:attributes) { { maximised: false } }
|
340
330
|
|
341
|
-
before { Terminal.stubs(:size).returns([12, 40]) }
|
342
|
-
|
343
331
|
subject { instance.unmaximise }
|
344
332
|
|
345
333
|
it { instance.top.must_equal(1) }
|
@@ -12,10 +12,12 @@ module Vedeu
|
|
12
12
|
let(:x) { 19 }
|
13
13
|
|
14
14
|
describe 'accessors' do
|
15
|
-
it {
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
it {
|
16
|
+
instance.must_respond_to(:y)
|
17
|
+
instance.must_respond_to(:first)
|
18
|
+
instance.must_respond_to(:x)
|
19
|
+
instance.must_respond_to(:last)
|
20
|
+
}
|
19
21
|
end
|
20
22
|
|
21
23
|
describe '#initialize' do
|
@@ -2,13 +2,13 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
|
5
|
-
module
|
5
|
+
module Groups
|
6
6
|
|
7
|
-
describe
|
7
|
+
describe Clear do
|
8
8
|
|
9
|
-
let(:described) { Vedeu::Clear
|
9
|
+
let(:described) { Vedeu::Groups::Clear }
|
10
10
|
let(:instance) { described.new(_name) }
|
11
|
-
let(:_name) { 'Vedeu::Clear
|
11
|
+
let(:_name) { 'Vedeu::Groups::Clear' }
|
12
12
|
|
13
13
|
describe '#initialize' do
|
14
14
|
it { instance.must_be_instance_of(described) }
|
@@ -16,14 +16,14 @@ module Vedeu
|
|
16
16
|
end
|
17
17
|
|
18
18
|
describe '.render' do
|
19
|
-
let(:group) { Vedeu::
|
19
|
+
let(:group) { Vedeu::Groups::Group.new(members: [_name]) }
|
20
20
|
|
21
21
|
before { Vedeu.groups.stubs(:by_name).returns(group) }
|
22
22
|
|
23
23
|
subject { described.render(_name) }
|
24
24
|
|
25
25
|
it {
|
26
|
-
Vedeu
|
26
|
+
Vedeu.expects(:trigger).with(:_clear_view_, _name)
|
27
27
|
subject
|
28
28
|
}
|
29
29
|
|
@@ -35,8 +35,8 @@ module Vedeu
|
|
35
35
|
it { instance.must_respond_to(:render) }
|
36
36
|
end
|
37
37
|
|
38
|
-
end #
|
38
|
+
end # Clear
|
39
39
|
|
40
|
-
end #
|
40
|
+
end # Groups
|
41
41
|
|
42
42
|
end # Vedeu
|