vedeu 0.6.71 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/docs/api.md +1 -1
  3. data/lib/vedeu/all.rb +1 -0
  4. data/lib/vedeu/borders/border.rb +66 -55
  5. data/lib/vedeu/borders/caption.rb +10 -20
  6. data/lib/vedeu/borders/dsl.rb +57 -13
  7. data/lib/vedeu/borders/refresh.rb +123 -64
  8. data/lib/vedeu/borders/set_attribute.rb +1 -3
  9. data/lib/vedeu/borders/title.rb +68 -25
  10. data/lib/vedeu/cells/all.rb +23 -0
  11. data/lib/vedeu/cells/border.rb +72 -0
  12. data/lib/vedeu/cells/borders/all.rb +18 -0
  13. data/lib/vedeu/cells/borders/bottom_horizontal.rb +28 -0
  14. data/lib/vedeu/cells/borders/bottom_left.rb +34 -0
  15. data/lib/vedeu/cells/borders/bottom_right.rb +34 -0
  16. data/lib/vedeu/cells/borders/horizontal.rb +28 -0
  17. data/lib/vedeu/cells/borders/left_vertical.rb +28 -0
  18. data/lib/vedeu/cells/borders/right_vertical.rb +28 -0
  19. data/lib/vedeu/cells/borders/top_horizontal.rb +28 -0
  20. data/lib/vedeu/cells/borders/top_left.rb +34 -0
  21. data/lib/vedeu/cells/borders/top_right.rb +34 -0
  22. data/lib/vedeu/cells/borders/vertical.rb +28 -0
  23. data/lib/vedeu/cells/char.rb +24 -0
  24. data/lib/vedeu/cells/clear.rb +29 -0
  25. data/lib/vedeu/cells/empty.rb +78 -0
  26. data/lib/vedeu/cells/escape.rb +24 -0
  27. data/lib/vedeu/cells/html.rb +19 -0
  28. data/lib/vedeu/cells/json.rb +19 -0
  29. data/lib/vedeu/colours/colour.rb +6 -6
  30. data/lib/vedeu/common.rb +9 -0
  31. data/lib/vedeu/cursors/move.rb +2 -3
  32. data/lib/vedeu/editor/insert.rb +1 -1
  33. data/lib/vedeu/editor/item.rb +2 -3
  34. data/lib/vedeu/input/mouse.rb +1 -1
  35. data/lib/vedeu/interfaces/clear.rb +3 -4
  36. data/lib/vedeu/output/compressor.rb +1 -0
  37. data/lib/vedeu/presentation/colour.rb +3 -0
  38. data/lib/vedeu/repositories/defaults.rb +10 -1
  39. data/lib/vedeu/templating/decoder.rb +1 -1
  40. data/lib/vedeu/templating/encoder.rb +1 -1
  41. data/lib/vedeu/templating/template.rb +2 -2
  42. data/lib/vedeu/templating/view_template.rb +1 -1
  43. data/lib/vedeu/terminal/terminal.rb +9 -0
  44. data/lib/vedeu/version.rb +1 -1
  45. data/lib/vedeu/views/html_char.rb +1 -1
  46. data/test/lib/vedeu/application/application_controller_test.rb +2 -2
  47. data/test/lib/vedeu/application/controller_test.rb +4 -4
  48. data/test/lib/vedeu/borders/border_test.rb +10 -2
  49. data/test/lib/vedeu/borders/caption_test.rb +29 -13
  50. data/test/lib/vedeu/borders/dsl_test.rb +44 -25
  51. data/test/lib/vedeu/borders/refresh_test.rb +2 -2
  52. data/test/lib/vedeu/borders/title_test.rb +17 -15
  53. data/test/lib/vedeu/buffers/buffer_test.rb +8 -8
  54. data/test/lib/vedeu/buffers/refresh_test.rb +10 -10
  55. data/test/lib/vedeu/buffers/terminal_test.rb +6 -6
  56. data/test/lib/vedeu/cells/border_test.rb +72 -0
  57. data/test/lib/vedeu/cells/borders/bottom_horizontal_test.rb +22 -0
  58. data/test/lib/vedeu/cells/borders/bottom_left_test.rb +36 -0
  59. data/test/lib/vedeu/cells/borders/bottom_right_test.rb +36 -0
  60. data/test/lib/vedeu/cells/borders/horizontal_test.rb +22 -0
  61. data/test/lib/vedeu/cells/borders/left_vertical_test.rb +22 -0
  62. data/test/lib/vedeu/cells/borders/right_vertical_test.rb +22 -0
  63. data/test/lib/vedeu/cells/borders/top_horizontal_test.rb +22 -0
  64. data/test/lib/vedeu/cells/borders/top_left_test.rb +36 -0
  65. data/test/lib/vedeu/cells/borders/top_right_test.rb +36 -0
  66. data/test/lib/vedeu/cells/borders/vertical_test.rb +22 -0
  67. data/test/lib/vedeu/cells/char_test.rb +22 -0
  68. data/test/lib/vedeu/cells/clear_test.rb +34 -0
  69. data/test/lib/vedeu/cells/empty_test.rb +55 -0
  70. data/test/lib/vedeu/cells/escape_test.rb +13 -0
  71. data/test/lib/vedeu/cells/html_test.rb +13 -0
  72. data/test/lib/vedeu/cells/json_test.rb +13 -0
  73. data/test/lib/vedeu/colours/colour_test.rb +2 -6
  74. data/test/lib/vedeu/colours/translator_test.rb +4 -4
  75. data/test/lib/vedeu/common_test.rb +10 -0
  76. data/test/lib/vedeu/configuration/api_test.rb +24 -24
  77. data/test/lib/vedeu/cursors/cursor_test.rb +4 -4
  78. data/test/lib/vedeu/cursors/dsl_test.rb +16 -16
  79. data/test/lib/vedeu/cursors/reposition_test.rb +2 -2
  80. data/test/lib/vedeu/cursors/repository_test.rb +2 -2
  81. data/test/lib/vedeu/distributed/client_test.rb +2 -2
  82. data/test/lib/vedeu/distributed/server_test.rb +8 -8
  83. data/test/lib/vedeu/distributed/subprocess_test.rb +2 -2
  84. data/test/lib/vedeu/distributed/test_application_test.rb +2 -2
  85. data/test/lib/vedeu/dsl/line_test.rb +2 -2
  86. data/test/lib/vedeu/dsl/presentation_test.rb +4 -4
  87. data/test/lib/vedeu/editor/cursor_test.rb +2 -2
  88. data/test/lib/vedeu/editor/document_test.rb +4 -4
  89. data/test/lib/vedeu/editor/editor_test.rb +20 -20
  90. data/test/lib/vedeu/events/aliases_test.rb +2 -2
  91. data/test/lib/vedeu/events/repository_test.rb +2 -2
  92. data/test/lib/vedeu/geometries/area/area_test.rb +2 -2
  93. data/test/lib/vedeu/geometries/geometry_test.rb +2 -2
  94. data/test/lib/vedeu/geometries/move_test.rb +2 -2
  95. data/test/lib/vedeu/geometries/position_test.rb +2 -2
  96. data/test/lib/vedeu/groups/clear_test.rb +2 -2
  97. data/test/lib/vedeu/groups/group_test.rb +4 -4
  98. data/test/lib/vedeu/groups/refresh_test.rb +2 -2
  99. data/test/lib/vedeu/input/capture_test.rb +42 -40
  100. data/test/lib/vedeu/input/mouse_test.rb +13 -11
  101. data/test/lib/vedeu/input/read_test.rb +10 -10
  102. data/test/lib/vedeu/interfaces/clear_test.rb +15 -6
  103. data/test/lib/vedeu/interfaces/dsl_test.rb +14 -14
  104. data/test/lib/vedeu/interfaces/interface_test.rb +12 -9
  105. data/test/lib/vedeu/logging/debug_test.rb +2 -2
  106. data/test/lib/vedeu/logging/lockless_log_device_test.rb +2 -2
  107. data/test/lib/vedeu/logging/log_test.rb +4 -4
  108. data/test/lib/vedeu/logging/mono_logger_test.rb +8 -8
  109. data/test/lib/vedeu/logging/timer_test.rb +2 -2
  110. data/test/lib/vedeu/menus/menu_test.rb +4 -4
  111. data/test/lib/vedeu/models/cell_test.rb +2 -2
  112. data/test/lib/vedeu/models/focus_test.rb +6 -6
  113. data/test/lib/vedeu/models/toggleable_test.rb +10 -10
  114. data/test/lib/vedeu/null/generic_test.rb +2 -2
  115. data/test/lib/vedeu/output/output_test.rb +8 -8
  116. data/test/lib/vedeu/output/refresh_test.rb +2 -2
  117. data/test/lib/vedeu/output/viewport_test.rb +2 -2
  118. data/test/lib/vedeu/plugins/plugin_test.rb +4 -4
  119. data/test/lib/vedeu/presentation/background_test.rb +2 -2
  120. data/test/lib/vedeu/presentation/foreground_test.rb +2 -2
  121. data/test/lib/vedeu/presentation/style_test.rb +2 -2
  122. data/test/lib/vedeu/renderers/all_test.rb +2 -2
  123. data/test/lib/vedeu/renderers/file_test.rb +6 -6
  124. data/test/lib/vedeu/renderers/terminal_test.rb +2 -2
  125. data/test/lib/vedeu/repositories/collection_test.rb +2 -2
  126. data/test/lib/vedeu/repositories/defaults_test.rb +35 -0
  127. data/test/lib/vedeu/repositories/registerable_test.rb +2 -2
  128. data/test/lib/vedeu/runtime/bootstrap_test.rb +2 -2
  129. data/test/lib/vedeu/runtime/flags_test.rb +2 -2
  130. data/test/lib/vedeu/runtime/launcher_test.rb +4 -4
  131. data/test/lib/vedeu/runtime/main_loop_test.rb +2 -2
  132. data/test/lib/vedeu/runtime/router_test.rb +12 -12
  133. data/test/lib/vedeu/terminal/mode_test.rb +4 -4
  134. data/test/lib/vedeu/terminal/terminal_test.rb +19 -9
  135. data/test/lib/vedeu/views/char_test.rb +2 -2
  136. data/test/lib/vedeu/views/composition_test.rb +2 -2
  137. data/test/lib/vedeu/views/line_test.rb +2 -2
  138. data/test/lib/vedeu/views/stream_test.rb +2 -2
  139. data/test/lib/vedeu/views/view_test.rb +4 -4
  140. data/vedeu.gemspec +1 -1
  141. metadata +57 -4
