vedeu 0.6.19 → 0.6.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/docs/configuration.md +6 -4
  3. data/docs/dsl.md +23 -21
  4. data/docs/events/system.md +9 -9
  5. data/docs/getting_started.md +54 -48
  6. data/docs/object_graph.md +4 -4
  7. data/lib/vedeu/all.rb +1 -1
  8. data/lib/vedeu/api/external.rb +10 -10
  9. data/lib/vedeu/api/internal.rb +2 -2
  10. data/lib/vedeu/bindings/application.rb +5 -2
  11. data/lib/vedeu/bindings/bindings.rb +15 -2
  12. data/lib/vedeu/bindings/movement.rb +10 -5
  13. data/lib/vedeu/bindings/refresh.rb +1 -1
  14. data/lib/vedeu/bindings/system.rb +1 -1
  15. data/lib/vedeu/bindings/visibility.rb +20 -37
  16. data/lib/vedeu/cursors/cursor.rb +1 -14
  17. data/lib/vedeu/dsl/all.rb +0 -1
  18. data/lib/vedeu/dsl/interface.rb +1 -1
  19. data/lib/vedeu/esc/colours.rb +1 -1
  20. data/lib/vedeu/geometry/geometry.rb +19 -25
  21. data/lib/vedeu/groups/all.rb +16 -0
  22. data/lib/vedeu/{output/clear/group.rb → groups/clear.rb} +7 -7
  23. data/lib/vedeu/{dsl/group.rb → groups/dsl.rb} +10 -10
  24. data/lib/vedeu/{models → groups}/group.rb +14 -31
  25. data/lib/vedeu/{output/refresh/refresh_group.rb → groups/refresh.rb} +7 -7
  26. data/lib/vedeu/groups/repository.rb +24 -0
  27. data/lib/vedeu/models/all.rb +0 -2
  28. data/lib/vedeu/models/interface.rb +0 -12
  29. data/lib/vedeu/models/toggleable.rb +1 -1
  30. data/lib/vedeu/output/clear/all.rb +0 -1
  31. data/lib/vedeu/output/wordwrap.rb +3 -5
  32. data/lib/vedeu/repositories/model.rb +8 -1
  33. data/lib/vedeu/runtime/main_loop.rb +2 -2
  34. data/lib/vedeu/version.rb +1 -1
  35. data/test/lib/vedeu/api/external_test.rb +1 -1
  36. data/test/lib/vedeu/bindings/application_test.rb +1 -0
  37. data/test/lib/vedeu/bindings/bindings_test.rb +27 -0
  38. data/test/lib/vedeu/borders/border_test.rb +43 -37
  39. data/test/lib/vedeu/borders/render_test.rb +5 -1
  40. data/test/lib/vedeu/buffers/buffer_test.rb +9 -7
  41. data/test/lib/vedeu/cursors/cursor_test.rb +11 -9
  42. data/test/lib/vedeu/distributed/test_application_test.rb +18 -16
  43. data/test/lib/vedeu/dsl/interface_test.rb +2 -2
  44. data/test/lib/vedeu/editor/cursor_test.rb +18 -16
  45. data/test/lib/vedeu/editor/document_test.rb +7 -5
  46. data/test/lib/vedeu/esc/actions_test.rb +0 -2
  47. data/test/lib/vedeu/esc/borders_test.rb +0 -2
  48. data/test/lib/vedeu/esc/colours_test.rb +0 -2
  49. data/test/lib/vedeu/events/aliases_test.rb +1 -1
  50. data/test/lib/vedeu/geometry/area_test.rb +10 -8
  51. data/test/lib/vedeu/geometry/dsl_test.rb +2 -2
  52. data/test/lib/vedeu/geometry/geometry_test.rb +18 -30
  53. data/test/lib/vedeu/geometry/position_test.rb +6 -4
  54. data/test/lib/vedeu/{output/clear/group_test.rb → groups/clear_test.rb} +8 -8
  55. data/test/lib/vedeu/{dsl/group_test.rb → groups/dsl_test.rb} +8 -8
  56. data/test/lib/vedeu/{models → groups}/group_test.rb +12 -10
  57. data/test/lib/vedeu/{output/refresh/refresh_group_test.rb → groups/refresh_test.rb} +7 -7
  58. data/test/lib/vedeu/{models/groups_test.rb → groups/repository_test.rb} +6 -6
  59. data/test/lib/vedeu/menus/menu_test.rb +7 -5
  60. data/test/lib/vedeu/models/cell_test.rb +5 -3
  61. data/test/lib/vedeu/models/interface_test.rb +18 -42
  62. data/test/lib/vedeu/models/toggleable_test.rb +5 -3
  63. data/test/lib/vedeu/models/views/char_test.rb +8 -6
  64. data/test/lib/vedeu/models/views/composition_test.rb +6 -4
  65. data/test/lib/vedeu/models/views/line_test.rb +5 -3
  66. data/test/lib/vedeu/models/views/stream_test.rb +9 -7
  67. data/test/lib/vedeu/models/views/view_test.rb +30 -12
  68. data/test/lib/vedeu/output/presentation/style_test.rb +4 -2
  69. data/test/lib/vedeu/plugins/plugin_test.rb +8 -6
  70. data/test/lib/vedeu/repositories/collection_test.rb +8 -6
  71. data/test/lib/vedeu/runtime/application_test.rb +1 -1
  72. data/test/test_helper.rb +1 -0
  73. metadata +18 -17
  74. 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 { instance.render }
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 { instance.must_respond_to(:back) }
38
- it { instance.must_respond_to(:back=) }
39
- it { instance.must_respond_to(:front) }
40
- it { instance.must_respond_to(:front=) }
41
- it { instance.must_respond_to(:previous) }
42
- it { instance.must_respond_to(:previous=) }
43
- it { instance.must_respond_to(:name) }
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 { instance.must_respond_to(:attributes) }
65
- it { instance.must_respond_to(:name) }
66
- it { instance.must_respond_to(:ox) }
67
- it { instance.must_respond_to(:ox=) }
68
- it { instance.must_respond_to(:oy) }
69
- it { instance.must_respond_to(:oy=) }
70
- it { instance.must_respond_to(:state) }
71
- it { instance.must_respond_to(:x=) }
72
- it { instance.must_respond_to(:y=) }
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 { instance.must_respond_to(:borders) }
17
- it { instance.must_respond_to(:borders=) }
18
- it { instance.must_respond_to(:configuration) }
19
- it { instance.must_respond_to(:configuration=) }
20
- it { instance.must_respond_to(:events) }
21
- it { instance.must_respond_to(:events=) }
22
- it { instance.must_respond_to(:geometries) }
23
- it { instance.must_respond_to(:geometries=) }
24
- it { instance.must_respond_to(:interfaces) }
25
- it { instance.must_respond_to(:interfaces=) }
26
- it { instance.must_respond_to(:keymaps) }
27
- it { instance.must_respond_to(:keymaps=) }
28
- it { instance.must_respond_to(:menus) }
29
- it { instance.must_respond_to(:menus=) }
30
- it { instance.must_respond_to(:views) }
31
- it { instance.must_respond_to(:views=) }
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::Models::Group) }
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::Models::Group.new(name: 'elements',
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 { instance.must_respond_to(:bx) }
66
- it { instance.must_respond_to(:bx=) }
67
- it { instance.must_respond_to(:by) }
68
- it { instance.must_respond_to(:by=) }
69
- it { instance.must_respond_to(:bxn) }
70
- it { instance.must_respond_to(:bxn=) }
71
- it { instance.must_respond_to(:byn) }
72
- it { instance.must_respond_to(:byn=) }
73
- it { instance.must_respond_to(:ox) }
74
- it { instance.must_respond_to(:ox=) }
75
- it { instance.must_respond_to(:oy) }
76
- it { instance.must_respond_to(:oy=) }
77
- it { instance.must_respond_to(:x) }
78
- it { instance.must_respond_to(:x=) }
79
- it { instance.must_respond_to(:y) }
80
- it { instance.must_respond_to(:y=) }
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 { instance.must_respond_to(:attributes) }
38
- it { instance.must_respond_to(:data) }
39
- it { instance.must_respond_to(:data=) }
40
- it { instance.must_respond_to(:name) }
41
- it { instance.must_respond_to(:name=) }
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") }
@@ -9,7 +9,7 @@ module Vedeu
9
9
  let(:described) { Vedeu::Events::Aliases }
10
10
 
11
11
  before { described.reset }
12
- after { Vedeu::Bindings.setup! }
12
+ after { Vedeu::Bindings.setup_aliases! }
13
13
 
14
14
  describe '.add' do
15
15
  let(:alias_name) { :alias_test }
@@ -15,14 +15,16 @@ module Vedeu
15
15
  let(:offset) { 1 }
16
16
 
17
17
  describe 'accessors' do
18
- it { instance.must_respond_to(:y) }
19
- it { instance.must_respond_to(:yn) }
20
- it { instance.must_respond_to(:x) }
21
- it { instance.must_respond_to(:xn) }
22
- it { instance.must_respond_to(:top) }
23
- it { instance.must_respond_to(:bottom) }
24
- it { instance.must_respond_to(:left) }
25
- it { instance.must_respond_to(:right) }
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 { instance.must_respond_to(:centred) }
57
- it { instance.must_respond_to(:centred=) }
58
- it { instance.must_respond_to(:attributes) }
59
- it { instance.must_respond_to(:name) }
60
- it { instance.must_respond_to(:name=) }
61
- it { instance.must_respond_to(:height=) }
62
- it { instance.must_respond_to(:maximised) }
63
- it { instance.must_respond_to(:maximised?) }
64
- it { instance.must_respond_to(:maximised=) }
65
- it { instance.must_respond_to(:width=) }
66
- it { instance.must_respond_to(:x=) }
67
- it { instance.must_respond_to(:xn=) }
68
- it { instance.must_respond_to(:y=) }
69
- it { instance.must_respond_to(:yn=) }
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 { instance.must_respond_to(:y) }
16
- it { instance.must_respond_to(:first) }
17
- it { instance.must_respond_to(:x) }
18
- it { instance.must_respond_to(:last) }
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 Clear
5
+ module Groups
6
6
 
7
- describe Group do
7
+ describe Clear do
8
8
 
9
- let(:described) { Vedeu::Clear::Group }
9
+ let(:described) { Vedeu::Groups::Clear }
10
10
  let(:instance) { described.new(_name) }
11
- let(:_name) { 'Vedeu::Clear::Group' }
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::Models::Group.new(members: [_name]) }
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::Clear::Interface.expects(:render).with(_name)
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 # Group
38
+ end # Clear
39
39
 
40
- end # Clear
40
+ end # Groups
41
41
 
42
42
  end # Vedeu