vedeu 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/examples/borders_app.rb +15 -14
  3. data/examples/colours_app.rb +1 -2
  4. data/examples/cursor_app.rb +2 -5
  5. data/examples/geometry_app.rb +141 -0
  6. data/lib/vedeu.rb +0 -17
  7. data/lib/vedeu/api.rb +18 -3
  8. data/lib/vedeu/buffers/all.rb +0 -6
  9. data/lib/vedeu/buffers/buffer.rb +5 -2
  10. data/lib/vedeu/cursor/all.rb +0 -13
  11. data/lib/vedeu/cursor/cursor.rb +1 -1
  12. data/lib/vedeu/dsl/components/border.rb +94 -12
  13. data/lib/vedeu/dsl/components/geometry.rb +40 -48
  14. data/lib/vedeu/dsl/components/keymap.rb +36 -0
  15. data/lib/vedeu/dsl/interface.rb +20 -5
  16. data/lib/vedeu/dsl/stream.rb +2 -0
  17. data/lib/vedeu/events/all.rb +0 -5
  18. data/lib/vedeu/events/event.rb +2 -1
  19. data/lib/vedeu/events/trigger.rb +1 -3
  20. data/lib/vedeu/input/all.rb +7 -12
  21. data/lib/vedeu/input/keymap.rb +10 -34
  22. data/lib/vedeu/input/keys.rb +1 -0
  23. data/lib/vedeu/input/mapper.rb +1 -5
  24. data/lib/vedeu/models/collection.rb +4 -0
  25. data/lib/vedeu/models/geometry.rb +2 -1
  26. data/lib/vedeu/models/model.rb +4 -0
  27. data/lib/vedeu/models/view/char.rb +10 -0
  28. data/lib/vedeu/models/view/chars.rb +3 -2
  29. data/lib/vedeu/models/view/interface.rb +18 -28
  30. data/lib/vedeu/models/view/interfaces.rb +3 -2
  31. data/lib/vedeu/models/view/lines.rb +3 -2
  32. data/lib/vedeu/models/view/stream.rb +1 -1
  33. data/lib/vedeu/models/view/streams.rb +3 -2
  34. data/lib/vedeu/output/border.rb +29 -21
  35. data/lib/vedeu/output/compositor.rb +2 -3
  36. data/lib/vedeu/output/output.rb +5 -1
  37. data/lib/vedeu/output/viewport.rb +45 -24
  38. data/lib/vedeu/output/wordwrap.rb +7 -1
  39. data/lib/vedeu/output/writer.rb +3 -0
  40. data/lib/vedeu/presentation/presentation.rb +2 -0
  41. data/lib/vedeu/repositories/all.rb +107 -1
  42. data/lib/vedeu/repositories/repository.rb +4 -0
  43. data/lib/vedeu/support/bounding_area.rb +1 -1
  44. data/lib/vedeu/support/position_validator.rb +18 -0
  45. data/test/lib/vedeu/buffers/buffer_test.rb +8 -8
  46. data/test/lib/vedeu/cursor/move_cursor_test.rb +3 -6
  47. data/test/lib/vedeu/dsl/components/border_test.rb +53 -4
  48. data/test/lib/vedeu/dsl/components/geometry_test.rb +0 -24
  49. data/test/lib/vedeu/dsl/interface_test.rb +11 -3
  50. data/test/lib/vedeu/events/event_test.rb +2 -2
  51. data/test/lib/vedeu/models/view/interface_test.rb +1 -25
  52. data/test/lib/vedeu/models/view/stream_test.rb +8 -0
  53. data/test/lib/vedeu/output/border_test.rb +159 -81
  54. data/test/lib/vedeu/output/output_test.rb +1 -2
  55. data/test/lib/vedeu/output/viewport_test.rb +3 -10
  56. data/test/lib/vedeu/repositories/all_test.rb +128 -0
  57. data/test/lib/vedeu/support/content_geometry_test.rb +1 -2
  58. data/vedeu.gemspec +1 -1
  59. metadata +3 -13
  60. data/lib/vedeu/repositories/menus.rb +0 -13
  61. data/test/lib/vedeu/buffers/all_test.rb +0 -11
  62. data/test/lib/vedeu/cursor/all_test.rb +0 -33
  63. data/test/lib/vedeu/events/all_test.rb +0 -11
  64. data/test/lib/vedeu/input/all_test.rb +0 -11
  65. data/test/lib/vedeu/repositories/menus_test.rb +0 -15
@@ -6,12 +6,11 @@ module Vedeu
6
6
 
7
7
  let(:described) { Output.new(interface) }