@@ -41,21 +41,24 @@ module Vedeu
41
41
 
42
42
  it { subject.must_be_instance_of(described) }
43
43
  it { subject.instance_variable_get('@client').must_equal(client) }
44
- it { subject.instance_variable_get('@cursor_visible').must_equal(cursor_visible) }
44
+ it do
45
+ subject.instance_variable_get('@cursor_visible').
46
+ must_equal(cursor_visible)
47
+ end
45
48
  it { subject.instance_variable_get('@delay').must_equal(delay) }
46
49
  it { subject.instance_variable_get('@editable').must_equal(editable) }
47
50
  it { subject.instance_variable_get('@group').must_equal(group) }
48
51
  it { subject.instance_variable_get('@name').must_equal(_name) }
49
52
  it { subject.instance_variable_get('@parent').must_equal(parent) }
50
- it {
53
+ it do
51
54
  subject.instance_variable_get('@repository').must_equal(repository)
52
- }
55
+ end
53
56
  it { subject.instance_variable_get('@visible').must_equal(visible) }
54
57
  it { subject.instance_variable_get('@zindex').must_equal(zindex) }
55
58
  end
56
59
 
57
60
  describe 'accessors' do
58
- it {
61
+ it do
59
62
  instance.must_respond_to(:client)
60
63
  instance.must_respond_to(:client=)
61
64
  instance.must_respond_to(:cursor_visible)
@@ -76,7 +79,7 @@ module Vedeu
76
79
  instance.must_respond_to(:visible)
77
80
  instance.must_respond_to(:visible=)
78
81
  instance.must_respond_to(:visible?)
79
- }
82
+ end
80
83
  end
