vedeu 0.6.36 → 0.6.37

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +3 -3
  3. data/.yardopts +2 -0
  4. data/bin/vedeu_drb_server +0 -1
  5. data/docs/api.md +6 -2
  6. data/docs/cell.md +9 -0
  7. data/docs/chars.md +7 -0
  8. data/docs/colours_styles.md +8 -0
  9. data/docs/dsl.md +6 -2
  10. data/docs/input.md +98 -0
  11. data/docs/lines.md +8 -0
  12. data/docs/output.md +2 -0
  13. data/docs/streams.md +6 -0
  14. data/docs/template.md +3 -0
  15. data/docs/view.md +3 -6
  16. data/examples/dsl_demo_groups.rb +12 -4
  17. data/examples/dsl_hello_worlds.rb +2 -6
  18. data/lib/vedeu/distributed/templates/default_geometries.vedeu +0 -1
  19. data/lib/vedeu/dsl/view.rb +0 -1
  20. data/lib/vedeu/geometry/alignment.rb +65 -1
  21. data/lib/vedeu/geometry/area.rb +10 -15
  22. data/lib/vedeu/geometry/dimension.rb +19 -81
  23. data/lib/vedeu/geometry/dsl.rb +2 -25
  24. data/lib/vedeu/geometry/geometry.rb +6 -25
  25. data/lib/vedeu/geometry/x_dimension.rb +4 -9
  26. data/lib/vedeu/geometry/y_dimension.rb +4 -9
  27. data/lib/vedeu/null/generic.rb +0 -1
  28. data/lib/vedeu/output/renderers/file.rb +4 -0
  29. data/lib/vedeu/version.rb +1 -1
  30. data/test/lib/vedeu/geometry/alignment_test.rb +118 -0
  31. data/test/lib/vedeu/geometry/area_test.rb +0 -2
  32. data/test/lib/vedeu/geometry/dimension_test.rb +13 -19
  33. data/test/lib/vedeu/geometry/dsl_test.rb +4 -39
  34. data/test/lib/vedeu/geometry/geometry_test.rb +0 -68
  35. data/test/lib/vedeu/geometry/horizontal_alignment_test.rb +6 -0
  36. data/test/lib/vedeu/geometry/vertical_alignment_test.rb +6 -0
  37. data/test/lib/vedeu/geometry/x_dimension_test.rb +0 -2
  38. data/test/lib/vedeu/geometry/y_dimension_test.rb +0 -2
  39. data/test/lib/vedeu/null/generic_test.rb +0 -1
  40. data/test/support/examples/drb_app.rb +0 -1
  41. data/test/support/examples/hello_world.rb +1 -3
  42. data/test/support/examples/view_templates_app/view_templates_app.rb +1 -3
  43. metadata +10 -2
@@ -47,7 +47,6 @@ module Vedeu
47
47
  x_xn: x_xn,
48
48
  x_default: x_default,
49
49
  maximised: maximised,
50
- centred: centred,
51
50
  horizontal_alignment: horizontal_alignment,
52
51
  vertical_alignment: vertical_alignment,
53
52
  }
@@ -61,7 +60,6 @@ module Vedeu
61
60
  let(:x_xn) {}
62
61
  let(:x_default) {}
63
62
  let(:maximised) {}
64
- let(:centred) {}
65
63
  let(:horizontal_alignment) {}
66
64
  let(:vertical_alignment) {}
67
65
 
@@ -10,24 +10,20 @@ module Vedeu
10
10
  let(:instance) { described.new(attributes) }
11
11
  let(:attributes) {
12
12
  {
13
- d: d,
14
- dn: dn,
15
- d_dn: d_dn,
16
- default: default,
17
- maximised: maximised,
18
- centred: centred,
19
- horizontal_alignment: horizontal_alignment,
20
- vertical_alignment: vertical_alignment,
13
+ d: d,
14
+ dn: dn,
15
+ d_dn: d_dn,
16
+ default: default,
17
+ maximised: maximised,
18
+ alignment: alignment,
21
19
  }
22
20
  }
