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
@@ -57,11 +57,11 @@ module Vedeu
57
57
 
58
58
  subject { instance.reposition }
59
59
 
60
- # it {
60
+ # it do
61
61
  # subject
62
62
  # Vedeu::Cursors::Cursor.expects(:store).with(new_attributes)
63
63
  # Vedeu.expects(:trigger).with(:_refresh_cursor_, _name)
64
- # }
64
+ # end
65
65
 
66
66
  it { subject.must_be_instance_of(Vedeu::Cursors::Cursor) }
67
67
 
@@ -33,9 +33,9 @@ module Vedeu
33
33
  Vedeu.cursors.reset
34
34
  }
35
35
 
36
- it {
36
+ it do
37
37
  subject.must_be_instance_of(Vedeu::Cursors::Cursor)
38
- }
38
+ end
39
39
  end
40
40
 
41
41
  context 'when there are no interfaces or views defined' do
@@ -96,11 +96,11 @@ module Vedeu
96
96
  Process.stubs(:kill)
97
97
  end
98
98
 
99
- it {
99
+ it do
100
100
  server.expects(:shutdown)
101
101
  Process.expects(:kill)
102
102
  subject
103
- }
103
+ end
104
104
 
105
105
  # @todo Add more tests.
106
106
  # it { skip }
@@ -113,7 +113,7 @@ module Vedeu
113
113
  context 'and the server is running' do
114
114
  let(:running) { true }
115
115
 
116
- it {
116
+ it do
117
117
  Vedeu.expects(:log).
118
118
  with(type: :drb,
119
119
  message: "Attempting to start: 'druby://localhost:21420'")
@@ -121,11 +121,11 @@ module Vedeu
121
121
  with(type: :drb,
122
122
  message: "Already started: 'druby://localhost:21420'")
123
123
  subject
124
- }
124
+ end
125
125
  end
126
126
 
127
127
  context 'and the server is not running' do
128
- it {
128
+ it do
129
129
  Vedeu.expects(:log).
130
130
  with(type: :drb,
131
131
  message: "Attempting to start: 'druby://localhost:21420'")
@@ -133,7 +133,7 @@ module Vedeu
133
133
  with(type: :drb,
134
134
  message: "Starting: 'druby://localhost:21420'")
135
135
  subject
136
- }
136
+ end
137
137
  end
138
138
 
139
139
  end
@@ -174,7 +174,7 @@ module Vedeu
174
174
  context 'and the server is running' do
175
175
  let(:running) { true }
176
176
 
177
- it {
177
+ it do
178
178
  Vedeu.expects(:log).
179
179
  with(type: :drb,
180
180
  message: "Attempting to stop: 'druby://localhost:21420'")
@@ -185,11 +185,11 @@ module Vedeu
185
185
  with(type: :drb,
186
186
  message: "Attempted to #join on DRb.thread.")
187
187
  subject
188
- }
188
+ end
189
189
  end
190
190
 
191
191
  context 'and the server is not running' do
192
- it {
192
+ it do
193
193
  Vedeu.expects(:log).
194
194
  with(type: :drb,
195
195
  message: "Attempting to stop: 'druby://localhost:21420'")
@@ -197,7 +197,7 @@ module Vedeu
197
197
  with(type: :drb,
198
198
  message: "Already stopped: 'druby://localhost:21420'")
199
199
  subject
200
- }
200
+ end
201
201
  end
202
202
 
203
203
  end
@@ -34,11 +34,11 @@ module Vedeu
34
34
 
35
35
  subject { instance.kill }
36
36
 
37
- it {
37
+ it do
38
38
  Process.expects(:kill)
39
39
  File.expects(:unlink)
40
40
  subject
41
- }
41
+ end
42
42
  end
43
43
 
44
44
  end # Subprocess
@@ -13,7 +13,7 @@ module Vedeu
13
13
  end
14
14
 
15
15
  describe 'accessors' do
16
- it {
16
+ it do
17
17
  instance.must_respond_to(:borders)
18
18
  instance.must_respond_to(:borders=)
19
19
  instance.must_respond_to(:configuration)
@@ -30,7 +30,7 @@ module Vedeu
30
30
  instance.must_respond_to(:menus=)
31
31
  instance.must_respond_to(:views)
32
32
  instance.must_respond_to(:views=)
33
- }
33
+ end
34
34
  end
35
35
 
36
36
  describe '.build' do
@@ -68,9 +68,9 @@ module Vedeu
68
68
  end
69
69
 
70
70
  context 'when the block is not given' do