81
84
 
82
85
  describe '#attributes' do
@@ -98,10 +101,10 @@ module Vedeu
98
101
 
99
102
  subject { instance.hide }
100
103
 
101
- it {
104
+ it do
102
105
  Vedeu.expects(:trigger).with(:_clear_view_, _name)
103
106
  subject
104
- }
107
+ end
105
108
  end
106
109
 
107
110
  describe '#show' do
@@ -109,10 +112,10 @@ module Vedeu
109
112
 
110
113
  subject { instance.show }
111
114
 
112
- it {
115
+ it do
113
116
  Vedeu.expects(:trigger).with(:_refresh_view_, _name)
114
117
  subject
115
- }
118
+ end
116
119
  end
117
120
 
118
121
  end # Interface
@@ -25,10 +25,10 @@ module Vedeu
25
25
  context 'when the block is given' do
26
26
  subject { described.profile(filename) { some_code } }
27
27
 
28
- it {
28
+ it do
29
29
  ::File.expects(:open).with('/tmp/profile.html', 'w')
30
30
  subject
31
- }
31
+ end
32
32
  end
33
33
  end
34
34
 
@@ -12,10 +12,10 @@ module Vedeu
12
12
 
13
13
  describe '#initialize' do
14
14
  # it { instance.must_be_instance_of(described) }
