vedeu 0.6.28 → 0.6.29

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/README.md +1 -0
  4. data/docs/dsl.md +4 -4
  5. data/docs/keymaps.md +25 -0
  6. data/lib/vedeu/all.rb +1 -1
  7. data/lib/vedeu/borders/border.rb +1 -1
  8. data/lib/vedeu/borders/refresh.rb +1 -1
  9. data/lib/vedeu/common.rb +1 -1
  10. data/lib/vedeu/dsl/all.rb +0 -2
  11. data/lib/vedeu/dsl/presentation.rb +1 -1
  12. data/lib/vedeu/dsl/shared.rb +1 -1
  13. data/lib/vedeu/dsl/text.rb +1 -1
  14. data/lib/vedeu/dsl/view.rb +11 -13
  15. data/lib/vedeu/editor/cropper.rb +1 -1
  16. data/lib/vedeu/editor/document.rb +6 -8
  17. data/lib/vedeu/geometry/geometry.rb +6 -0
  18. data/lib/vedeu/geometry/position.rb +2 -0
  19. data/lib/vedeu/groups/group.rb +1 -1
  20. data/lib/vedeu/input/all.rb +1 -0
  21. data/lib/vedeu/{dsl/keymap.rb → input/dsl.rb} +6 -6
  22. data/lib/vedeu/interfaces/all.rb +12 -0
  23. data/lib/vedeu/{dsl/interface.rb → interfaces/dsl.rb} +10 -10
  24. data/lib/vedeu/{models → interfaces}/interface.rb +6 -6
  25. data/lib/vedeu/{null/interface.rb → interfaces/null.rb} +6 -6
  26. data/lib/vedeu/{models/interfaces.rb → interfaces/repository.rb} +10 -10
  27. data/lib/vedeu/logging/log.rb +18 -12
  28. data/lib/vedeu/models/focus.rb +1 -1
  29. data/lib/vedeu/models/toggleable.rb +1 -1
  30. data/lib/vedeu/models/views/all.rb +0 -2
  31. data/lib/vedeu/models/views/composition.rb +12 -7
  32. data/lib/vedeu/models/views/line.rb +1 -0
  33. data/lib/vedeu/models/views/stream.rb +1 -0
  34. data/lib/vedeu/null/all.rb +0 -1
  35. data/lib/vedeu/output/clear/interface.rb +1 -1
  36. data/lib/vedeu/output/output.rb +28 -10
  37. data/lib/vedeu/output/refresh/refresh.rb +1 -1
  38. data/lib/vedeu/output/renderers/all.rb +11 -2
  39. data/lib/vedeu/output/text.rb +9 -2
  40. data/lib/vedeu/repositories/model.rb +9 -7
  41. data/lib/vedeu/repositories/repositories.rb +7 -7
  42. data/lib/vedeu/runtime/main_loop.rb +2 -0
  43. data/lib/vedeu/templating/view_template.rb +1 -1
  44. data/lib/vedeu/terminal/buffer.rb +2 -0
  45. data/lib/vedeu/version.rb +1 -1
  46. data/test/lib/vedeu/borders/refresh_test.rb +1 -1
  47. data/test/lib/vedeu/dsl/presentation_test.rb +2 -2
  48. data/test/lib/vedeu/dsl/text_test.rb +2 -1
  49. data/test/lib/vedeu/editor/cropper_test.rb +1 -1
  50. data/test/lib/vedeu/editor/document_test.rb +1 -1
  51. data/test/lib/vedeu/geometry/geometry_test.rb +3 -0
  52. data/test/lib/vedeu/groups/group_test.rb +3 -3
  53. data/test/lib/vedeu/{dsl/keymap_test.rb → input/dsl_test.rb} +5 -5
  54. data/test/lib/vedeu/{dsl/interface_test.rb → interfaces/dsl_test.rb} +7 -7
  55. data/test/lib/vedeu/{models → interfaces}/interface_test.rb +3 -3
  56. data/test/lib/vedeu/{null/interface_test.rb → interfaces/null_test.rb} +5 -5
  57. data/test/lib/vedeu/{models/interfaces_test.rb → interfaces/repository_test.rb} +5 -5
  58. data/test/lib/vedeu/logging/log_test.rb +2 -2
  59. data/test/lib/vedeu/models/views/view_test.rb +1 -1
  60. data/test/lib/vedeu/output/clear/interface_test.rb +1 -1
  61. data/test/lib/vedeu/output/output_test.rb +5 -10
  62. data/test/lib/vedeu/output/presentation/presentation_test.rb +1 -1
  63. data/test/lib/vedeu/output/refresh/refresh_test.rb +1 -1
  64. data/test/lib/vedeu/output/renderers/all_test.rb +2 -0
  65. data/test/lib/vedeu/output/viewport_test.rb +1 -1
  66. data/test/lib/vedeu/terminal/buffer_test.rb +1 -1
  67. data/test/test_helper.rb +1 -0
  68. metadata +19 -20
  69. data/lib/vedeu/output/direct.rb +0 -64
  70. data/test/lib/vedeu/output/direct_test.rb +0 -76
