vedeu 0.6.71 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/api.md +1 -1
- data/lib/vedeu/all.rb +1 -0
- data/lib/vedeu/borders/border.rb +66 -55
- data/lib/vedeu/borders/caption.rb +10 -20
- data/lib/vedeu/borders/dsl.rb +57 -13
- data/lib/vedeu/borders/refresh.rb +123 -64
- data/lib/vedeu/borders/set_attribute.rb +1 -3
- data/lib/vedeu/borders/title.rb +68 -25
- data/lib/vedeu/cells/all.rb +23 -0
- data/lib/vedeu/cells/border.rb +72 -0
- data/lib/vedeu/cells/borders/all.rb +18 -0
- data/lib/vedeu/cells/borders/bottom_horizontal.rb +28 -0
- data/lib/vedeu/cells/borders/bottom_left.rb +34 -0
- data/lib/vedeu/cells/borders/bottom_right.rb +34 -0
- data/lib/vedeu/cells/borders/horizontal.rb +28 -0
- data/lib/vedeu/cells/borders/left_vertical.rb +28 -0
- data/lib/vedeu/cells/borders/right_vertical.rb +28 -0
- data/lib/vedeu/cells/borders/top_horizontal.rb +28 -0
- data/lib/vedeu/cells/borders/top_left.rb +34 -0
- data/lib/vedeu/cells/borders/top_right.rb +34 -0
- data/lib/vedeu/cells/borders/vertical.rb +28 -0
- data/lib/vedeu/cells/char.rb +24 -0
- data/lib/vedeu/cells/clear.rb +29 -0
- data/lib/vedeu/cells/empty.rb +78 -0
- data/lib/vedeu/cells/escape.rb +24 -0
- data/lib/vedeu/cells/html.rb +19 -0
- data/lib/vedeu/cells/json.rb +19 -0
- data/lib/vedeu/colours/colour.rb +6 -6
- data/lib/vedeu/common.rb +9 -0
- data/lib/vedeu/cursors/move.rb +2 -3
- data/lib/vedeu/editor/insert.rb +1 -1
- data/lib/vedeu/editor/item.rb +2 -3
- data/lib/vedeu/input/mouse.rb +1 -1
- data/lib/vedeu/interfaces/clear.rb +3 -4
- data/lib/vedeu/output/compressor.rb +1 -0
- data/lib/vedeu/presentation/colour.rb +3 -0
- data/lib/vedeu/repositories/defaults.rb +10 -1
- data/lib/vedeu/templating/decoder.rb +1 -1
- data/lib/vedeu/templating/encoder.rb +1 -1
- data/lib/vedeu/templating/template.rb +2 -2
- data/lib/vedeu/templating/view_template.rb +1 -1
- data/lib/vedeu/terminal/terminal.rb +9 -0
- data/lib/vedeu/version.rb +1 -1
- data/lib/vedeu/views/html_char.rb +1 -1
- data/test/lib/vedeu/application/application_controller_test.rb +2 -2
- data/test/lib/vedeu/application/controller_test.rb +4 -4
- data/test/lib/vedeu/borders/border_test.rb +10 -2
- data/test/lib/vedeu/borders/caption_test.rb +29 -13
- data/test/lib/vedeu/borders/dsl_test.rb +44 -25
- data/test/lib/vedeu/borders/refresh_test.rb +2 -2
- data/test/lib/vedeu/borders/title_test.rb +17 -15
- data/test/lib/vedeu/buffers/buffer_test.rb +8 -8
- data/test/lib/vedeu/buffers/refresh_test.rb +10 -10
- data/test/lib/vedeu/buffers/terminal_test.rb +6 -6
- data/test/lib/vedeu/cells/border_test.rb +72 -0
- data/test/lib/vedeu/cells/borders/bottom_horizontal_test.rb +22 -0
- data/test/lib/vedeu/cells/borders/bottom_left_test.rb +36 -0
- data/test/lib/vedeu/cells/borders/bottom_right_test.rb +36 -0
- data/test/lib/vedeu/cells/borders/horizontal_test.rb +22 -0
- data/test/lib/vedeu/cells/borders/left_vertical_test.rb +22 -0
- data/test/lib/vedeu/cells/borders/right_vertical_test.rb +22 -0
- data/test/lib/vedeu/cells/borders/top_horizontal_test.rb +22 -0
- data/test/lib/vedeu/cells/borders/top_left_test.rb +36 -0
- data/test/lib/vedeu/cells/borders/top_right_test.rb +36 -0
- data/test/lib/vedeu/cells/borders/vertical_test.rb +22 -0
- data/test/lib/vedeu/cells/char_test.rb +22 -0
- data/test/lib/vedeu/cells/clear_test.rb +34 -0
- data/test/lib/vedeu/cells/empty_test.rb +55 -0
- data/test/lib/vedeu/cells/escape_test.rb +13 -0
- data/test/lib/vedeu/cells/html_test.rb +13 -0
- data/test/lib/vedeu/cells/json_test.rb +13 -0
- data/test/lib/vedeu/colours/colour_test.rb +2 -6
- data/test/lib/vedeu/colours/translator_test.rb +4 -4
- data/test/lib/vedeu/common_test.rb +10 -0
- data/test/lib/vedeu/configuration/api_test.rb +24 -24
- data/test/lib/vedeu/cursors/cursor_test.rb +4 -4
- data/test/lib/vedeu/cursors/dsl_test.rb +16 -16
- data/test/lib/vedeu/cursors/reposition_test.rb +2 -2
- data/test/lib/vedeu/cursors/repository_test.rb +2 -2
- data/test/lib/vedeu/distributed/client_test.rb +2 -2
- data/test/lib/vedeu/distributed/server_test.rb +8 -8
- data/test/lib/vedeu/distributed/subprocess_test.rb +2 -2
- data/test/lib/vedeu/distributed/test_application_test.rb +2 -2
- data/test/lib/vedeu/dsl/line_test.rb +2 -2
- data/test/lib/vedeu/dsl/presentation_test.rb +4 -4
- data/test/lib/vedeu/editor/cursor_test.rb +2 -2
- data/test/lib/vedeu/editor/document_test.rb +4 -4
- data/test/lib/vedeu/editor/editor_test.rb +20 -20
- data/test/lib/vedeu/events/aliases_test.rb +2 -2
- data/test/lib/vedeu/events/repository_test.rb +2 -2
- data/test/lib/vedeu/geometries/area/area_test.rb +2 -2
- data/test/lib/vedeu/geometries/geometry_test.rb +2 -2
- data/test/lib/vedeu/geometries/move_test.rb +2 -2
- data/test/lib/vedeu/geometries/position_test.rb +2 -2
- data/test/lib/vedeu/groups/clear_test.rb +2 -2
- data/test/lib/vedeu/groups/group_test.rb +4 -4
- data/test/lib/vedeu/groups/refresh_test.rb +2 -2
- data/test/lib/vedeu/input/capture_test.rb +42 -40
- data/test/lib/vedeu/input/mouse_test.rb +13 -11
- data/test/lib/vedeu/input/read_test.rb +10 -10
- data/test/lib/vedeu/interfaces/clear_test.rb +15 -6
- data/test/lib/vedeu/interfaces/dsl_test.rb +14 -14
- data/test/lib/vedeu/interfaces/interface_test.rb +12 -9
- data/test/lib/vedeu/logging/debug_test.rb +2 -2
- data/test/lib/vedeu/logging/lockless_log_device_test.rb +2 -2
- data/test/lib/vedeu/logging/log_test.rb +4 -4
- data/test/lib/vedeu/logging/mono_logger_test.rb +8 -8
- data/test/lib/vedeu/logging/timer_test.rb +2 -2
- data/test/lib/vedeu/menus/menu_test.rb +4 -4
- data/test/lib/vedeu/models/cell_test.rb +2 -2
- data/test/lib/vedeu/models/focus_test.rb +6 -6
- data/test/lib/vedeu/models/toggleable_test.rb +10 -10
- data/test/lib/vedeu/null/generic_test.rb +2 -2
- data/test/lib/vedeu/output/output_test.rb +8 -8
- data/test/lib/vedeu/output/refresh_test.rb +2 -2
- data/test/lib/vedeu/output/viewport_test.rb +2 -2
- data/test/lib/vedeu/plugins/plugin_test.rb +4 -4
- data/test/lib/vedeu/presentation/background_test.rb +2 -2
- data/test/lib/vedeu/presentation/foreground_test.rb +2 -2
- data/test/lib/vedeu/presentation/style_test.rb +2 -2
- data/test/lib/vedeu/renderers/all_test.rb +2 -2
- data/test/lib/vedeu/renderers/file_test.rb +6 -6
- data/test/lib/vedeu/renderers/terminal_test.rb +2 -2
- data/test/lib/vedeu/repositories/collection_test.rb +2 -2
- data/test/lib/vedeu/repositories/defaults_test.rb +35 -0
- data/test/lib/vedeu/repositories/registerable_test.rb +2 -2
- data/test/lib/vedeu/runtime/bootstrap_test.rb +2 -2
- data/test/lib/vedeu/runtime/flags_test.rb +2 -2
- data/test/lib/vedeu/runtime/launcher_test.rb +4 -4
- data/test/lib/vedeu/runtime/main_loop_test.rb +2 -2
- data/test/lib/vedeu/runtime/router_test.rb +12 -12
- data/test/lib/vedeu/terminal/mode_test.rb +4 -4
- data/test/lib/vedeu/terminal/terminal_test.rb +19 -9
- data/test/lib/vedeu/views/char_test.rb +2 -2
- data/test/lib/vedeu/views/composition_test.rb +2 -2
- data/test/lib/vedeu/views/line_test.rb +2 -2
- data/test/lib/vedeu/views/stream_test.rb +2 -2
- data/test/lib/vedeu/views/view_test.rb +4 -4
- data/vedeu.gemspec +1 -1
- metadata +57 -4
@@ -55,11 +55,11 @@ module Vedeu
|
|
55
55
|
describe '#foreground=' do
|
56
56
|
subject { includer.foreground = '#123456' }
|
57
57
|
|
58
|
-
it
|
58
|
+
it do
|
59
59
|
includer.colour.foreground.colour.must_equal('#aadd00')
|
60
60
|
subject
|
61
61
|
includer.colour.foreground.colour.must_equal('#123456')
|
62
|
-
|
62
|
+
end
|
63
63
|
|
64
64
|
it { subject.must_equal('#123456') }
|
65
65
|
end
|
@@ -71,10 +71,10 @@ module Vedeu
|
|
71
71
|
subject { described.render(output) }
|
72
72
|
|
73
73
|
context 'when an interface/view has been defined' do
|
74
|
-
it
|
74
|
+
it do
|
75
75
|
DummyRenderer.expects(:render).with(output)
|
76
76
|
subject
|
77
|
-
|
77
|
+
end
|
78
78
|
|
79
79
|
context 'when there is content' do
|
80
80
|
let(:output) {
|
@@ -38,10 +38,10 @@ module Vedeu
|
|
38
38
|
|
39
39
|
context 'when the filename option is not set' do
|
40
40
|
context 'when the timestamp option is not set' do
|
41
|
-
# it
|
41
|
+
# it do
|
42
42
|
# ::File.expects(:write).with('/tmp/out', nil)
|
43
43
|
# subject
|
44
|
-
#
|
44
|
+
# end
|
45
45
|
end
|
46
46
|
|
47
47
|
context 'when the timestamp option is set' do
|
@@ -49,20 +49,20 @@ module Vedeu
|
|
49
49
|
|
50
50
|
before { Time.stubs(:now).returns(_time) }
|
51
51
|
|
52
|
-
# it
|
52
|
+
# it do
|
53
53
|
# ::File.expects(:write).with('/tmp/out_1428865500.0', 'w')
|
54
54
|
# subject
|
55
|
-
#
|
55
|
+
# end
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
59
|
context 'when the filename option is set' do
|
60
60
|
let(:filename) { 'some_name' }
|
61
61
|
|
62
|
-
# it
|
62
|
+
# it do
|
63
63
|
# ::File.expects(:write).with('/tmp/some_name', 'w')
|
64
64
|
# subject
|
65
|
-
#
|
65
|
+
# end
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
@@ -20,14 +20,14 @@ module Vedeu
|
|
20
20
|
end
|
21
21
|
|
22
22
|
describe 'accessors' do
|
23
|
-
it
|
23
|
+
it do
|
24
24
|
instance.must_respond_to(:collection)
|
25
25
|
instance.must_respond_to(:all)
|
26
26
|
instance.must_respond_to(:parent)
|
27
27
|
instance.must_respond_to(:parent=)
|
28
28
|
instance.must_respond_to(:name)
|
29
29
|
instance.must_respond_to(:name=)
|
30
|
-
|
30
|
+
end
|
31
31
|
end
|
32
32
|
|
33
33
|
describe '.coerce' do
|
@@ -4,8 +4,43 @@ module Vedeu
|
|
4
4
|
|
5
5
|
module Repositories
|
6
6
|
|
7
|
+
class DefaultsTestClass
|
8
|
+
|
9
|
+
include Vedeu::Repositories::Defaults
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def defaults
|
14
|
+
{
|
15
|
+
some_attribute: :some_value
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
end # DefaultsTestClass
|
20
|
+
|
7
21
|
describe Defaults do
|
8
22
|
|
23
|
+
let(:described) { Vedeu::Repositories::Defaults }
|
24
|
+
let(:includer) { Vedeu::Repositories::DefaultsTestClass }
|
25
|
+
let(:instance) { includer.new(attributes) }
|
26
|
+
let(:attributes) {
|
27
|
+
{
|
28
|
+
invalid_attribute: :invalid_value
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
describe '#initialize' do
|
33
|
+
it { instance.must_be_instance_of(includer) }
|
34
|
+
it do
|
35
|
+
instance.instance_variable_get('@some_attribute').
|
36
|
+
must_equal(:some_value)
|
37
|
+
end
|
38
|
+
it do
|
39
|
+
instance.instance_variables.
|
40
|
+
must_equal([:@some_attribute])
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
9
44
|
# @todo Add more tests.
|
10
45
|
|
11
46
|
end # Defaults
|
@@ -61,20 +61,20 @@ module Vedeu
|
|
61
61
|
context 'but debugging is disabled' do
|
62
62
|
let(:debug) { false }
|
63
63
|
|
64
|
-
it
|
64
|
+
it do
|
65
65
|
Vedeu.expects(:log_stdout).with(type: :error, message: 'Oops!')
|
66
66
|
subject
|
67
|
-
|
67
|
+
end
|
68
68
|
end
|
69
69
|
|
70
70
|
context 'and debugging is enabled' do
|
71
71
|
let(:debug) { true }
|
72
72
|
|
73
73
|
# Need to stub a backtrace.
|
74
|
-
# it
|
74
|
+
# it do
|
75
75
|
# Vedeu.expects(:log_stdout).with(type: :error, message: 'Oops!')
|
76
76
|
# subject
|
77
|
-
#
|
77
|
+
# end
|
78
78
|
end
|
79
79
|
end
|
80
80
|
end
|
@@ -48,25 +48,25 @@ module Vedeu
|
|
48
48
|
end
|
49
49
|
after { described.reset! }
|
50
50
|
|
51
|
-
it
|
51
|
+
it do
|
52
52
|
subject.must_equal({
|
53
53
|
some_controller: {
|
54
54
|
klass: 'SomeController',
|
55
55
|
actions: [:show_basket]
|
56
56
|
}
|
57
57
|
})
|
58
|
-
|
58
|
+
end
|
59
59
|
end
|
60
60
|
|
61
61
|
context 'when the controller is not registered' do
|
62
|
-
it
|
62
|
+
it do
|
63
63
|
subject.must_equal({
|
64
64
|
some_controller: {
|
65
65
|
klass: 'SomeController',
|
66
66
|
actions: []
|
67
67
|
}
|
68
68
|
})
|
69
|
-
|
69
|
+
end
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
@@ -99,27 +99,27 @@ module Vedeu
|
|
99
99
|
before { described.add_controller(controller, 'SomeController') }
|
100
100
|
after { described.reset! }
|
101
101
|
|
102
|
-
it
|
102
|
+
it do
|
103
103
|
subject.must_equal({
|
104
104
|
some_controller: {
|
105
105
|
klass: 'SomeController',
|
106
106
|
actions: [:some_action]
|
107
107
|
}
|
108
108
|
})
|
109
|
-
|
109
|
+
end
|
110
110
|
end
|
111
111
|
|
112
112
|
context 'when the controller is not registered' do
|
113
113
|
before { described.reset! }
|
114
114
|
|
115
|
-
it
|
115
|
+
it do
|
116
116
|
subject.must_equal({
|
117
117
|
some_controller: {
|
118
118
|
klass: '',
|
119
119
|
actions: [:some_action]
|
120
120
|
}
|
121
121
|
})
|
122
|
-
|
122
|
+
end
|
123
123
|
end
|
124
124
|
end
|
125
125
|
end
|
@@ -138,11 +138,11 @@ module Vedeu
|
|
138
138
|
|
139
139
|
# subject { Vedeu.trigger(:_goto_, controller, action, **args) }
|
140
140
|
|
141
|
-
# it
|
141
|
+
# it do
|
142
142
|
# Vedeu::Runtime::Router.expects(:goto)
|
143
143
|
# .with(:some_controller, :show_basket, args)
|
144
144
|
# subject
|
145
|
-
#
|
145
|
+
# end
|
146
146
|
# end
|
147
147
|
|
148
148
|
describe '.goto' do
|
@@ -169,7 +169,7 @@ module Vedeu
|
|
169
169
|
end
|
170
170
|
after { described.reset! }
|
171
171
|
|
172
|
-
it
|
172
|
+
it do
|
173
173
|
subject.must_equal({
|
174
174
|
customer: {
|
175
175
|
name: 'Gavin Laking',
|
@@ -179,7 +179,7 @@ module Vedeu
|
|
179
179
|
product_ids: [88]
|
180
180
|
}
|
181
181
|
})
|
182
|
-
|
182
|
+
end
|
183
183
|
end
|
184
184
|
|
185
185
|
context 'when the action is not defined for this controller' do
|
@@ -78,20 +78,20 @@ module Vedeu
|
|
78
78
|
context 'when the mode is given' do
|
79
79
|
let(:mode) { :cooked }
|
80
80
|
|
81
|
-
it
|
81
|
+
it do
|
82
82
|
subject
|
83
83
|
Vedeu::Configuration.terminal_mode.must_equal(:cooked)
|
84
|
-
|
84
|
+
end
|
85
85
|
|
86
86
|
context 'when the mode given is not valid' do
|
87
87
|
let(:mode) { :invalid }
|
88
88
|
|
89
89
|
before { described.cooked_mode! }
|
90
90
|
|
91
|
-
it
|
91
|
+
it do
|
92
92
|
subject
|
93
93
|
Vedeu::Configuration.terminal_mode.must_equal(:raw)
|
94
|
-
|
94
|
+
end
|
95
95
|
end
|
96
96
|
end
|
97
97
|
end
|
@@ -18,9 +18,9 @@ module Vedeu
|
|
18
18
|
|
19
19
|
describe '.open' do
|
20
20
|
context 'when a block was not given' do
|
21
|
-
it
|
21
|
+
it do
|
22
22
|
proc { Vedeu::Terminal.open }.must_raise(Vedeu::Error::RequiresBlock)
|
23
|
-
|
23
|
+
end
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'opens a new terminal console in raw mode' do
|
@@ -60,9 +60,11 @@ module Vedeu
|
|
60
60
|
context 'when there are multiple values' do
|
61
61
|
let(:_value) { ['Some output...', 'more output...', 'even more...'] }
|
62
62
|
|
63
|
-
it
|
64
|
-
|
65
|
-
|
63
|
+
it do
|
64
|
+
subject.must_equal(['Some output...',
|
65
|
+
'more output...',
|
66
|
+
'even more...'])
|
67
|
+
end
|
66
68
|
end
|
67
69
|
end
|
68
70
|
|
@@ -71,19 +73,27 @@ module Vedeu
|
|
71
73
|
|
72
74
|
subject { described.resize }
|
73
75
|
|
74
|
-
it
|
76
|
+
it do
|
75
77
|
Vedeu.expects(:trigger).with(:_clear_)
|
76
78
|
subject
|
77
|
-
|
79
|
+
end
|
78
80
|
|
79
|
-
it
|
81
|
+
it do
|
80
82
|
Vedeu.expects(:trigger).with(:_refresh_)
|
81
83
|
subject
|
82
|
-
|
84
|
+
end
|
83
85
|
|
84
86
|
it { subject.must_be_instance_of(TrueClass) }
|
85
87
|
end
|
86
88
|
|
89
|
+
describe '.debugging!' do
|
90
|
+
subject { described.debugging! }
|
91
|
+
|
92
|
+
it 'disables the mouse and shows the cursor' do
|
93
|
+
subject.must_equal(["\e[?9l\e[?25h"])
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
87
97
|
describe '.clear' do
|
88
98
|
subject { described.clear }
|
89
99
|
|
@@ -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(:border)
|
66
66
|
instance.must_respond_to(:border=)
|
67
67
|
instance.must_respond_to(:name)
|
@@ -70,7 +70,7 @@ module Vedeu
|
|
70
70
|
instance.must_respond_to(:parent=)
|
71
71
|
instance.must_respond_to(:attributes)
|
72
72
|
instance.must_respond_to(:value=)
|
73
|
-
|
73
|
+
end
|
74
74
|
end
|
75
75
|
|
76
76
|
describe '#cell?' do
|
@@ -43,12 +43,12 @@ module Vedeu
|
|
43
43
|
end
|
44
44
|
|
45
45
|
describe 'accessors' do
|
46
|
-
it
|
46
|
+
it do
|
47
47
|
instance.must_respond_to(:attributes)
|
48
48
|
instance.must_respond_to(:parent)
|
49
49
|
instance.must_respond_to(:value)
|
50
50
|
instance.must_respond_to(:views)
|
51
|
-
|
51
|
+
end
|
52
52
|
end
|
53
53
|
|
54
54
|
describe '#add' do
|