15
- # it {
15
+ # it do
16
16
  # instance.instance_variable_get('@file_or_filename').
17
17
  # must_equal(file_or_filename)
18
- # }
18
+ # end
19
19
 
20
20
  # @todo Add more tests.
21
21
  # it { skip }
@@ -29,11 +29,11 @@ module Vedeu
29
29
 
30
30
  subject { described.log_stdout(type: type, message: _message) }
31
31
 
32
- it {
32
+ it do
33
33
  capture_io { subject }.must_equal(
34
34
  ["\e[96m[create] \e[39m\e[36mLogging to stdout...\e[39m\n", ""]
35
35
  )
36
- }
36
+ end
37
37
  end
38
38
 
39
39
  describe '.log_stdout' do
@@ -42,11 +42,11 @@ module Vedeu
42
42
 
43
43
  subject { described.log_stderr(type: type, message: _message) }
44
44
 
45
- it {
45
+ it do
46
46
  capture_io { subject }.must_equal(
47
47
  ["", "\e[97m[debug] \e[39m\e[37mLogging to stderr...\e[39m\n"]
48
48
  )
49
- }
49
+ end
50
50
  end
51
51
 
52
52
  end # Log
@@ -12,27 +12,27 @@ module Vedeu
12
12
 
13
13
  describe '#initialize' do
14
14
  it { instance.must_be_instance_of(described) }
15
- it {
15
+ it do
16
16
  instance.instance_variable_get('@level').must_equal(Logger::DEBUG)
17
- }
18
- it {
17
+ end
18
+ it do
19
19
  instance.instance_variable_get('@default_formatter').
20
20
  must_be_instance_of(::Logger::Formatter)
21
- }
21
+ end
22
22
  it { instance.instance_variable_get('@Formatter').must_equal(nil) }
23
23
 
24
24
  context 'when a log device is given' do
25
- # it {
25
+ # it do
26
26
  # instance.instance_variable_get('@logdev').
27
27
  # must_be_instance_of(Vedeu::Logging::LocklessLogDevice)
28
- # }
28
+ # end
29
29
  end
30
30
 
31
31
  context 'when a log device is not given' do
32
- # it {
32
+ # it do
33
33
  # instance.instance_variable_get('@logdev').
34
34
  # must_be_instance_of(Vedeu::Logging::LocklessLogDevice)
35
- # }
35
+ # end
36
36
  end
37
37
  end
38
38
 
@@ -32,11 +32,11 @@ module Vedeu
32
32
  context 'when debugging is enabled' do
33
33
  before { Vedeu::Configuration.stubs(:debug?).returns(true) }
34
34
 
35
- it {
35
+ it do
36
36
  Vedeu.expects(:log).with(type: :timer,
37
37
  message: "Testing took 0.0ms.")
38
38
  subject
39
- }
39
+ end
40
40
  end
41
41
 
42
42
  context 'when debugging is disabled' do
@@ -23,9 +23,9 @@ module Vedeu
23
23
 
24
24
  describe '#initialize' do
25
25
  it { instance.must_be_instance_of(described) }
26
- it {
26
+ it do
27
27
  instance.instance_variable_get('@collection').must_equal(collection)
28
- }
28
+ end
29
29
  it { instance.instance_variable_get('@name').must_equal('elements') }
30
30
  it { instance.instance_variable_get('@current').must_equal(0) }