71
- it {
71
+ it do
72
72
  proc { instance.streams }.must_raise(Vedeu::Error::RequiresBlock)
73
- }
73
+ end
74
74
  end
75
75
 
76
76
  it { instance.must_respond_to(:stream) }
@@ -40,9 +40,9 @@ module Vedeu
40
40
  it { instance.must_respond_to(:bg=) }
41
41
  it { instance.must_respond_to(:bgcolor=) }
42
42
  it { instance.must_respond_to(:background=) }
43
- it {
43
+ it do
44
44
  dsl.colour.background.must_be_instance_of(Vedeu::Colours::Background)
45
- }
45
+ end
46
46
  it { dsl.colour.background.colour.must_equal(background) }
47
47
  end
48
48
 
@@ -61,9 +61,9 @@ module Vedeu
61
61
  it { instance.must_respond_to(:fg=) }
62
62
  it { instance.must_respond_to(:fgcolor=) }
63
63
  it { instance.must_respond_to(:foreground=) }
64
- it {
64
+ it do
65
65
  dsl.colour.foreground.must_be_instance_of(Vedeu::Colours::Foreground)
66
- }
66
+ end
67
67
  it { dsl.colour.foreground.colour.must_equal(foreground) }
68
68
  end
69
69
 
@@ -44,7 +44,7 @@ module Vedeu
44
44
  end
45
45
 
46
46
  describe '#accessors' do
47
- it {
47
+ it do
48
48
  instance.must_respond_to(:name)
49
49
  instance.must_respond_to(:ox)
50
50
  instance.must_respond_to(:ox=)
@@ -52,7 +52,7 @@ module Vedeu
52
52
  instance.must_respond_to(:oy=)
53
53
  instance.must_respond_to(:x=)
54
54
  instance.must_respond_to(:y=)
55
- }
55
+ end
56
56
  end
57
57
 
58
58
  describe '#bol' do
@@ -43,20 +43,20 @@ module Vedeu
43
43
  it { instance.must_be_instance_of(described) }
44
44
  it { instance.instance_variable_get('@data').must_equal(data) }
45
45
  it { instance.instance_variable_get('@name').must_equal(_name) }
46
- it {
46
+ it do
47
47
  instance.instance_variable_get('@repository').
48
48
  must_equal(Vedeu.documents)
49
- }
49
+ end
50
50
  end
51
51
 
52
52
  describe 'accessors' do
53
- it {
53
+ it do
54
54
  instance.must_respond_to(:attributes)
55
55
  instance.must_respond_to(:data)
56
56
  instance.must_respond_to(:data=)
57
57
  instance.must_respond_to(:name)
58
58
  instance.must_respond_to(:name=)
59
- }
59
+ end
60
60
  end
61
61
 
62
62
  describe '#execute' do
@@ -62,86 +62,86 @@ module Vedeu
62
62
  context 'when the input is :backspace' do
63
63
  let(:input) { :backspace }
64
64
 
65
- it {
65
+ it do
66
66
  document.expects(:delete_character)
67
67
  subject
68
- }
68
+ end
69
69
  end
70
70
 
71
71
  context 'when the input is :ctrl_c' do
72
72
  let(:input) { :ctrl_c }
73
73
 
74
- it {
74
+ it do
75
75
  Vedeu.expects(:trigger).with(:_exit_)
76
76
  subject
77
- }
77
+ end
78
78
  end
79
79
 
80
80
  context 'when the input is :down' do
81
81
  let(:input) { :down }
82
82
 
83
- it {
83
+ it do
84
84
  document.expects(:down)
85
85
  subject
86
- }
86
+ end
87
87
  end
88
88
 
89
89
  context 'when the input is :enter' do
90
90
  let(:input) { :enter }
91
91
 
92
- it {
92
+ it do
93
93
  document.expects(:insert_line)
94
94
  subject
95
- }
95
+ end
96
96
  end
97
97
 
98
98
  context 'when the input is :escape' do
99
99
  let(:input) { :escape }
100
100
 
101
- it {
101
+ it do
102
102
  Vedeu.expects(:trigger).with(:_mode_switch_)
103
103
  subject
104
- }
104
+ end
105
105
  end
106
106
 
107
107
  context 'when the input is :left' do
108
108
  let(:input) { :left }
109
109
 
110
- it {
110
+ it do
111
111
  document.expects(:left)
112
112
  subject
113
- }
113
+ end
114
114
  end
115
115
 
116
116
  context 'when the input is :right' do
117
117
  let(:input) { :right }
118
118
 
119
- it {
119
+ it do
120
120
  document.expects(:right)
121
121
  subject
122
- }
122
+ end
123
123
  end