@@ -22,7 +22,7 @@ module Vedeu
22
22
  }
23
23
  let(:visible) { true }
24
24
  let(:interface) {
25
- Vedeu::Models::Interface.new(style: nil, visible: visible)
25
+ Vedeu::Interfaces::Interface.new(style: nil, visible: visible)
26
26
  }
27
27
  let(:geometry) { Vedeu::Geometry::Geometry.new(height: 3, width: 3) }
28
28
  let(:ready) { true }
@@ -47,7 +47,7 @@ module Vedeu
47
47
  end
48
48
 
49
49
  describe '#render' do
50
- let(:ready) { false }
50
+ let(:ready) { false }
51
51
 
52
52
  before do
53
53
  Vedeu.stubs(:ready?).returns(ready)
data/test/test_helper.rb CHANGED
@@ -31,6 +31,7 @@ unless ENV['NO_SIMPLECOV']
31
31
  add_group 'geometry', 'vedeu/geometry'
32
32
  add_group 'groups', 'vedeu/groups'
33
33
  add_group 'input', 'vedeu/input'
34
+ add_group 'interfaces', 'vedeu/interfaces'
34
35
  add_group 'logging', 'vedeu/logging'
35
36
  add_group 'menus', 'vedeu/menus'
36
37
  add_group 'models', 'vedeu/models'
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.28
4
+ version: 0.6.29
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-07 00:00:00.000000000 Z
11
+ date: 2015-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -283,6 +283,7 @@ files:
283
283
  - docs/getting_started.md
284
284
  - docs/group.md
285
285
  - docs/interfaces.md
286
+ - docs/keymaps.md
286
287
  - docs/object_graph.md
287
288
  - docs/view.md
288
289
  - examples/demo_groups.rb
@@ -353,8 +354,6 @@ files:
353
354
  - lib/vedeu/dsl/all.rb
354
355
  - lib/vedeu/dsl/composition.rb
355
356
  - lib/vedeu/dsl/dsl.rb
356
- - lib/vedeu/dsl/interface.rb
357
- - lib/vedeu/dsl/keymap.rb
358
357
  - lib/vedeu/dsl/line.rb
359
358
  - lib/vedeu/dsl/presentation.rb
360
359
  - lib/vedeu/dsl/shared.rb
@@ -403,12 +402,18 @@ files:
403
402
  - lib/vedeu/groups/repository.rb
404
403
  - lib/vedeu/input/all.rb
405
404
  - lib/vedeu/input/capture.rb
405
+ - lib/vedeu/input/dsl.rb
406
406
  - lib/vedeu/input/key.rb
407
407
  - lib/vedeu/input/keymap.rb
408
408
  - lib/vedeu/input/keymaps.rb
409
409
  - lib/vedeu/input/mapper.rb
410
410
  - lib/vedeu/input/store.rb
411
411
  - lib/vedeu/input/translator.rb