31
31
  it { instance.instance_variable_get('@selected').must_equal(nil) }
@@ -35,13 +35,13 @@ module Vedeu
35
35
  end
36
36
 
37
37
  describe 'accessors' do
38
- it {
38
+ it do
39
39
  instance.must_respond_to(:collection)
40
40
  instance.must_respond_to(:collection=)
41
41
  instance.must_respond_to(:current=)
42
42
  instance.must_respond_to(:name)
43
43
  instance.must_respond_to(:name=)
44
- }
44
+ end
45
45
  end
46
46
 
47
47
  describe '#current' do
@@ -33,12 +33,12 @@ module Vedeu
33
33
  end
34
34
 
35
35
  describe 'accessors' do
36
- it {
36
+ it do
37
37
  instance.must_respond_to(:colour)
38
38
  instance.must_respond_to(:name)
39
39
  instance.must_respond_to(:style)
40
40
  instance.must_respond_to(:value)
41
- }
41
+ end
42
42
  end
43
43
 
44
44
  describe '#cell?' do
@@ -35,10 +35,10 @@ module Vedeu
35
35
  context 'does not add it again if already exists' do
36
36
  before { Vedeu.interface('thallium') {} }
37
37
 
38
- it {
38
+ it do
39
39
  described.add('thallium')
40
40
  described.registered.must_equal(['thallium'])
41
- }
41
+ end
42
42
  end
43
43
 
44
44
  it 'does not add it again if already exists' do
@@ -54,21 +54,21 @@ module Vedeu
54
54
  context 'adds the interface to storage focussed' do
55
55
  before { Vedeu.interface('thallium') {} }
56
56
 
57
- it {
57
+ it do
58
58
  described.add('thallium')
59
59
  described.add('lead', true)
60
60
  described.registered.must_equal(['lead', 'thallium'])
61
- }
61
+ end
62
62
  end
63
63
 
64
64
  context 'adds the interface to storage unfocussed' do
65
65
  before { Vedeu.interface('thallium') {} }
66
66
 
67
- it {
67
+ it do
68
68
  described.add('thallium')
69
69
  described.add('lead')
70
70
  described.registered.must_equal(['thallium', 'lead'])
71
- }
71
+ end
72
72
  end
73
73
  end
74
74
 
@@ -22,20 +22,20 @@ module Vedeu
22
22
  let(:visible) { false }
23
23
 
24
24
  describe 'accessors' do
25
- it {
25
+ it do
26
26
  instance.must_respond_to(:visible)
27
27
  instance.must_respond_to(:visible=)
28
28
  instance.must_respond_to(:visible?)
29
- }
29
+ end
30
30
  end
31
31
 
32
32
  describe '#hide' do
33
33
  subject { instance.hide }
34
34
 
35
- it {
35
+ it do
36
36
  subject
37
37
  instance.instance_variable_get('@visible').must_equal(false)
38
- }
38
+ end
39
39
 
40
40
  it { Vedeu::ToggleableTestClass.must_respond_to(:hide_cursor) }
41
41
  it { Vedeu::ToggleableTestClass.must_respond_to(:hide_group) }
@@ -45,10 +45,10 @@ module Vedeu
45
45
  describe '#show' do
46
46
  subject { instance.show }
47
47
 
48
- it {
48
+ it do
49
49
  subject
50
50
  instance.instance_variable_get('@visible').must_equal(true)
51
- }
51
+ end
52
52
 
53
53
  it { Vedeu::ToggleableTestClass.must_respond_to(:show_cursor) }
54
54
  it { Vedeu::ToggleableTestClass.must_respond_to(:show_group) }
@@ -65,17 +65,17 @@ module Vedeu
65
65
  context 'when the model is visible' do
66
66
  let(:visible) { true }
67
67
 
68
- it {
68
+ it do
69
69
  subject
70
70
  instance.instance_variable_get('@visible').must_equal(false)
71
- }
71
+ end
72
72
  end
73
73
 
74
74
  context 'when the model is not visible' do
75
- it {
75
+ it do
76
76
  subject
77
77
  instance.instance_variable_get('@visible').must_equal(true)
78
- }
78
+ end
79
79
  end
80
80
  end
81
81
 
@@ -23,9 +23,9 @@ module Vedeu
23
23
 