8
8
  let(:interface) {
9
- Interface.build do
9
+ Vedeu.interface 'flourine' do
10
10
  geometry do
11
11
  height 3
12
12
  width 32
13
13
  end
14
- name 'flourine'
15
14
  end
16
15
  }
17
16
  let(:lines) {
@@ -7,7 +7,7 @@ module Vedeu
7
7
  let(:described) { Vedeu::Viewport }
8
8
  let(:instance) { described.new(interface) }
9
9
  let(:interface) {
10
- Vedeu::Interface.build do
10
+ Vedeu.interface 'lithium' do
11
11
  geometry do
12
12
  height 3
13
13
  width 3
@@ -20,7 +20,6 @@ module Vedeu
20
20
  line 'nickel'
21
21
  line 'osmium'
22
22
  end
23
- name 'lithium'
24
23
  end
25
24
  }
26
25
 
@@ -31,13 +30,7 @@ module Vedeu
31
30
  it { subject.instance_variable_get('@interface').must_equal(interface) }
32
31
  end
33
32
 
34
- describe '.show' do
35
- subject { described.show(interface) }
36
-
37
- it { subject.must_be_instance_of(Array) }
38
- end
39
-
40
- describe '#show' do
33
+ describe '#render' do
41
34
  let(:cursor) { Cursor.new(cursor_attributes) }
42
35
  let(:cursor_attributes) {
43
36
  { name: 'lithium', ox: ox, oy: oy, state: true, x: x, y: y }
@@ -52,7 +45,7 @@ module Vedeu
52
45
  interface.stubs(:cursor).returns(cursor)
53
46
  end
54
47
 
55
- subject { instance.show }
48
+ subject { instance.render }
56
49
 
57
50
  it { subject.must_be_instance_of(Array) }
58
51
 
@@ -2,6 +2,134 @@ require 'test_helper'
2
2
 
3
3
  module Vedeu
4
4
 
5
+ describe Borders do
5
6
 
7
+ let(:described) { Vedeu::Borders }
8
+
9
+ describe '.borders' do
10
+ subject { described.borders }
11
+
12
+ it { subject.must_be_instance_of(described) }
13
+ end
14
+
15
+ end # Borders
16
+
17
+ describe Buffers do
18
+
19
+ let(:described) { Vedeu::Buffers }
20
+
21
+ describe '.buffers' do
22
+ subject { described.buffers }
23
+
24
+ it { subject.must_be_instance_of(described) }
25
+ end
26
+
27
+ end # Buffers
28
+
29
+ describe Cursors do
30
+
31
+ let(:described) { Vedeu::Cursors }
32
+
33
+ describe '.cursors' do
34
+ subject { described.cursors }
35
+
36
+ it { subject.must_be_instance_of(described) }
37
+ end
38
+
39
+ describe '.cursor' do
40
+ subject { Vedeu.cursor }
41
+
42
+ context 'when there are cursors are defined' do
43
+ before do
44
+ Vedeu::Focus.add('Vedeu.cursor')
45
+ Vedeu::Cursor.new({ name: 'Vedeu.cursor' }).store
46
+ end
47
+
48
+ it { subject.must_be_instance_of(Vedeu::Cursor) }
49
+ end
50
+
51
+ context 'when there are no cursors defined' do
52
+ before do
53
+ Vedeu::Focus.reset
54
+ Vedeu.cursors.reset
55
+ end
56
+
57
+ it { subject.must_be_instance_of(NilClass) }
58
+ end
59
+ end
60
+
61
+ end # Cursors
62
+
63
+ describe Events do
64
+
65
+ let(:described) { Vedeu::Events }
66
+
67
+ describe '.events' do
68
+ subject { described.events }
69
+
70
+ it { subject.must_be_instance_of(described) }
71
+ end
72
+
73
+ end # Events
74
+
75
+ describe Geometries do
76
+
77
+ let(:described) { Vedeu::Geometries }
78
+
79
+ describe '.geometries' do
80
+ subject { described.geometries }
81
+
82
+ it { subject.must_be_instance_of(described) }
83
+ end
84
+
85
+ end # Geometries
86
+
87
+ describe Groups do
88
+
89
+ let(:described) { Vedeu::Groups }
90
+
91
+ describe '.groups' do
92
+ subject { described.groups }
93
+
94
+ it { subject.must_be_instance_of(described) }
95
+ end
96
+
97
+ end # Groups
98
+
99
+ describe InterfacesRepository do
100
+
101
+ let(:described) { Vedeu::InterfacesRepository }
102
+
103
+ describe '.interfaces' do
104
+ subject { described.interfaces }
105
+
106
+ it { subject.must_be_instance_of(described) }
107
+ end
108
+
109
+ end # InterfacesRepository
110
+
111
+ describe Keymaps do
112
+
113
+ let(:described) { Vedeu::Keymaps }
114
+
115
+ describe '.keymaps' do
116
+ subject { described.keymaps }
117
+
118
+ it { subject.must_be_instance_of(described) }
119
+ end
120
+
121
+ end # Keymaps
122
+
123
+ describe Menus do
124
+
125
+ let(:described) { Vedeu::Menus }
126
+
127
+ describe '.menus' do
128
+ subject { described.menus }
129
+
130
+ it { subject.must_be_instance_of(described) }
131
+ end
132
+
133
+ end # Menus
6
134
 
7
135
  end # Vedeu
@@ -7,12 +7,11 @@ module Vedeu
7
7
  let(:described) { Vedeu::ContentGeometry }
8
8
  let(:instance) { described.new(interface) }
9
9
  let(:interface) {
10
- Vedeu::Interface.build do
10
+ Vedeu.interface 'content_geometry' do
11
11
  geometry do
12
12
  height 3
13
13
  width 5
14
14
  end
15
- name 'content_geometry'
16
15
  end
17
16
  }
18
17
  let(:lines) { [] }
data/vedeu.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'vedeu'
7
- spec.version = '0.3.1'
7
+ spec.version = '0.3.2'
8
8
  spec.authors = ['Gavin Laking']
9
9
  spec.email = ['gavinlaking@gmail.com']
10
10
  spec.summary = %q{A terminal case of wonderland.}
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.3.1
4
+ version: 0.3.2
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-02-13 00:00:00.000000000 Z
11
+ date: 2015-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aruba
@@ -266,6 +266,7 @@ files:
266
266
  - examples/configuration_app.rb
267
267
  - examples/cursor_app.rb
268
268
  - examples/focus_app.rb
269
+ - examples/geometry_app.rb
269
270
  - examples/hello_world.rb
270
271
  - examples/lines_app.rb
271
272
  - features/start_stop.feature
@@ -345,7 +346,6 @@ files:
345
346
  - lib/vedeu/presentation/style.rb
346
347
  - lib/vedeu/presentation/translator.rb
347
348
  - lib/vedeu/repositories/all.rb
348
- - lib/vedeu/repositories/menus.rb
349
349
  - lib/vedeu/repositories/repository.rb
350
350
  - lib/vedeu/support/all.rb
351
351
  - lib/vedeu/support/bounding_area.rb
@@ -380,13 +380,11 @@ files:
380
380
  - test/lib/vedeu/api_test.rb
381
381
  - test/lib/vedeu/application_test.rb
382
382
  - test/lib/vedeu/bindings_test.rb
383
- - test/lib/vedeu/buffers/all_test.rb
384
383
  - test/lib/vedeu/buffers/buffer_test.rb
385
384
  - test/lib/vedeu/buffers/display_buffer_test.rb
386
385
  - test/lib/vedeu/configuration/api_test.rb
387
386
  - test/lib/vedeu/configuration/cli_test.rb
388
387
  - test/lib/vedeu/configuration/configuration_test.rb
389
- - test/lib/vedeu/cursor/all_test.rb
390
388
  - test/lib/vedeu/cursor/cursor_test.rb
391
389
  - test/lib/vedeu/cursor/move_cursor_test.rb
392
390
  - test/lib/vedeu/cursor/toggle_cursor_test.rb
@@ -403,10 +401,8 @@ files:
403
401
  - test/lib/vedeu/dsl/shared/use_test.rb
404
402
  - test/lib/vedeu/dsl/stream_test.rb
405
403
  - test/lib/vedeu/dsl/view_test.rb
406
- - test/lib/vedeu/events/all_test.rb
407
404
  - test/lib/vedeu/events/event_test.rb
408
405
  - test/lib/vedeu/events/trigger_test.rb
409
- - test/lib/vedeu/input/all_test.rb
410
406
  - test/lib/vedeu/input/input_test.rb
411
407
  - test/lib/vedeu/input/key_test.rb
412
408
  - test/lib/vedeu/input/keymap_test.rb
@@ -440,7 +436,6 @@ files:
440
436
  - test/lib/vedeu/presentation/style_test.rb
441
437
  - test/lib/vedeu/presentation/translator_test.rb
442
438
  - test/lib/vedeu/repositories/all_test.rb
443
- - test/lib/vedeu/repositories/menus_test.rb
444
439
  - test/lib/vedeu/repositories/repository_test.rb
445
440
  - test/lib/vedeu/support/bounding_area_test.rb
446
441
  - test/lib/vedeu/support/coercions_test.rb
@@ -511,13 +506,11 @@ test_files:
511
506
  - test/lib/vedeu/api_test.rb
512
507
  - test/lib/vedeu/application_test.rb
513
508
  - test/lib/vedeu/bindings_test.rb
514
- - test/lib/vedeu/buffers/all_test.rb
515
509
  - test/lib/vedeu/buffers/buffer_test.rb
516
510
  - test/lib/vedeu/buffers/display_buffer_test.rb
517
511
  - test/lib/vedeu/configuration/api_test.rb
518
512
  - test/lib/vedeu/configuration/cli_test.rb
519
513
  - test/lib/vedeu/configuration/configuration_test.rb
520
- - test/lib/vedeu/cursor/all_test.rb
521
514
  - test/lib/vedeu/cursor/cursor_test.rb
522
515
  - test/lib/vedeu/cursor/move_cursor_test.rb
523
516
  - test/lib/vedeu/cursor/toggle_cursor_test.rb
@@ -534,10 +527,8 @@ test_files:
534
527
  - test/lib/vedeu/dsl/shared/use_test.rb
535
528
  - test/lib/vedeu/dsl/stream_test.rb
536
529
  - test/lib/vedeu/dsl/view_test.rb
537
- - test/lib/vedeu/events/all_test.rb
538
530
  - test/lib/vedeu/events/event_test.rb
539
531
  - test/lib/vedeu/events/trigger_test.rb
540
- - test/lib/vedeu/input/all_test.rb
541
532
  - test/lib/vedeu/input/input_test.rb
542
533
  - test/lib/vedeu/input/key_test.rb
543
534
  - test/lib/vedeu/input/keymap_test.rb
@@ -571,7 +562,6 @@ test_files:
571
562
  - test/lib/vedeu/presentation/style_test.rb
572
563
  - test/lib/vedeu/presentation/translator_test.rb
573
564
  - test/lib/vedeu/repositories/all_test.rb
574
- - test/lib/vedeu/repositories/menus_test.rb
575
565
  - test/lib/vedeu/repositories/repository_test.rb
576
566
  - test/lib/vedeu/support/bounding_area_test.rb
577
567
  - test/lib/vedeu/support/coercions_test.rb
@@ -1,13 +0,0 @@
1
- require 'vedeu/repositories/repository'
2
-
3
- module Vedeu
4
-
5
- class Menus < Repository
6
-
7
- def self.menus
8
- @_menus ||= Vedeu::Menus.new(Vedeu::Menu)
9
- end
10
-
11
- end # Menus
12
-
13
- end # Vedeu
@@ -1,11 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Vedeu
4
-
5
- describe '.buffers' do
6
- subject { Vedeu.buffers }
7
-
8
- it { subject.must_be_instance_of(Vedeu::Repository) }
9
- end
10
-
11
- end # Vedeu
@@ -1,33 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Vedeu
4
-
5
- describe '.cursor' do
6
- subject { Vedeu.cursor }
7
-
8
- context 'when there are cursors are defined' do
9
- before do
10
- Vedeu::Focus.add('Vedeu.cursor')
11
- Vedeu::Cursor.new({ name: 'Vedeu.cursor' }).store
12
- end
13
-
14
- it { subject.must_be_instance_of(Vedeu::Cursor) }
15
- end
16
-
17
- context 'when there are no cursors defined' do
18
- before do
19
- Vedeu::Focus.reset
20
- Vedeu.cursors.reset
21
- end
22
-
23
- it { subject.must_be_instance_of(NilClass) }
24
- end
25
- end
26
-
27
- describe '.cursors' do
28
- subject { Vedeu.cursors }
29
-
30
- it { subject.must_be_instance_of(Vedeu::Repository) }
31
- end
32
-
33
- end # Vedeu
@@ -1,11 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Vedeu
4
-
5
- describe '.events' do
6
- subject { Vedeu.events }
7
-
8
- it { subject.must_be_instance_of(Vedeu::Repository) }
9
- end
10
-
11
- end # Vedeu
@@ -1,11 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Vedeu
4
-
5
- describe '.keymaps' do
6
- subject { Vedeu.keymaps }
7
-
8
- it { subject.must_be_instance_of(Vedeu::Repository) }
9
- end
10
-
11
- end # Vedeu
@@ -1,15 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Vedeu
4
-
5
- describe Menus do
6
-
7
- describe '.menus' do
8
- subject { Vedeu::Menus.menus }
9
-
10
- it { subject.must_be_instance_of(Vedeu::Menus) }
11
- end
12
-
13
- end # Menus
14
-
15
- end # Vedeu