23
- let(:d) {}
24
- let(:dn) {}
25
- let(:d_dn) {}
26
- let(:default) {}
27
- let(:maximised) {}
28
- let(:centred) {}
29
- let(:horizontal_alignment) {}
30
- let(:vertical_alignment) {}
21
+ let(:d) {}
22
+ let(:dn) {}
23
+ let(:d_dn) {}
24
+ let(:default) {}
25
+ let(:maximised) {}
26
+ let(:alignment) {}
31
27
 
32
28
  describe '#initialize' do
33
29
  it { instance.must_be_instance_of(described) }
@@ -36,9 +32,7 @@ module Vedeu
36
32
  it { instance.instance_variable_get('@d_dn').must_equal(d_dn) }
37
33
  it { instance.instance_variable_get('@default').must_equal(default) }
38
34
  it { instance.instance_variable_get('@maximised').must_equal(maximised) }
39
- it { instance.instance_variable_get('@centred').must_equal(centred) }
40
- it { instance.instance_variable_get('@horizontal_alignment').must_equal(horizontal_alignment) }
41
- it { instance.instance_variable_get('@vertical_alignment').must_equal(vertical_alignment) }
35
+ it { instance.instance_variable_get('@alignment').must_equal(alignment) }
42
36
  end
43
37
 
44
38
  # describe '.pair' do
@@ -89,8 +89,8 @@ module Vedeu
89
89
 
90
90
  context 'when the height is given' do
91
91
  it { subject.must_be_instance_of(Vedeu::Geometry::Geometry) }
92
- it { subject.vertical_alignment.must_equal(:top) }
93
- it { subject.horizontal_alignment.must_equal(:left) }
92
+ it { subject.vertical_alignment.must_be_instance_of(Vedeu::Geometry::VerticalAlignment) }
93
+ it { subject.horizontal_alignment.must_be_instance_of(Vedeu::Geometry::HorizontalAlignment) }
94
94
  it { subject.height.must_equal(20) }
95
95
  it { subject.width.must_equal(20) }
96
96
  end
@@ -115,8 +115,8 @@ module Vedeu
115
115
 
116
116
  context 'when the width is given' do
117
117
  it { subject.must_be_instance_of(Vedeu::Geometry::Geometry) }
118
- it { subject.vertical_alignment.must_equal(:top) }
119
- it { subject.horizontal_alignment.must_equal(:left) }
118
+ it { subject.vertical_alignment.must_be_instance_of(Vedeu::Geometry::VerticalAlignment) }
119
+ it { subject.horizontal_alignment.must_be_instance_of(Vedeu::Geometry::HorizontalAlignment) }
120
120
  it { subject.height.must_equal(20) }
121
121
  it { subject.width.must_equal(20) }
122
122
  end
@@ -277,41 +277,6 @@ module Vedeu
277
277
  end
278
278
  end
279
279
 
280
- describe '#centred' do
281
- subject { instance.centred(true) }
282
-
283
- it { instance.must_respond_to(:centred!) }
284
- it { instance.must_respond_to(:centred=) }
285
-
286
- it 'sets the attribute to the value' do
287
- subject.must_equal(true)
288
- end
289
-
290
- context 'DSL #centred' do
291
- subject {
292
- Vedeu.geometry 'geometry' do
293
- centred false
294
- end
295
- }
296
-
297
- it { subject.must_be_instance_of(Vedeu::Geometry::Geometry) }
298
-
299
- it 'allows the use of centred within geometry' do
300
- subject.centred.must_equal(false)
301
- end
302
-
303
- context 'when no value is given' do
304
- subject {
305
- Vedeu.geometry 'geometry' do
306
- centred
307
- end
308
- }
309
-
310
- it { subject.centred.must_equal(true) }
311
- end
312
- end
313
- end
314
-
315
280
  describe '#columns' do
316
281
  before { Vedeu::Terminal.stubs(:size).returns([25, 80]) }
317
282
 
@@ -10,7 +10,6 @@ module Vedeu
10
10
  let(:instance) { described.new(attributes) }
11
11
  let(:attributes) {
12
12
  {
13
- centred: centred,
14
13
  client: client,
15
14
  height: height,
16
15
  horizontal_alignment: horizontal_alignment,
@@ -25,7 +24,6 @@ module Vedeu
25
24
  yn: yn,
26
25
  }
27
26
  }
