vedeu 0.8.7 → 0.8.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/TODO.md +8 -0
- data/docs/dsl/by_method/buffer_update.md +3 -1
- data/docs/dsl/by_method/buffer_write.md +3 -1
- data/docs/dsl/by_method/cursor.md +3 -1
- data/docs/dsl/by_method/cursors.md +3 -1
- data/docs/dsl/by_method/direct_write.md +3 -1
- data/docs/dsl/by_method/log_stderr.md +4 -1
- data/docs/dsl/by_method/log_stdout.md +4 -1
- data/docs/dsl/by_method/log_timestamp.md +7 -1
- data/docs/dsl/by_method/render_output.md +3 -1
- data/docs/events/by_name/{geometry_down.md → aliases/geometry_down.md} +0 -0
- data/docs/events/by_name/{geometry_left.md → aliases/geometry_left.md} +0 -0
- data/docs/events/by_name/{geometry_right.md → aliases/geometry_right.md} +0 -0
- data/docs/events/by_name/{geometry_up.md → aliases/geometry_up.md} +0 -0
- data/docs/events/by_name/cursor_down.md +5 -0
- data/docs/events/by_name/cursor_left.md +3 -0
- data/docs/events/by_name/cursor_origin.md +3 -0
- data/docs/events/by_name/cursor_right.md +5 -0
- data/docs/events/by_name/cursor_top.md +3 -0
- data/docs/events/by_name/cursor_up.md +3 -0
- data/docs/events/by_name/hide_cursor.md +6 -1
- data/docs/events/by_name/maximise.md +2 -3
- data/docs/events/by_name/show_cursor.md +6 -1
- data/docs/events/by_name/unmaximise.md +5 -3
- data/docs/events/by_name/view_down.md +8 -0
- data/docs/events/by_name/view_left.md +8 -0
- data/docs/events/by_name/view_right.md +8 -0
- data/docs/events/by_name/view_up.md +8 -0
- data/docs/events/document.md +2 -1
- data/docs/events/focus.md +2 -1
- data/docs/events/menu.md +2 -1
- data/docs/events/movement.md +2 -1
- data/docs/events/refresh.md +2 -1
- data/docs/events/view.md +2 -1
- data/docs/events/visibility.md +2 -1
- data/examples/dsl_horizontal_alignment.rb +1 -1
- data/examples/dsl_vertical_alignment.rb +1 -1
- data/integrations/dsl_app_border_001.rb +63 -0
- data/integrations/dsl_app_border_002.rb +63 -0
- data/integrations/dsl_app_border_003.rb +63 -0
- data/integrations/dsl_app_border_004.rb +63 -0
- data/integrations/dsl_app_border_005.rb +63 -0
- data/integrations/expected/dsl_app_border_001.out +1 -0
- data/integrations/expected/dsl_app_border_002.out +1 -0
- data/integrations/expected/dsl_app_border_003.out +1 -0
- data/integrations/expected/dsl_app_border_004.out +1 -0
- data/integrations/expected/dsl_app_border_005.out +1 -0
- data/integrations/test_runner.sh +7 -0
- data/lib/vedeu.rb +2 -1
- data/lib/vedeu/borders/repository.rb +1 -5
- data/lib/vedeu/cursors/cursor.rb +29 -70
- data/lib/vedeu/cursors/move.rb +11 -4
- data/lib/vedeu/cursors/reposition.rb +2 -2
- data/lib/vedeu/cursors/repository.rb +7 -12
- data/lib/vedeu/dsl/elements.rb +0 -1
- data/lib/vedeu/error.rb +17 -5
- data/lib/vedeu/geometries/dsl/dsl.rb +2 -28
- data/lib/vedeu/geometries/dsl/grid.rb +2 -0
- data/lib/vedeu/geometries/geometry.rb +2 -22
- data/lib/vedeu/geometries/move.rb +45 -10
- data/lib/vedeu/geometries/repository.rb +0 -20
- data/lib/vedeu/input/capture.rb +2 -1
- data/lib/vedeu/logging/log.rb +25 -25
- data/lib/vedeu/renderers/file.rb +0 -5
- data/lib/vedeu/renderers/json.rb +1 -1
- data/lib/vedeu/renderers/options.rb +3 -1
- data/lib/vedeu/renderers/text.rb +0 -7
- data/lib/vedeu/runtime/bootstrap.rb +1 -1
- data/lib/vedeu/runtime/launcher.rb +8 -5
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/application/application_controller_test.rb +2 -4
- data/test/lib/vedeu/cursors/cursor_test.rb +9 -12
- data/test/lib/vedeu/cursors/move_test.rb +7 -3
- data/test/lib/vedeu/geometries/move_test.rb +22 -9
- data/test/lib/vedeu/interfaces/interface_test.rb +71 -73
- data/test/lib/vedeu/logging/log_test.rb +1 -1
- data/test/lib/vedeu/runtime/launcher_test.rb +5 -4
- data/test/support/examples/material_colours_app.rb +59 -8
- data/test/test_helper.rb +1 -0
- metadata +16 -6
data/lib/vedeu/renderers/file.rb
CHANGED
data/lib/vedeu/renderers/json.rb
CHANGED
data/lib/vedeu/renderers/text.rb
CHANGED
@@ -69,15 +69,18 @@ module Vedeu
|
|
69
69
|
terminate!
|
70
70
|
|
71
71
|
rescue StandardError => uncaught_exception
|
72
|
+
message = uncaught_exception.message + "\n"
|
73
|
+
trace = uncaught_exception.backtrace.join("\n")
|
74
|
+
|
72
75
|
output = if Vedeu.config.debug?
|
73
|
-
|
74
|
-
|
76
|
+
message + Vedeu.esc.screen_colour_reset + trace
|
77
|
+
|
75
78
|
else
|
76
|
-
|
79
|
+
message
|
80
|
+
|
77
81
|
end
|
78
82
|
|
79
|
-
Vedeu.
|
80
|
-
Vedeu.log_stdout(type: :error, message: output)
|
83
|
+
Vedeu.log_stderr(message: output)
|
81
84
|
end
|
82
85
|
|
83
86
|
protected
|
data/lib/vedeu/version.rb
CHANGED
@@ -11,10 +11,8 @@ module Vedeu
|
|
11
11
|
let(:params) { {} }
|
12
12
|
|
13
13
|
describe '#initialize' do
|
14
|
-
|
15
|
-
|
16
|
-
it { subject.must_be_instance_of(described) }
|
17
|
-
it { subject.instance_variable_get('@params').must_equal(params) }
|
14
|
+
it { instance.must_be_instance_of(described) }
|
15
|
+
it { instance.instance_variable_get('@params').must_equal(params) }
|
18
16
|
end
|
19
17
|
|
20
18
|
describe '#redirect_to' do
|
@@ -61,18 +61,16 @@ module Vedeu
|
|
61
61
|
end
|
62
62
|
|
63
63
|
describe '#initialize' do
|
64
|
-
|
65
|
-
|
66
|
-
it {
|
67
|
-
it {
|
68
|
-
it { subject.instance_variable_get('@ox').must_equal(ox) }
|
69
|
-
it { subject.instance_variable_get('@oy').must_equal(oy) }
|
64
|
+
it { instance.must_be_instance_of(described) }
|
65
|
+
it { instance.instance_variable_get('@name').must_equal( _name) }
|
66
|
+
it { instance.instance_variable_get('@ox').must_equal(ox) }
|
67
|
+
it { instance.instance_variable_get('@oy').must_equal(oy) }
|
70
68
|
it do
|
71
|
-
|
69
|
+
instance.instance_variable_get('@repository').must_equal(repository)
|
72
70
|
end
|
73
|
-
it {
|
74
|
-
it {
|
75
|
-
it {
|
71
|
+
it { instance.instance_variable_get('@visible').must_equal(true) }
|
72
|
+
it { instance.instance_variable_get('@x').must_equal(x) }
|
73
|
+
it { instance.instance_variable_get('@y').must_equal(y) }
|
76
74
|
end
|
77
75
|
|
78
76
|
describe '#attributes' do
|
@@ -147,8 +145,7 @@ module Vedeu
|
|
147
145
|
|
148
146
|
describe '#inspect' do
|
149
147
|
let(:expected) {
|
150
|
-
"
|
151
|
-
"visible:true>"
|
148
|
+
"name:'vedeu_cursors_cursor' x:19 y:8 ox:3 oy:2 visible:true"
|
152
149
|
}
|
153
150
|
|
154
151
|
subject { instance.inspect }
|
@@ -9,15 +9,19 @@ module Vedeu
|
|
9
9
|
describe Move do
|
10
10
|
|
11
11
|
let(:described) { Vedeu::Cursors::Move }
|
12
|
-
let(:instance) { described.new(_name, direction) }
|
12
|
+
let(:instance) { described.new(_name, direction, offset) }
|
13
13
|
let(:_name) {}
|
14
14
|
let(:direction) {}
|
15
|
+
let(:offset) { 1 }
|
15
16
|
let(:visible) { true }
|
16
17
|
|
17
18
|
describe '#initialize' do
|
18
19
|
it { instance.must_be_instance_of(described) }
|
19
20
|
it { instance.instance_variable_get('@name').must_equal(_name) }
|
20
|
-
it
|
21
|
+
it do
|
22
|
+
instance.instance_variable_get('@direction').must_equal(direction)
|
23
|
+
end
|
24
|
+
it { instance.instance_variable_get('@offset').must_equal(offset) }
|
21
25
|
end
|
22
26
|
|
23
27
|
describe '.move' do
|
@@ -29,7 +33,7 @@ module Vedeu
|
|
29
33
|
Vedeu.stubs(:trigger).with(:_refresh_cursor_, _name)
|
30
34
|
end
|
31
35
|
|
32
|
-
subject { described.move(_name, direction) }
|
36
|
+
subject { described.move(_name, direction, offset) }
|
33
37
|
|
34
38
|
context 'when a name is given' do
|
35
39
|
let(:_name) { :vedeu_cursors_move }
|
@@ -12,7 +12,7 @@ module Vedeu
|
|
12
12
|
let(:instance) { described.new(attributes) }
|
13
13
|
let(:direction) {}
|
14
14
|
let(:_name) { :vedeu_geometries_move }
|
15
|
-
let(:offset) {}
|
15
|
+
let(:offset) { 1 }
|
16
16
|
let(:attributes) {
|
17
17
|
{
|
18
18
|
direction: direction,
|
@@ -24,14 +24,7 @@ module Vedeu
|
|
24
24
|
Vedeu::Geometries::Geometry.new(name: _name, x: 2, xn: 8, y: 2, yn: 8)
|
25
25
|
}
|
26
26
|
|
27
|
-
before
|
28
|
-
Vedeu.stubs(:trigger).with(:_movement_refresh_, _name)
|
29
|
-
Vedeu.stubs(:trigger).with(:_cursor_down_, _name)
|
30
|
-
Vedeu.stubs(:trigger).with(:_cursor_left_, _name)
|
31
|
-
Vedeu.stubs(:trigger).with(:_cursor_origin_, _name)
|
32
|
-
Vedeu.stubs(:trigger).with(:_cursor_right_, _name)
|
33
|
-
Vedeu.stubs(:trigger).with(:_cursor_up_, _name)
|
34
|
-
end
|
27
|
+
before { Vedeu.stubs(:trigger).with(:_movement_refresh_, _name) }
|
35
28
|
|
36
29
|
describe '#initialize' do
|
37
30
|
it { instance.must_be_instance_of(described) }
|
@@ -81,6 +74,10 @@ module Vedeu
|
|
81
74
|
context 'when the direction is :down' do
|
82
75
|
let(:direction) { :down }
|
83
76
|
|
77
|
+
before do
|
78
|
+
Vedeu.stubs(:trigger).with(:_cursor_down_, _name, 0)
|
79
|
+
end
|
80
|
+
|
84
81
|
context 'when y + offset > terminal height' do
|
85
82
|
let(:offset) { 3 }
|
86
83
|
|
@@ -99,6 +96,10 @@ module Vedeu
|
|
99
96
|
context 'when the direction is :left' do
|
100
97
|
let(:direction) { :left }
|
101
98
|
|
99
|
+
before do
|
100
|
+
Vedeu.stubs(:trigger).with(:_cursor_left_, _name, 0)
|
101
|
+
end
|
102
|
+
|
102
103
|
context 'when x - offset < 1' do
|
103
104
|
let(:offset) { 3 }
|
104
105
|
|
@@ -124,6 +125,10 @@ module Vedeu
|
|
124
125
|
context 'when the direction is :origin' do
|
125
126
|
let(:direction) { :origin }
|
126
127
|
|
128
|
+
before do
|
129
|
+
Vedeu.stubs(:trigger).with(:_cursor_origin_, _name)
|
130
|
+
end
|
131
|
+
|
127
132
|
it { subject.must_be_instance_of(Vedeu::Geometries::Geometry) }
|
128
133
|
it { subject.x.must_equal(1) }
|
129
134
|
it { subject.xn.must_equal(7) }
|
@@ -134,6 +139,10 @@ module Vedeu
|
|
134
139
|
context 'when the direction is :right' do
|
135
140
|
let(:direction) { :right }
|
136
141
|
|
142
|
+
before do
|
143
|
+
Vedeu.stubs(:trigger).with(:_cursor_right_, _name, 0)
|
144
|
+
end
|
145
|
+
|
137
146
|
context 'when xn + offset > terminal width' do
|
138
147
|
let(:offset) { 3 }
|
139
148
|
|
@@ -152,6 +161,10 @@ module Vedeu
|
|
152
161
|
context 'when the direction is :up' do
|
153
162
|
let(:direction) { :up }
|
154
163
|
|
164
|
+
before do
|
165
|
+
Vedeu.stubs(:trigger).with(:_cursor_up_, _name, 0)
|
166
|
+
end
|
167
|
+
|
155
168
|
context 'when y - offset < 1' do
|
156
169
|
let(:offset) { 3 }
|
157
170
|
|
@@ -39,105 +39,103 @@ module Vedeu
|
|
39
39
|
let(:zindex) { 1 }
|
40
40
|
|
41
41
|
describe '#initialize' do
|
42
|
-
|
43
|
-
|
44
|
-
it { subject.must_be_instance_of(described) }
|
45
|
-
it { subject.instance_variable_get('@client').must_equal(client) }
|
42
|
+
it { instance.must_be_instance_of(described) }
|
43
|
+
it { instance.instance_variable_get('@client').must_equal(client) }
|
46
44
|
it do
|
47
|
-
|
45
|
+
instance.instance_variable_get('@cursor_visible').
|
48
46
|
must_equal(cursor_visible)
|
49
47
|
end
|
50
|
-
it {
|
51
|
-
it {
|
52
|
-
it {
|
53
|
-
it {
|
54
|
-
it {
|
48
|
+
it { instance.instance_variable_get('@delay').must_equal(delay) }
|
49
|
+
it { instance.instance_variable_get('@editable').must_equal(editable) }
|
50
|
+
it { instance.instance_variable_get('@group').must_equal(group) }
|
51
|
+
it { instance.instance_variable_get('@name').must_equal(_name) }
|
52
|
+
it { instance.instance_variable_get('@parent').must_equal(parent) }
|
55
53
|
it do
|
56
|
-
|
54
|
+
instance.instance_variable_get('@repository').must_equal(repository)
|
57
55
|
end
|
58
|
-
it {
|
59
|
-
it {
|
56
|
+
it { instance.instance_variable_get('@visible').must_equal(visible) }
|
57
|
+
it { instance.instance_variable_get('@zindex').must_equal(zindex) }
|
60
58
|
end
|
61
59
|
|
62
|
-
|
63
|
-
it { instance.must_respond_to(:client) }
|
64
|
-
end
|
60
|
+
describe '#client' do
|
61
|
+
it { instance.must_respond_to(:client) }
|
62
|
+
end
|
65
63
|
|
66
|
-
|
67
|
-
it { instance.must_respond_to(:client=) }
|
68
|
-
end
|
64
|
+
describe '#client=' do
|
65
|
+
it { instance.must_respond_to(:client=) }
|
66
|
+
end
|
69
67
|
|
70
|
-
|
71
|
-
it { instance.must_respond_to(:cursor_visible) }
|
72
|
-
end
|
68
|
+
describe '#cursor_visible' do
|
69
|
+
it { instance.must_respond_to(:cursor_visible) }
|
70
|
+
end
|
73
71
|
|
74
|
-
|
75
|
-
it { instance.must_respond_to(:cursor_visible=) }
|
76
|
-
end
|
72
|
+
describe '#cursor_visible=' do
|
73
|
+
it { instance.must_respond_to(:cursor_visible=) }
|
74
|
+
end
|
77
75
|
|
78
|
-
|
79
|
-
it { instance.must_respond_to(:delay) }
|
80
|
-
end
|
76
|
+
describe '#delay' do
|
77
|
+
it { instance.must_respond_to(:delay) }
|
78
|
+
end
|
81
79
|
|
82
|
-
|
83
|
-
it { instance.must_respond_to(:delay=) }
|
84
|
-
end
|
80
|
+
describe '#delay=' do
|
81
|
+
it { instance.must_respond_to(:delay=) }
|
82
|
+
end
|
85
83
|
|
86
|
-
|
87
|
-
it { instance.must_respond_to(:editable) }
|
88
|
-
end
|
84
|
+
describe '#editable' do
|
85
|
+
it { instance.must_respond_to(:editable) }
|
86
|
+
end
|
89
87
|
|
90
|
-
|
91
|
-
it { instance.must_respond_to(:editable=) }
|
92
|
-
end
|
88
|
+
describe '#editable=' do
|
89
|
+
it { instance.must_respond_to(:editable=) }
|
90
|
+
end
|
93
91
|
|
94
|
-
|
95
|
-
it { instance.must_respond_to(:editable?) }
|
96
|
-
end
|
92
|
+
describe '#editable?' do
|
93
|
+
it { instance.must_respond_to(:editable?) }
|
94
|
+
end
|
97
95
|
|
98
|
-
|
99
|
-
it { instance.must_respond_to(:group) }
|
100
|
-
end
|
96
|
+
describe '#group' do
|
97
|
+
it { instance.must_respond_to(:group) }
|
98
|
+
end
|
101
99
|
|
102
|
-
|
103
|
-
it { instance.must_respond_to(:group=) }
|
104
|
-
end
|
100
|
+
describe '#group=' do
|
101
|
+
it { instance.must_respond_to(:group=) }
|
102
|
+
end
|
105
103
|
|
106
|
-
|
107
|
-
it { instance.must_respond_to(:name) }
|
108
|
-
end
|
104
|
+
describe '#name' do
|
105
|
+
it { instance.must_respond_to(:name) }
|
106
|
+
end
|
109
107
|
|
110
|
-
|
111
|
-
it { instance.must_respond_to(:name=) }
|
112
|
-
end
|
108
|
+
describe '#name=' do
|
109
|
+
it { instance.must_respond_to(:name=) }
|
110
|
+
end
|
113
111
|
|
114
|
-
|
115
|
-
it { instance.must_respond_to(:parent) }
|
116
|
-
end
|
112
|
+
describe '#parent' do
|
113
|
+
it { instance.must_respond_to(:parent) }
|
114
|
+
end
|
117
115
|
|
118
|
-
|
119
|
-
it { instance.must_respond_to(:parent=) }
|
120
|
-
end
|
116
|
+
describe '#parent=' do
|
117
|
+
it { instance.must_respond_to(:parent=) }
|
118
|
+
end
|
121
119
|
|
122
|
-
|
123
|
-
it { instance.must_respond_to(:zindex) }
|
124
|
-
end
|
120
|
+
describe '#zindex' do
|
121
|
+
it { instance.must_respond_to(:zindex) }
|
122
|
+
end
|
125
123
|
|
126
|
-
|
127
|
-
it { instance.must_respond_to(:zindex=) }
|
128
|
-
end
|
124
|
+
describe '#zindex=' do
|
125
|
+
it { instance.must_respond_to(:zindex=) }
|
126
|
+
end
|
129
127
|
|
130
|
-
|
131
|
-
it { instance.must_respond_to(:visible) }
|
132
|
-
end
|
128
|
+
describe '#visible' do
|
129
|
+
it { instance.must_respond_to(:visible) }
|
130
|
+
end
|
133
131
|
|
134
|
-
|
135
|
-
it { instance.must_respond_to(:visible=) }
|
136
|
-
end
|
132
|
+
describe '#visible=' do
|
133
|
+
it { instance.must_respond_to(:visible=) }
|
134
|
+
end
|
137
135
|
|
138
|
-
|
139
|
-
it { instance.must_respond_to(:visible?) }
|
140
|
-
end
|
136
|
+
describe '#visible?' do
|
137
|
+
it { instance.must_respond_to(:visible?) }
|
138
|
+
end
|
141
139
|
|
142
140
|
describe '#attributes' do
|
143
141
|
subject { instance.attributes }
|
@@ -39,7 +39,6 @@ module Vedeu
|
|
39
39
|
|
40
40
|
describe '#execute!' do
|
41
41
|
before do
|
42
|
-
Vedeu.stubs(:log_stdout)
|
43
42
|
Vedeu::Runtime::Application.stubs(:start)
|
44
43
|
Kernel.stubs(:exit)
|
45
44
|
Kernel.stubs(:puts)
|
@@ -63,8 +62,10 @@ module Vedeu
|
|
63
62
|
context 'but debugging is disabled' do
|
64
63
|
let(:debug) { false }
|
65
64
|
|
65
|
+
before { Vedeu.stubs(:log_stderr).with(message: "Oops!\n") }
|
66
|
+
|
66
67
|
it do
|
67
|
-
Vedeu.expects(:
|
68
|
+
Vedeu.expects(:log_stderr).with(message: "Oops!\n")
|
68
69
|
subject
|
69
70
|
end
|
70
71
|
end
|
@@ -72,9 +73,9 @@ module Vedeu
|
|
72
73
|
context 'and debugging is enabled' do
|
73
74
|
let(:debug) { true }
|
74
75
|
|
75
|
-
# Need to stub a backtrace.
|
76
|
+
# @todo Need to stub a backtrace.
|
76
77
|
# it do
|
77
|
-
# Vedeu.expects(:
|
78
|
+
# Vedeu.expects(:log_stderr).with(message: "Oops!\n")
|
78
79
|
# subject
|
79
80
|
# end
|
80
81
|
end
|