412
+ - lib/vedeu/interfaces/all.rb
413
+ - lib/vedeu/interfaces/dsl.rb
414
+ - lib/vedeu/interfaces/interface.rb
415
+ - lib/vedeu/interfaces/null.rb
416
+ - lib/vedeu/interfaces/repository.rb
412
417
  - lib/vedeu/logging/all.rb
413
418
  - lib/vedeu/logging/debug.rb
414
419
  - lib/vedeu/logging/lockless_log_device.rb
@@ -424,8 +429,6 @@ files:
424
429
  - lib/vedeu/models/cell.rb
425
430
  - lib/vedeu/models/escape.rb
426
431
  - lib/vedeu/models/focus.rb
427
- - lib/vedeu/models/interface.rb
428
- - lib/vedeu/models/interfaces.rb
429
432
  - lib/vedeu/models/page.rb
430
433
  - lib/vedeu/models/row.rb
431
434
  - lib/vedeu/models/toggleable.rb
@@ -438,13 +441,11 @@ files:
438
441
  - lib/vedeu/models/views/view.rb
439
442
  - lib/vedeu/null/all.rb
440
443
  - lib/vedeu/null/generic.rb
441
- - lib/vedeu/null/interface.rb
442
444
  - lib/vedeu/null/view.rb
443
445
  - lib/vedeu/options.rb
444
446
  - lib/vedeu/output/clear/all.rb
445
447
  - lib/vedeu/output/clear/interface.rb
446
448
  - lib/vedeu/output/compressor.rb
447
- - lib/vedeu/output/direct.rb
448
449
  - lib/vedeu/output/output.rb
449
450
  - lib/vedeu/output/presentation/all.rb
450
451
  - lib/vedeu/output/presentation/colour.rb
@@ -541,8 +542,6 @@ files:
541
542
  - test/lib/vedeu/distributed/uri_test.rb
542
543
  - test/lib/vedeu/dsl/composition_test.rb
543
544
  - test/lib/vedeu/dsl/dsl_test.rb
544
- - test/lib/vedeu/dsl/interface_test.rb
545
- - test/lib/vedeu/dsl/keymap_test.rb
546
545
  - test/lib/vedeu/dsl/line_test.rb
547
546
  - test/lib/vedeu/dsl/presentation_test.rb
548
547
  - test/lib/vedeu/dsl/shared_test.rb
@@ -585,12 +584,17 @@ files:
585
584
  - test/lib/vedeu/groups/refresh_test.rb
586
585
  - test/lib/vedeu/groups/repository_test.rb
587
586
  - test/lib/vedeu/input/capture_test.rb
587
+ - test/lib/vedeu/input/dsl_test.rb
588
588
  - test/lib/vedeu/input/key_test.rb
589
589
  - test/lib/vedeu/input/keymap_test.rb
590
590
  - test/lib/vedeu/input/keymaps_test.rb
591
591
  - test/lib/vedeu/input/mapper_test.rb
592
592
  - test/lib/vedeu/input/store_test.rb
593
593
  - test/lib/vedeu/input/translator_test.rb
594
+ - test/lib/vedeu/interfaces/dsl_test.rb
595
+ - test/lib/vedeu/interfaces/interface_test.rb
596
+ - test/lib/vedeu/interfaces/null_test.rb
597
+ - test/lib/vedeu/interfaces/repository_test.rb
594
598
  - test/lib/vedeu/logging/debug_test.rb
595
599
  - test/lib/vedeu/logging/lockless_log_device_test.rb
596
600
  - test/lib/vedeu/logging/log_test.rb
@@ -603,8 +607,6 @@ files:
603
607
  - test/lib/vedeu/models/cell_test.rb
604
608
  - test/lib/vedeu/models/escape_test.rb
605
609
  - test/lib/vedeu/models/focus_test.rb
606
- - test/lib/vedeu/models/interface_test.rb
607
- - test/lib/vedeu/models/interfaces_test.rb
608
610
  - test/lib/vedeu/models/page_test.rb