28
- let(:centred) { false }
29
27
  let(:client) {}
30
28
  let(:height) {}
31
29
  let(:horizontal_alignment) {}
@@ -42,7 +40,6 @@ module Vedeu
42
40
 
43
41
  describe '#initialize' do
44
42
  it { instance.must_be_instance_of(described) }
45
- it { instance.instance_variable_get('@centred').must_equal(centred) }
46
43
  it { instance.instance_variable_get('@client').must_equal(client) }
47
44
  it { instance.instance_variable_get('@height').must_equal(height) }
48
45
  it { instance.instance_variable_get('@horizontal_alignment').must_equal(horizontal_alignment) }
@@ -62,8 +59,6 @@ module Vedeu
62
59
 
63
60
  describe 'accessors' do
64
61
  it {
65
- instance.must_respond_to(:centred)
66
- instance.must_respond_to(:centred=)
67
62
  instance.must_respond_to(:name)
68
63
  instance.must_respond_to(:name=)
69
64
  instance.must_respond_to(:height=)
@@ -259,69 +254,6 @@ module Vedeu
259
254
  end
260
255
 
261
256
  describe '#top, #right, #bottom, #left' do
262
- context 'maximised is true' do
263
- let(:attributes) { { maximised: true } }
264
-
265
- it { instance.top.must_equal(1) }
266
- it { instance.right.must_equal(40) }
267
- it { instance.bottom.must_equal(12) }
268
- it { instance.left.must_equal(1) }
269
- end
270
-
271
- context 'centred is true' do
272
- let(:attributes) { { height: 6, width: 18, centred: true } }
273
-
274
- it { instance.top.must_equal(3) }
275
- it { instance.right.must_equal(29) }
276
- it { instance.bottom.must_equal(9) }
277
- it { instance.left.must_equal(11) }
278
- end
279
-
280
- context 'centred is true and y is set, y is ignored' do
281
- let(:attributes) { { height: 6, width: 18, centred: true, y: 4 } }
282
-
283
- it { instance.top.must_equal(3) }
284
- it { instance.right.must_equal(29) }
285
- it { instance.bottom.must_equal(9) }
286
- it { instance.left.must_equal(11) }
287
- end
288
-
289
- context 'centred is true and x is set, x is ignored' do
290
- let(:attributes) { { height: 6, width: 18, centred: true, x: 4 } }
291
-
292
- it { instance.top.must_equal(3) }
293
- it { instance.right.must_equal(29) }
294
- it { instance.bottom.must_equal(9) }
295
- it { instance.left.must_equal(11) }
296
- end
297
-
298
- context 'centred is false' do
299
- let(:attributes) { { height: 6, width: 18 } }
300
-
301
- it { instance.top.must_equal(1) }
302
- it { instance.right.must_equal(18) }
303
- it { instance.bottom.must_equal(6) }
304
- it { instance.left.must_equal(1) }
305
- end
306
-
307
- context 'centred is false and y is set' do
308
- let(:attributes) { { height: 6, width: 18, y: 4 } }
309
-
310
- it { instance.top.must_equal(4) }
311
- it { instance.right.must_equal(18) }
312
- it { instance.bottom.must_equal(9) }
313
- it { instance.left.must_equal(1) }
314
- end
315
-
316
- context 'centred is false and x is set' do
317
- let(:attributes) { { height: 6, width: 18, x: 4 } }
318
-
319
- it { instance.top.must_equal(1) }
320
- it { instance.right.must_equal(21) }
321
- it { instance.bottom.must_equal(6) }
322
- it { instance.left.must_equal(4) }
323
- end
324
-
325
257
  context 'maximised' do
326
258
  let(:attributes) { { maximised: true } }
327
259
 
@@ -13,6 +13,12 @@ module Vedeu
13
13
  describe '.align' do
14
14
  subject { described.align(_value) }
15
15
 
16
+ context 'when the value is :none' do
17
+ let(:_value) { :none }
18
+
19
+ it { subject.must_equal(:none) }
20
+ end
21
+
16
22
  context 'when the value is nil' do
17
23
  it { subject.must_equal(:none) }
18
24
  end
@@ -13,6 +13,12 @@ module Vedeu
13
13
  describe '.align' do
14
14
  subject { described.align(_value) }
15
15
 
16
+ context 'when the value is :none' do
17
+ let(:_value) { :none }
18
+
19
+ it { subject.must_equal(:none) }
20
+ end
21
+
16
22
  context 'when the value is nil' do
17
23
  it { subject.must_equal(:none) }
18
24
  end
@@ -15,7 +15,6 @@ module Vedeu
15
15
  d_dn: d_dn,
16
16
  default: default,
17
17
  maximised: maximised,
18
- centred: centred,
19
18
  horizontal_alignment: horizontal_alignment,
20
19
  vertical_alignment: vertical_alignment,
21
20
  }