24
24
  describe '#initialize' do
25
25
  it { instance.must_be_instance_of(described) }
26
- it {
26
+ it do
27
27
  instance.instance_variable_get('@attributes').must_equal(attributes)
28
- }
28
+ end
29
29
 
30
30
  context 'when a name is given' do
31
31
  it { instance.instance_variable_get('@name').must_equal(_name) }
@@ -26,10 +26,10 @@ module Vedeu
26
26
  context 'when the output is not empty' do
27
27
  let(:output) { Vedeu::Models::Page.new }
28
28
 
29
- it {
29
+ it do
30
30
  Vedeu::Buffers::Terminal.expects(:write).with(output)
31
31
  subject
32
- }
32
+ end
33
33
  end
34
34
  end
35
35
 
@@ -45,10 +45,10 @@ module Vedeu
45
45
  Vedeu::Models::Escape.new(value: "\e[?25h", position: [1, 1])
46
46
  }
47
47
 
48
- it {
48
+ it do
49
49
  Vedeu::Terminal.expects(:output).with(output.to_s)
50
50
  subject
51
- }
51
+ end
52
52
  end
53
53
  end
54
54
 
@@ -65,19 +65,19 @@ module Vedeu
65
65
  Vedeu::Models::Escape.new(value: "\e[?25h", position: [1, 1])
66
66
  }
67
67
 
68
- it {
68
+ it do
69
69
  Vedeu::Terminal.expects(:output).with(output.to_s)
70
70
  subject
71
- }
71
+ end
72
72
  end
73
73
 
74
74
  context 'and the output is not an escape sequence' do
75
75
  let(:output) { Vedeu::Models::Page.new }
76
76
 
77
- it {
77
+ it do
78
78
  Vedeu::Buffers::Terminal.expects(:write).with(output)
79
79
  subject
80
- }
80
+ end
81
81
  end
82
82
  end
83
83
  end
@@ -34,11 +34,11 @@ module Vedeu
34
34
 
35
35
  before { Vedeu.interfaces.stubs(:zindexed).returns(interfaces) }
36
36
 
37
- it {
37
+ it do
38
38
  Vedeu.expects(:trigger).with(:_refresh_view_,
39
39
  'Vedeu::Output::Refresh')
40
40
  subject
41
- }
41
+ end
42
42
 
43
43
  it { subject.must_equal([interface]) }
44
44
  end
@@ -54,10 +54,10 @@ module Vedeu
54
54
 
55
55
  context 'when the interface is visible' do
56
56
  context 'and Vedeu is ready' do
57
- it {
57
+ it do
58
58
  Vedeu.expects(:render_output)
59
59
  subject
60
- }
60
+ end
61
61
  end
62
62
 
63
63
  context 'but Vedeu is not ready' do
@@ -13,22 +13,22 @@ module Vedeu
13
13
  it { instance.must_be_instance_of(described) }
14
14
  it { instance.instance_variable_get('@name').must_equal(_name) }
15
15
  it { instance.instance_variable_get('@gem').must_equal(_gem) }
16
- it {
16
+ it do
17
17
  instance.instance_variable_get('@gem_name').
18
18
  must_equal("vedeu_#{_name}")
19
- }
19
+ end
20
20
  it { instance.instance_variable_get('@enabled').must_equal(false) }
21
21
  end
22
22
 
23
23
  describe 'accessors' do
24
- it {
24
+ it do
25
25
  instance.must_respond_to(:name)
26
26
  instance.must_respond_to(:gem)
27
27
  instance.must_respond_to(:gem_name)
28
28
  instance.must_respond_to(:enabled)
29
29
  instance.must_respond_to(:enabled=)
30
30
  instance.must_respond_to(:enabled?)
31
- }
31
+ end
32
32
  end
33
33
 
34
34
  describe '#load!' do
@@ -54,11 +54,11 @@ module Vedeu
54
54
  describe '#background=' do
55
55
  subject { includer.background = '#987654' }
56
56
 
57
- it {
57
+ it do
58
58
  includer.colour.background.colour.must_equal('#000033')
59
59
  subject
60
60
  includer.colour.background.colour.must_equal('#987654')
61
- }
61
+ end
62
62
 
63
63
  it { subject.must_equal('#987654') }
64
64
  end