609
611
  - test/lib/vedeu/models/row_test.rb
610
612
  - test/lib/vedeu/models/toggleable_test.rb
@@ -615,12 +617,10 @@ files:
615
617
  - test/lib/vedeu/models/views/stream_test.rb
616
618
  - test/lib/vedeu/models/views/view_test.rb
617
619
  - test/lib/vedeu/null/generic_test.rb
618
- - test/lib/vedeu/null/interface_test.rb
619
620
  - test/lib/vedeu/null/view_test.rb
620
621
  - test/lib/vedeu/options_test.rb
621
622
  - test/lib/vedeu/output/clear/interface_test.rb
622
623
  - test/lib/vedeu/output/compressor_test.rb
623
- - test/lib/vedeu/output/direct_test.rb
624
624
  - test/lib/vedeu/output/output_test.rb
625
625
  - test/lib/vedeu/output/presentation/colour_test.rb
626
626
  - test/lib/vedeu/output/presentation/presentation_test.rb
@@ -755,8 +755,6 @@ test_files:
755
755
  - test/lib/vedeu/distributed/uri_test.rb
756
756
  - test/lib/vedeu/dsl/composition_test.rb
757
757
  - test/lib/vedeu/dsl/dsl_test.rb
758
- - test/lib/vedeu/dsl/interface_test.rb
759
- - test/lib/vedeu/dsl/keymap_test.rb
760
758
  - test/lib/vedeu/dsl/line_test.rb
761
759
  - test/lib/vedeu/dsl/presentation_test.rb
762
760
  - test/lib/vedeu/dsl/shared_test.rb
@@ -799,12 +797,17 @@ test_files:
799
797
  - test/lib/vedeu/groups/refresh_test.rb
800
798
  - test/lib/vedeu/groups/repository_test.rb
801
799
  - test/lib/vedeu/input/capture_test.rb
800
+ - test/lib/vedeu/input/dsl_test.rb
802
801
  - test/lib/vedeu/input/key_test.rb
803
802
  - test/lib/vedeu/input/keymap_test.rb
804
803
  - test/lib/vedeu/input/keymaps_test.rb
805
804
  - test/lib/vedeu/input/mapper_test.rb
806
805
  - test/lib/vedeu/input/store_test.rb
807
806
  - test/lib/vedeu/input/translator_test.rb
807
+ - test/lib/vedeu/interfaces/dsl_test.rb
808
+ - test/lib/vedeu/interfaces/interface_test.rb
809
+ - test/lib/vedeu/interfaces/null_test.rb
810
+ - test/lib/vedeu/interfaces/repository_test.rb
808
811
  - test/lib/vedeu/logging/debug_test.rb
809
812
  - test/lib/vedeu/logging/lockless_log_device_test.rb
810
813
  - test/lib/vedeu/logging/log_test.rb
@@ -817,8 +820,6 @@ test_files:
817
820
  - test/lib/vedeu/models/cell_test.rb
818
821
  - test/lib/vedeu/models/escape_test.rb
819
822
  - test/lib/vedeu/models/focus_test.rb
820
- - test/lib/vedeu/models/interface_test.rb
821
- - test/lib/vedeu/models/interfaces_test.rb
822
823
  - test/lib/vedeu/models/page_test.rb
823
824
  - test/lib/vedeu/models/row_test.rb
824
825
  - test/lib/vedeu/models/toggleable_test.rb
@@ -829,12 +830,10 @@ test_files:
829
830
  - test/lib/vedeu/models/views/stream_test.rb
830
831
  - test/lib/vedeu/models/views/view_test.rb
831
832
  - test/lib/vedeu/null/generic_test.rb
832
- - test/lib/vedeu/null/interface_test.rb
833
833
  - test/lib/vedeu/null/view_test.rb
834
834
  - test/lib/vedeu/options_test.rb
835
835
  - test/lib/vedeu/output/clear/interface_test.rb
836
836
  - test/lib/vedeu/output/compressor_test.rb
