vedeu 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vedeu/all.rb +1 -1
- data/lib/vedeu/application/controller.rb +2 -2
- data/lib/vedeu/bindings.rb +1 -1
- data/lib/vedeu/bindings/application.rb +2 -2
- data/lib/vedeu/bindings/drb.rb +8 -8
- data/lib/vedeu/bindings/menus.rb +11 -11
- data/lib/vedeu/bindings/movement.rb +12 -12
- data/lib/vedeu/bindings/system.rb +18 -18
- data/lib/vedeu/bindings/visibility.rb +9 -9
- data/lib/vedeu/colours/colour.rb +1 -1
- data/lib/vedeu/common.rb +1 -1
- data/lib/vedeu/dsl/composition.rb +8 -3
- data/lib/vedeu/dsl/interface.rb +41 -17
- data/lib/vedeu/log/debug.rb +5 -1
- data/lib/vedeu/log/log.rb +1 -0
- data/lib/vedeu/models/interface.rb +3 -2
- data/lib/vedeu/plugins.rb +1 -1
- data/lib/vedeu/runtime/bootstrap.rb +0 -3
- data/lib/vedeu/runtime/launcher.rb +3 -2
- data/lib/vedeu/runtime/router.rb +49 -47
- data/lib/vedeu/{traps.rb → runtime/traps.rb} +0 -0
- data/lib/vedeu/templating/decoder.rb +4 -2
- data/lib/vedeu/templating/encoder.rb +4 -2
- data/lib/vedeu/templating/view_template.rb +35 -2
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/application/application_view_test.rb +1 -1
- data/test/lib/vedeu/application/controller_test.rb +4 -0
- data/test/lib/vedeu/bindings_test.rb +2 -0
- data/test/lib/vedeu/borders/border_test.rb +28 -40
- data/test/lib/vedeu/borders/borders_test.rb +0 -2
- data/test/lib/vedeu/borders/render_border_test.rb +11 -13
- data/test/lib/vedeu/buffers/buffer_test.rb +12 -5
- data/test/lib/vedeu/buffers/display_buffer_test.rb +2 -2
- data/test/lib/vedeu/cli/generator/application_test.rb +9 -9
- data/test/lib/vedeu/cli/generator/view_test.rb +10 -7
- data/test/lib/vedeu/cli/main_test.rb +4 -4
- data/test/lib/vedeu/colours/colour_translator_test.rb +2 -4
- data/test/lib/vedeu/common_test.rb +8 -0
- data/test/lib/vedeu/configuration/configuration_test.rb +4 -4
- data/test/lib/vedeu/cursor/cursors_test.rb +4 -4
- data/test/lib/vedeu/cursor/move_test.rb +11 -8
- data/test/lib/vedeu/cursor/refresh_cursor_test.rb +12 -12
- data/test/lib/vedeu/cursor/reposition_test.rb +7 -11
- data/test/lib/vedeu/distributed/client_test.rb +4 -4
- data/test/lib/vedeu/distributed/server_test.rb +4 -5
- data/test/lib/vedeu/dsl/border_test.rb +2 -2
- data/test/lib/vedeu/dsl/composition_test.rb +5 -4
- data/test/lib/vedeu/dsl/geometry_test.rb +6 -4
- data/test/lib/vedeu/dsl/interface_test.rb +9 -27
- data/test/lib/vedeu/dsl/use_test.rb +2 -2
- data/test/lib/vedeu/events/trigger_test.rb +2 -2
- data/test/lib/vedeu/geometry/coordinate_test.rb +9 -9
- data/test/lib/vedeu/geometry/geometry_test.rb +8 -2
- data/test/lib/vedeu/geometry/position_validator_test.rb +11 -14
- data/test/lib/vedeu/input/input_test.rb +5 -5
- data/test/lib/vedeu/input/keymap_test.rb +2 -2
- data/test/lib/vedeu/log/timer_test.rb +2 -2
- data/test/lib/vedeu/models/focus_test.rb +20 -25
- data/test/lib/vedeu/models/interface_test.rb +2 -2
- data/test/lib/vedeu/models/interfaces_test.rb +7 -5
- data/test/lib/vedeu/models/line_test.rb +0 -5
- data/test/lib/vedeu/models/menu_test.rb +0 -2
- data/test/lib/vedeu/null/geometry_test.rb +1 -4
- data/test/lib/vedeu/output/clear/named_interface_test.rb +2 -2
- data/test/lib/vedeu/output/esc_test.rb +7 -4
- data/test/lib/vedeu/output/output_test.rb +3 -6
- data/test/lib/vedeu/output/refresh_test.rb +2 -2
- data/test/lib/vedeu/output/renderers/file_test.rb +1 -3
- data/test/lib/vedeu/output/renderers/html_test.rb +1 -3
- data/test/lib/vedeu/output/renderers/json_test.rb +1 -3
- data/test/lib/vedeu/output/renderers_test.rb +2 -2
- data/test/lib/vedeu/output/viewport_test.rb +70 -71
- data/test/lib/vedeu/repositories/model_test.rb +0 -19
- data/test/lib/vedeu/repositories/repository_test.rb +8 -8
- data/test/lib/vedeu/runtime/application_test.rb +2 -2
- data/test/lib/vedeu/runtime/launcher_test.rb +7 -7
- data/test/lib/vedeu/runtime/router_test.rb +33 -33
- data/test/lib/vedeu/{traps_test.rb → runtime/traps_test.rb} +2 -2
- data/test/lib/vedeu/templating/decoder_test.rb +1 -0
- data/test/lib/vedeu/templating/encoder_test.rb +1 -0
- data/test/lib/vedeu/templating/template_test.rb +8 -1
- data/test/lib/vedeu/templating/view_template_test.rb +108 -22
- data/test/lib/vedeu/terminal_mode_test.rb +2 -2
- data/test/lib/vedeu/terminal_test.rb +6 -6
- data/test/support/helpers/model_test_class.rb +19 -0
- metadata +5 -17
- data/test/support/templates/background.erb +0 -1
- data/test/support/templates/colour.erb +0 -1
- data/test/support/templates/foreground.erb +0 -1
- data/test/support/templates/multiple.erb +0 -2
- data/test/support/templates/plain.erb +0 -1
- data/test/support/templates/style.erb +0 -1
File without changes
|
@@ -2,7 +2,7 @@ module Vedeu
|
|
2
2
|
|
3
3
|
module Templating
|
4
4
|
|
5
|
-
# Converts an encoded string back into an object or objects.
|
5
|
+
# Converts an encoded string back into an object or collection of objects.
|
6
6
|
#
|
7
7
|
class Decoder
|
8
8
|
|
@@ -20,6 +20,8 @@ module Vedeu
|
|
20
20
|
@data = data
|
21
21
|
end
|
22
22
|
|
23
|
+
# Converts an encoded string back into an object or collection of objects.
|
24
|
+
#
|
23
25
|
# @return [Object]
|
24
26
|
def process
|
25
27
|
demarshal
|
@@ -55,7 +57,7 @@ module Vedeu
|
|
55
57
|
Base64.strict_decode64(unwrap)
|
56
58
|
end
|
57
59
|
|
58
|
-
# Removes
|
60
|
+
# Removes delimiters from the start and end of the data.
|
59
61
|
#
|
60
62
|
# @return [String]
|
61
63
|
def unwrap
|
@@ -2,7 +2,7 @@ module Vedeu
|
|
2
2
|
|
3
3
|
module Templating
|
4
4
|
|
5
|
-
# Converts an object or objects into an encoded
|
5
|
+
# Converts an object or collection of objects into an encoded String.
|
6
6
|
#
|
7
7
|
class Encoder
|
8
8
|
|
@@ -20,6 +20,8 @@ module Vedeu
|
|
20
20
|
@data = data
|
21
21
|
end
|
22
22
|
|
23
|
+
# Converts an object or collection of objects into an encoded String.
|
24
|
+
#
|
23
25
|
# @return [String]
|
24
26
|
def process
|
25
27
|
wrap
|
@@ -33,7 +35,7 @@ module Vedeu
|
|
33
35
|
|
34
36
|
private
|
35
37
|
|
36
|
-
# Adds
|
38
|
+
# Adds delimiters to the start and end of the data.
|
37
39
|
#
|
38
40
|
# @return [String]
|
39
41
|
def wrap
|
@@ -23,7 +23,9 @@ module Vedeu
|
|
23
23
|
Vedeu::Templating::Decoder.process(stream)
|
24
24
|
|
25
25
|
else
|
26
|
-
Vedeu::Stream.new(
|
26
|
+
Vedeu::Stream.new(colour: default_colour,
|
27
|
+
style: default_style,
|
28
|
+
value: stream)
|
27
29
|
|
28
30
|
end
|
29
31
|
end
|
@@ -46,10 +48,41 @@ module Vedeu
|
|
46
48
|
|
47
49
|
private
|
48
50
|
|
51
|
+
# @return [Vedeu::Colour|Hash<Symbol => Symbol>]
|
52
|
+
def default_colour
|
53
|
+
if interface?
|
54
|
+
interface.colour
|
55
|
+
|
56
|
+
else
|
57
|
+
{
|
58
|
+
background: :default,
|
59
|
+
foreground: :default,
|
60
|
+
}
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# @return [Symbol]
|
66
|
+
def default_style
|
67
|
+
if interface?
|
68
|
+
interface.style
|
69
|
+
|
70
|
+
else
|
71
|
+
:normal
|
72
|
+
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# @return [Vedeu::Interface]
|
77
|
+
def interface
|
78
|
+
Vedeu.interfaces.by_name(options[:name]) if options[:name]
|
79
|
+
end
|
80
|
+
alias_method :interface?, :interface
|
81
|
+
|
49
82
|
# @param line [String]
|
50
83
|
# @return [Array<String>]
|
51
84
|
def streams_for(line)
|
52
|
-
line.split(/({{
|
85
|
+
line.split(/({{\s*[^}]+\s*}})/)
|
53
86
|
end
|
54
87
|
|
55
88
|
# @return [Array<String>]
|
data/lib/vedeu/version.rb
CHANGED
@@ -34,6 +34,8 @@ module Vedeu
|
|
34
34
|
with(:some_controller, 'Vedeu::ControllerTestKlass')
|
35
35
|
subject
|
36
36
|
}
|
37
|
+
|
38
|
+
it { subject.must_be_instance_of(Hash) }
|
37
39
|
end
|
38
40
|
|
39
41
|
describe '.action' do
|
@@ -46,6 +48,8 @@ module Vedeu
|
|
46
48
|
with(:some_controller, :other_action)
|
47
49
|
subject
|
48
50
|
}
|
51
|
+
|
52
|
+
it { subject.must_be_instance_of(Array) }
|
49
53
|
end
|
50
54
|
|
51
55
|
end # ClassMethods
|
@@ -113,18 +113,13 @@ module Vedeu
|
|
113
113
|
let(:bottom) { false }
|
114
114
|
let(:left) { false }
|
115
115
|
let(:right) { false }
|
116
|
+
let(:geometry) {
|
117
|
+
Vedeu::Geometry.new(name: 'Border#bxbxnbybyn', x: 2, xn: 6, y: 2, yn: 6)
|
118
|
+
}
|
116
119
|
|
117
|
-
before
|
118
|
-
Vedeu.
|
119
|
-
|
120
|
-
x 2
|
121
|
-
xn 6
|
122
|
-
y 2
|
123
|
-
yn 6
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
after { Vedeu.interfaces.reset }
|
120
|
+
before {
|
121
|
+
Vedeu.geometries.stubs(:by_name).returns(geometry)
|
122
|
+
}
|
128
123
|
|
129
124
|
describe '#bx' do
|
130
125
|
subject { instance.bx }
|
@@ -216,14 +211,12 @@ module Vedeu
|
|
216
211
|
end
|
217
212
|
|
218
213
|
describe '#width' do
|
219
|
-
|
220
|
-
Vedeu.
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
end
|
226
|
-
after { Vedeu.interfaces.reset }
|
214
|
+
let(:geometry) {
|
215
|
+
Vedeu::Geometry.new(name: 'borders', width: 8)
|
216
|
+
}
|
217
|
+
before {
|
218
|
+
Vedeu.geometries.stubs(:by_name).returns(geometry)
|
219
|
+
}
|
227
220
|
|
228
221
|
subject { instance.width }
|
229
222
|
|
@@ -273,14 +266,12 @@ module Vedeu
|
|
273
266
|
end
|
274
267
|
|
275
268
|
describe '#height' do
|
276
|
-
|
277
|
-
Vedeu.
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
end
|
283
|
-
after { Vedeu.interfaces.reset }
|
269
|
+
let(:geometry) {
|
270
|
+
Vedeu::Geometry.new(name: 'borders', height: 5)
|
271
|
+
}
|
272
|
+
before {
|
273
|
+
Vedeu.geometries.stubs(:by_name).returns(geometry)
|
274
|
+
}
|
284
275
|
|
285
276
|
subject { instance.height }
|
286
277
|
|
@@ -441,19 +432,16 @@ module Vedeu
|
|
441
432
|
let(:left) { false }
|
442
433
|
let(:right) { false }
|
443
434
|
let(:visibility) { true }
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
end
|
455
|
-
end
|
456
|
-
after { Vedeu.interfaces.reset }
|
435
|
+
let(:geometry) {
|
436
|
+
Vedeu::Geometry.new(name: 'Border#render', x: 1, xn: 4, y: 1, yn: 4)
|
437
|
+
}
|
438
|
+
let(:interface) {
|
439
|
+
Vedeu::Interface.new(visible: visibility)
|
440
|
+
}
|
441
|
+
before {
|
442
|
+
Vedeu.interfaces.stubs(:by_name).returns(interface)
|
443
|
+
Vedeu.geometries.stubs(:by_name).returns(geometry)
|
444
|
+
}
|
457
445
|
|
458
446
|
subject { instance.render }
|
459
447
|
|
@@ -6,10 +6,7 @@ module Vedeu
|
|
6
6
|
|
7
7
|
let(:described) { Vedeu::RenderBorder }
|
8
8
|
let(:instance) { described.new(border) }
|
9
|
-
let(:border) {
|
10
|
-
Vedeu::Border.new(enabled: enabled,
|
11
|
-
name: _name).store
|
12
|
-
}
|
9
|
+
let(:border) { Vedeu::Border.new(enabled: enabled, name: _name) }
|
13
10
|
let(:visible) { false }
|
14
11
|
let(:enabled) { false }
|
15
12
|
let(:_name) { 'Vedeu::RenderBorder' }
|
@@ -22,15 +19,16 @@ module Vedeu
|
|
22
19
|
end
|
23
20
|
|
24
21
|
describe '#render' do
|
25
|
-
|
26
|
-
Vedeu::Geometry.new(name: _name, x: 1, xn: 3, y: 1, yn: 3)
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
Vedeu.
|
33
|
-
|
22
|
+
let(:geometry) {
|
23
|
+
Vedeu::Geometry.new(name: _name, x: 1, xn: 3, y: 1, yn: 3)
|
24
|
+
}
|
25
|
+
let(:interface) {
|
26
|
+
Vedeu::Interface.new(name: _name, visible: visible)
|
27
|
+
}
|
28
|
+
before {
|
29
|
+
Vedeu.geometries.stubs(:by_name).returns(geometry)
|
30
|
+
Vedeu.interfaces.stubs(:by_name).returns(interface)
|
31
|
+
}
|
34
32
|
|
35
33
|
subject { instance.render }
|
36
34
|
|
@@ -20,11 +20,6 @@ module Vedeu
|
|
20
20
|
let(:previous) {}
|
21
21
|
let(:interface) {}
|
22
22
|
|
23
|
-
before do
|
24
|
-
Vedeu.stubs(:trigger)
|
25
|
-
end
|
26
|
-
after { Vedeu.interfaces.reset }
|
27
|
-
|
28
23
|
describe '#initialize' do
|
29
24
|
it { instance.must_be_instance_of(described) }
|
30
25
|
it { instance.instance_variable_get('@name').must_equal(_name) }
|
@@ -62,6 +57,9 @@ module Vedeu
|
|
62
57
|
end
|
63
58
|
}
|
64
59
|
|
60
|
+
before { Vedeu.stubs(:trigger) }
|
61
|
+
after { Vedeu.interfaces.reset }
|
62
|
+
|
65
63
|
subject { instance.add(content) }
|
66
64
|
|
67
65
|
it { subject.must_equal(true) }
|
@@ -76,6 +74,9 @@ module Vedeu
|
|
76
74
|
end
|
77
75
|
|
78
76
|
describe '#back?' do
|
77
|
+
before { Vedeu.stubs(:trigger) }
|
78
|
+
after { Vedeu.interfaces.reset }
|
79
|
+
|
79
80
|
subject { instance.back? }
|
80
81
|
|
81
82
|
context 'with content' do
|
@@ -96,6 +97,9 @@ module Vedeu
|
|
96
97
|
end
|
97
98
|
|
98
99
|
describe '#front?' do
|
100
|
+
before { Vedeu.stubs(:trigger) }
|
101
|
+
after { Vedeu.interfaces.reset }
|
102
|
+
|
99
103
|
subject { instance.front? }
|
100
104
|
|
101
105
|
context 'with content' do
|
@@ -115,6 +119,9 @@ module Vedeu
|
|
115
119
|
end
|
116
120
|
|
117
121
|
describe '#previous?' do
|
122
|
+
before { Vedeu.stubs(:trigger) }
|
123
|
+
after { Vedeu.interfaces.reset }
|
124
|
+
|
118
125
|
subject { instance.previous? }
|
119
126
|
|
120
127
|
context 'with content' do
|
@@ -31,11 +31,11 @@ module Vedeu
|
|
31
31
|
let(:example_model) { Vedeu::TestInterfaceModel }
|
32
32
|
let(:example_instance) { example_model.new }
|
33
33
|
|
34
|
-
before
|
34
|
+
before {
|
35
35
|
example_instance.store
|
36
36
|
|
37
37
|
Vedeu::Refresh.stubs(:by_name)
|
38
|
-
|
38
|
+
}
|
39
39
|
after { Vedeu.interfaces.reset }
|
40
40
|
|
41
41
|
describe '#store_immediate' do
|
@@ -10,26 +10,26 @@ module Vedeu
|
|
10
10
|
let(:instance) { described.new(_name) }
|
11
11
|
let(:_name) { 'my_first_app' }
|
12
12
|
|
13
|
-
before do
|
14
|
-
FileUtils.stubs(:cp_r)
|
15
|
-
FileUtils.stubs(:mkdir)
|
16
|
-
end
|
17
|
-
|
18
13
|
describe '#initialize' do
|
19
14
|
it { instance.must_be_instance_of(described) }
|
20
15
|
it { instance.instance_variable_get('@name').must_equal(_name) }
|
21
16
|
end
|
22
17
|
|
23
18
|
describe '.generate' do
|
24
|
-
|
25
|
-
|
19
|
+
# before {
|
20
|
+
# FileUtils.stubs(:cp_r)
|
21
|
+
# FileUtils.stubs(:mkdir)
|
22
|
+
# }
|
26
23
|
|
27
|
-
|
28
|
-
subject { instance.generate }
|
24
|
+
subject { instance.generate(_name) }
|
29
25
|
|
30
26
|
# @todo Add more tests.
|
31
27
|
end
|
32
28
|
|
29
|
+
describe '#generate' do
|
30
|
+
it { instance.must_respond_to(:generate) }
|
31
|
+
end
|
32
|
+
|
33
33
|
end # Application
|
34
34
|
|
35
35
|
end # Generator
|
@@ -10,22 +10,25 @@ module Vedeu
|
|
10
10
|
let(:instance) { described.new(_name) }
|
11
11
|
let(:_name) { 'my_first_view' }
|
12
12
|
|
13
|
-
before do
|
14
|
-
FileUtils.stubs(:cp_r)
|
15
|
-
FileUtils.stubs(:mkdir)
|
16
|
-
end
|
17
|
-
|
18
13
|
describe '#initialize' do
|
19
14
|
it { instance.must_be_instance_of(described) }
|
20
15
|
it { instance.instance_variable_get('@name').must_equal(_name) }
|
21
16
|
end
|
22
17
|
|
23
18
|
describe '.generate' do
|
24
|
-
|
19
|
+
# before {
|
20
|
+
# FileUtils.stubs(:cp_r)
|
21
|
+
# FileUtils.stubs(:mkdir)
|
22
|
+
# }
|
23
|
+
|
24
|
+
subject { described.generate(_name) }
|
25
|
+
|
26
|
+
# @todo
|
27
|
+
# it { skip }
|
25
28
|
end
|
26
29
|
|
27
30
|
describe '#generate' do
|
28
|
-
|
31
|
+
it { described.must_respond_to(:generate) }
|
29
32
|
end
|
30
33
|
|
31
34
|
end # View
|
@@ -12,10 +12,10 @@ module Vedeu
|
|
12
12
|
describe '#new' do
|
13
13
|
let(:_name) { 'app_name' }
|
14
14
|
|
15
|
-
before
|
15
|
+
before {
|
16
16
|
instance.stubs(:say)
|
17
17
|
Vedeu::Generator::Application.stubs(:generate).returns('')
|
18
|
-
|
18
|
+
}
|
19
19
|
|
20
20
|
subject { instance.new(_name) }
|
21
21
|
|
@@ -28,10 +28,10 @@ module Vedeu
|
|
28
28
|
describe '#view' do
|
29
29
|
let(:_name) { 'view_name' }
|
30
30
|
|
31
|
-
before
|
31
|
+
before {
|
32
32
|
instance.stubs(:say)
|
33
33
|
Vedeu::Generator::View.stubs(:generate).returns('')
|
34
|
-
|
34
|
+
}
|
35
35
|
|
36
36
|
subject { instance.view(_name) }
|
37
37
|
|