124
124
 
125
125
  context 'when the input is :tab' do
126
126
  let(:input) { :tab }
127
127
  let(:data) { mock(:empty? => false) }
128
128
 
129
- # it {
129
+ # it do
130
130
  # document.expects(:execute).returns(data)
131
131
  # document.expects(:reset!)
132
132
  # document.expects(:clear)
133
133
  # Vedeu.expects(:trigger).with(:_command_, data)
134
134
  # subject
135
- # }
135
+ # end
136
136
  end
137
137
 
138
138
  context 'when the input is :up' do
139
139
  let(:input) { :up }
140
140
 
141
- it {
141
+ it do
142
142
  document.expects(:up)
143
143
  subject
144
- }
144
+ end
145
145
  end
146
146
 
147
147
  context 'when the input is something else' do
@@ -154,10 +154,10 @@ module Vedeu
154
154
  context 'when the input is not a symbol' do
155
155
  let(:input) { 'a' }
156
156
 
157
- it {
157
+ it do
158
158
  document.expects(:insert_character).with(input)
159
159
  subject
160
- }
160
+ end
161
161
  end
162
162
  end
163
163
  end
@@ -117,11 +117,11 @@ module Vedeu
117
117
  described.add(:some_alias, :other_event)
118
118
  end
119
119
 
120
- it {
120
+ it do
121
121
  Vedeu::Events::Trigger.expects(:trigger).with(:some_event, nil)
122
122
  Vedeu::Events::Trigger.expects(:trigger).with(:other_event, nil)
123
123
  subject
124
- }
124
+ end
125
125
  end
126
126
 
127
127
  context 'when the alias name is not registered' do
@@ -15,10 +15,10 @@ module Vedeu
15
15
 
16
16
  it { described.must_respond_to(:reset) }
17
17
 
18
- it {
18
+ it do
19
19
  described.expects(:new).with(Vedeu::Events::Collection)
20
20
  subject
21
- }
21
+ end
22
22
  end
23
23
 
24
24
  end # Repository
@@ -48,7 +48,7 @@ module Vedeu
48
48
  end
49
49
 
50
50
  describe 'accessors' do
51
- it {
51
+ it do
52
52
  instance.must_respond_to(:y)
53
53
  instance.must_respond_to(:yn)
54
54
  instance.must_respond_to(:x)
@@ -57,7 +57,7 @@ module Vedeu
57
57
  instance.must_respond_to(:bottom)
58
58
  instance.must_respond_to(:left)
59
59
  instance.must_respond_to(:right)
60
- }
60
+ end
61
61
  end
62
62
 
63
63
  describe '#initialize' do
@@ -61,7 +61,7 @@ module Vedeu
61
61
  end
62
62
 
63
63
  describe 'accessors' do
64
- it {
64
+ it do
65
65
  instance.must_respond_to(:name)
66
66
  instance.must_respond_to(:name=)
67
67
  instance.must_respond_to(:height=)
@@ -77,7 +77,7 @@ module Vedeu
77
77
  instance.must_respond_to(:xn=)
78
78
  instance.must_respond_to(:y=)
79
79
  instance.must_respond_to(:yn=)
80
- }
80
+ end
81
81
  end
82
82
 
83
83
  describe '#attributes' do
@@ -37,9 +37,9 @@ module Vedeu
37
37
  context 'when a direction is given' do
38
38
  let(:direction) { :left }
39
39
 
40
- it {
40
+ it do
41
41
  instance.instance_variable_get('@direction').must_equal(direction)
42
- }
42
+ end
43
43
  end
44
44
 
45
45
  context 'when a direction is not given' do
@@ -12,12 +12,12 @@ module Vedeu
12
12
  let(:x) { 19 }
13
13
 
14
14
  describe 'accessors' do
15
- it {
15
+ it do
16
16
  instance.must_respond_to(:y)
17
17
  instance.must_respond_to(:first)
18
18
  instance.must_respond_to(:x)
19
19
  instance.must_respond_to(:last)
20
- }
20
+ end
21
21
  end
22
22
 
23
23
  describe '#initialize' do
@@ -26,10 +26,10 @@ module Vedeu
26
26
 
27
27
  subject { described.render(_name) }
28
28
 
29
- it {
29
+ it do
30
30
  Vedeu.expects(:trigger).with(:_clear_view_, _name)
31
31
  subject
32
- }
32
+ end
33
33
 
34
34
  it { described.must_respond_to(:by_group) }
35
35
  it { described.must_respond_to(:clear_by_group) }