837
- - test/lib/vedeu/output/direct_test.rb
838
837
  - test/lib/vedeu/output/output_test.rb
839
838
  - test/lib/vedeu/output/presentation/colour_test.rb
840
839
  - test/lib/vedeu/output/presentation/presentation_test.rb
@@ -1,64 +0,0 @@
1
- module Vedeu
2
-
3
- module Output
4
-
5
- # Write a string directly to the terminal at defined coordinates.
6
- #
7
- class Direct
8
-
9
- # @param (see #initialize)
10
- # @return [String]
11
- def self.write(value:, x:, y:)
12
- new(value: value, x: x, y: y).write
13
- end
14
-
15
- # Returns a new instance of Vedeu::Output::Direct.
16
- #
17
- # @param value [String]
18
- # @param x [Fixnum]
19
- # @param y [Fixnum]
20
- # @return [Vedeu::Output::Direct]
21
- def initialize(value:, x:, y:)
22
- @value = value || ''
23
- @x = x || 1
24
- @y = y || 1
25
- end
26
-
27
- # @return [String]
28
- def write
29
- Vedeu::Terminal.output(output)
30
-
31
- output
32
- end
33
-
34
- protected
35
-
36
- # @attribute [r] value
37
- # @return [String]
38
- attr_reader :value
39
-
40
- # @attribute [r] x
41
- # @return [Fixnum]
42
- attr_reader :x
43
-
44
- # @attribute [r] y
45
- # @return [Fixnum]
46
- attr_reader :y
47
-
48
- private
49
-
50
- # @return [String]
51
- def output
52
- @output ||= (Array(position) + Array(value)).join
53
- end
54
-
55
- # @return [String]
56
- def position
57
- Vedeu::Geometry::Position.new(y, x).to_s
58
- end
59
-
60
- end # Direct
61
-
62
- end # Output
63
-
64
- end # Vedeu
@@ -1,76 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Vedeu
4
-
5
- module Output
6
-
7
- describe Direct do
8
-
9
- let(:described) { Vedeu::Output::Direct }
10
- let(:instance) { described.new(value: _value, x: x, y: y) }
11
- let(:_value) {}
12
- let(:x) {}
13
- let(:y) {}
14
-
15
- describe '#initialize' do
16
- it { instance.must_be_instance_of(described) }
17
-
18
- context 'when no value is given' do
19
- it { instance.instance_variable_get('@value').must_equal('') }
20
- end
21
-
22
- context 'when a value is given' do
23
- let(:_value) { 'some value' }
24
-
25
- it {
26
- instance.instance_variable_get('@value').must_equal('some value')
27
- }
28
- end
29
-
30
- context 'when no x is given' do
31
- it { instance.instance_variable_get('@x').must_equal(1) }
32
- end
33
-
34
- context 'when an x is given' do
35
- let(:x) { 6 }
36
- it { instance.instance_variable_get('@x').must_equal(6) }
37
- end
38
-
39
- context 'when no y is given' do
40
- it { instance.instance_variable_get('@y').must_equal(1) }
41
- end
42
-
43
- context 'when a y is given' do
44
- let(:y) { 3 }
45
-
46
- it { instance.instance_variable_get('@y').must_equal(3) }
47
- end
48
- end
49
-
50
- describe '.write' do
51
- before { Vedeu::Terminal.stubs(:output) }
52
-
53
- subject { described.write(value: _value, x: x, y: y) }
54
-
55
- it { subject.must_be_instance_of(String) }
56
-
57
- context 'when a value is given' do
58
- let(:_value) { 'some value' }
59
-
60
- it { subject.must_equal("\e[1;1Hsome value") }
61
- end
62
-
63
- context 'when a value is not given' do
64
- it { subject.must_equal("\e[1;1H") }
65
- end
66
- end
67
-
68
- describe '#write' do
69
- it { instance.must_respond_to(:write) }
70
- end
71
-
72
- end # Direct
73
-
74
- end # Output
75
-
76
- end # Vedeu