@@ -25,7 +24,6 @@ module Vedeu
25
24
  let(:d_dn) {}
26
25
  let(:default) { Vedeu.width }
27
26
  let(:maximised) {}
28
- let(:centred) {}
29
27
  let(:horizontal_alignment) {}
30
28
  let(:vertical_alignment) {}
31
29
 
@@ -15,7 +15,6 @@ module Vedeu
15
15
  d_dn: d_dn,
16
16
  default: default,
17
17
  maximised: maximised,
18
- centred: centred,
19
18
  horizontal_alignment: horizontal_alignment,
20
19
  vertical_alignment: vertical_alignment,
21
20
  }
@@ -25,7 +24,6 @@ module Vedeu
25
24
  let(:d_dn) {}
26
25
  let(:default) { Vedeu.height }
27
26
  let(:maximised) {}
28
- let(:centred) {}
29
27
  let(:horizontal_alignment) {}
30
28
  let(:vertical_alignment) {}
31
29
 
@@ -43,7 +43,6 @@ module Vedeu
43
43
 
44
44
  it { subject.must_be_instance_of(FalseClass) }
45
45
 
46
- it { instance.must_respond_to(:centred) }
47
46
  it { instance.must_respond_to(:maximise) }
48
47
  it { instance.must_respond_to(:maximised?) }
49
48
  it { instance.must_respond_to(:unmaximise) }
@@ -67,7 +67,6 @@ class VedeuTestApplication
67
67
  end
68
68
 
69
69
  Vedeu.geometry 'test_interface' do
70
- # centred!
71
70
  height 6
72
71
  width 26
73
72
  x 4
@@ -25,9 +25,7 @@ class HelloWorldApp
25
25
  background '#000000'
26
26
  foreground '#00ff00'
27
27
  geometry do
28
- centred!
29
- height 5
30
- width 20
28
+ align(:middle, :centre, 20, 5)
31
29
  end
32
30
  keymap do
33
31
  key('q') { Vedeu.exit }
@@ -53,9 +53,7 @@ class VedeuViewTemplateApp
53
53
  end
54
54
 
55
55
  Vedeu.geometry('prune') do
56
- centred!
57
- height 6
58
- width 25
56
+ align(:middle, :centre, 25, 6)
59
57
  end
60
58
 
61
59
  Vedeu.geometry 'default' do
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.36
4
+ version: 0.6.37
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-10-21 00:00:00.000000000 Z
11
+ date: 2015-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -265,6 +265,9 @@ files:
265
265
  - docs/api.md
266
266
  - docs/borders.md
267
267
  - docs/buffer.md
268
+ - docs/cell.md
269
+ - docs/chars.md
270
+ - docs/colours_styles.md
268
271
  - docs/configuration.md
269
272
  - docs/cursors.md
270
273
  - docs/dsl.md
@@ -282,9 +285,14 @@ files:
282
285
  - docs/geometry.md
283
286
  - docs/getting_started.md
284
287
  - docs/group.md
288
+ - docs/input.md
285
289
  - docs/interfaces.md
286
290
  - docs/keymaps.md
291
+ - docs/lines.md
287
292
  - docs/object_graph.md
293
+ - docs/output.md
294
+ - docs/streams.md
295
+ - docs/template.md
288
296
  - docs/view.md
289
297
  - examples/dsl_alignment.rb
290
298
  - examples/dsl_demo_groups.rb