vedeu 0.8.4 → 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/TODO.md +4 -0
- data/docs/dsl.md +1 -11
- data/docs/dsl/by_method/geometry/align.md +1 -0
- data/docs/dsl/by_method/geometry/align_bottom.md +40 -0
- data/docs/dsl/by_method/geometry/align_centre.md +40 -0
- data/docs/dsl/by_method/geometry/align_left.md +40 -0
- data/docs/dsl/by_method/geometry/align_middle.md +40 -0
- data/docs/dsl/by_method/geometry/align_right.md +40 -0
- data/docs/dsl/by_method/geometry/align_top.md +40 -0
- data/docs/dsl/by_method/geometry/columns.md +1 -0
- data/docs/dsl/by_method/geometry/height.md +0 -0
- data/docs/dsl/by_method/geometry/horizontal_alignment.md +1 -0
- data/docs/dsl/by_method/geometry/rows.md +1 -0
- data/docs/dsl/by_method/geometry/vertical_alignment.md +1 -0
- data/docs/dsl/by_method/geometry/width.md +0 -0
- data/docs/dsl/by_method/geometry/x.md +1 -0
- data/docs/dsl/by_method/geometry/xn.md +1 -0
- data/docs/dsl/by_method/geometry/y.md +1 -0
- data/docs/dsl/by_method/geometry/yn.md +1 -0
- data/docs/dsl/by_method/render.md +5 -1
- data/docs/dsl/by_method/renders.md +31 -1
- data/docs/dsl/by_method/view.md +26 -0
- data/docs/dsl/by_method/view/stream.md +18 -0
- data/docs/dsl/by_method/views.md +32 -1
- data/docs/events/by_name/set_border_caption.md +2 -4
- data/docs/events/by_name/set_border_title.md +2 -4
- data/examples/views/empty_template.rb +0 -4
- data/examples/views/full_screen.rb +30 -5
- data/examples/views/misc_view.rb +464 -0
- data/examples/views/wordwrap.rb +72 -0
- data/examples/views/wordwrap.txt +8 -0
- data/integrations/dsl_app_021.rb +127 -0
- data/integrations/dsl_app_022.rb +133 -0
- data/integrations/expected/342_streams.out +1 -1
- data/integrations/expected/dsl_app_001.out +1 -1
- data/integrations/expected/dsl_app_002.out +1 -1
- data/integrations/expected/dsl_app_003.out +1 -1
- data/integrations/expected/dsl_app_004.out +1 -1
- data/integrations/expected/dsl_app_005.out +1 -1
- data/integrations/expected/dsl_app_006.out +1 -1
- data/integrations/expected/dsl_app_007.out +1 -1
- data/integrations/expected/dsl_app_008.out +1 -1
- data/integrations/expected/dsl_app_009.out +1 -1
- data/integrations/expected/dsl_app_010.out +1 -1
- data/integrations/expected/dsl_app_011.out +1 -1
- data/integrations/expected/dsl_app_012.out +1 -1
- data/integrations/expected/dsl_app_013.out +1 -1
- data/integrations/expected/dsl_app_014.out +1 -1
- data/integrations/expected/dsl_app_015.out +1 -1
- data/integrations/expected/dsl_app_016.out +1 -1
- data/integrations/expected/dsl_app_021.out +1 -0
- data/integrations/expected/dsl_app_022.out +1 -0
- data/integrations/support/test_interface_021.rb +7 -0
- data/integrations/support/test_interface_022.rb +15 -0
- data/lib/vedeu/all.rb +4 -2
- data/lib/vedeu/borders/border.rb +22 -6
- data/lib/vedeu/borders/repository.rb +4 -8
- data/lib/vedeu/buffers/buffer.rb +9 -6
- data/lib/vedeu/buffers/empty.rb +26 -23
- data/lib/vedeu/buffers/view.rb +44 -41
- data/lib/vedeu/cells/cursor.rb +0 -2
- data/lib/vedeu/cells/empty.rb +0 -1
- data/lib/vedeu/cells/escape.rb +0 -2
- data/lib/vedeu/coercers/alignment.rb +58 -8
- data/lib/vedeu/coercers/horizontal_alignment.rb +13 -9
- data/lib/vedeu/coercers/vertical_alignment.rb +13 -8
- data/lib/vedeu/common.rb +1 -1
- data/lib/vedeu/configuration/configuration.rb +41 -3
- data/lib/vedeu/cursors/coordinate.rb +1 -3
- data/lib/vedeu/cursors/cursor.rb +2 -6
- data/lib/vedeu/dsl/all.rb +1 -2
- data/lib/vedeu/dsl/border.rb +6 -6
- data/lib/vedeu/dsl/elements.rb +2 -2
- data/lib/vedeu/dsl/geometry.rb +7 -7
- data/lib/vedeu/dsl/{string → helpers}/align.rb +0 -0
- data/lib/vedeu/dsl/helpers/all.rb +17 -0
- data/lib/vedeu/dsl/{attributes.rb → helpers/attributes.rb} +0 -0
- data/lib/vedeu/dsl/{string → helpers}/text.rb +0 -0
- data/lib/vedeu/dsl/{string → helpers}/truncate.rb +0 -0
- data/lib/vedeu/dsl/{string → helpers}/wordwrap.rb +0 -0
- data/lib/vedeu/dsl/view.rb +11 -19
- data/lib/vedeu/dsl/views.rb +16 -106
- data/lib/vedeu/geometries/all.rb +0 -1
- data/lib/vedeu/geometries/area/area.rb +6 -12
- data/lib/vedeu/geometries/area/dimension.rb +21 -44
- data/lib/vedeu/geometries/dsl/all.rb +0 -1
- data/lib/vedeu/geometries/dsl/dsl.rb +22 -31
- data/lib/vedeu/geometries/geometry.rb +6 -0
- data/lib/vedeu/geometries/position.rb +6 -3
- data/lib/vedeu/geometries/repository.rb +1 -1
- data/lib/vedeu/input/mouse.rb +1 -0
- data/lib/vedeu/logging/log.rb +3 -6
- data/lib/vedeu/menus/dsl.rb +4 -5
- data/lib/vedeu/output/compressor.rb +11 -1
- data/lib/vedeu/output/viewport.rb +59 -59
- data/lib/vedeu/presentation/all.rb +1 -2
- data/lib/vedeu/presentation/colour.rb +75 -3
- data/lib/vedeu/{geometries/positionable.rb → presentation/position.rb} +4 -4
- data/lib/vedeu/presentation/presentation.rb +1 -3
- data/lib/vedeu/presentation/styles.rb +16 -1
- data/lib/vedeu/repositories/all.rb +0 -1
- data/lib/vedeu/sentence.rb +91 -0
- data/lib/vedeu/support/point.rb +72 -0
- data/lib/vedeu/terminal/terminal.rb +11 -53
- data/lib/vedeu/version.rb +1 -1
- data/lib/vedeu/views/composition.rb +11 -1
- data/lib/vedeu/views/default_attributes.rb +2 -0
- data/lib/vedeu/views/line.rb +16 -1
- data/lib/vedeu/views/stream.rb +16 -1
- data/lib/vedeu/views/view.rb +25 -17
- data/test/lib/vedeu/borders/border_test.rb +20 -2
- data/test/lib/vedeu/buffers/buffer_test.rb +15 -2
- data/test/lib/vedeu/buffers/empty_test.rb +51 -18
- data/test/lib/vedeu/buffers/view_test.rb +2 -2
- data/test/lib/vedeu/coercers/alignment_test.rb +32 -0
- data/test/lib/vedeu/coercers/horizontal_alignment_test.rb +16 -0
- data/test/lib/vedeu/coercers/vertical_alignment_test.rb +16 -0
- data/test/lib/vedeu/cursors/cursor_test.rb +4 -4
- data/test/lib/vedeu/cursors/dsl_test.rb +35 -21
- data/test/lib/vedeu/dsl/elements_test.rb +94 -2
- data/test/lib/vedeu/dsl/{string → helpers}/align_test.rb +0 -0
- data/test/lib/vedeu/dsl/{attributes_test.rb → helpers/attributes_test.rb} +0 -0
- data/test/lib/vedeu/dsl/{string → helpers}/text_test.rb +0 -0
- data/test/lib/vedeu/dsl/{string → helpers}/truncate_test.rb +0 -0
- data/test/lib/vedeu/dsl/{string → helpers}/wordwrap_test.rb +0 -0
- data/test/lib/vedeu/dsl/view_test.rb +22 -4
- data/test/lib/vedeu/dsl/views_test.rb +8 -5
- data/test/lib/vedeu/geometries/dsl/dsl_test.rb +2 -159
- data/test/lib/vedeu/geometries/position_test.rb +118 -60
- data/test/lib/vedeu/input/mouse_test.rb +1 -6
- data/test/lib/vedeu/logging/log_test.rb +14 -3
- data/test/lib/vedeu/presentation/colour_test.rb +77 -0
- data/test/lib/vedeu/{geometries/positionable_test.rb → presentation/position_test.rb} +4 -4
- data/test/lib/vedeu/sentence_test.rb +49 -0
- data/test/lib/vedeu/support/point_test.rb +139 -0
- data/test/lib/vedeu/terminal/terminal_test.rb +3 -44
- data/test/lib/vedeu/views/composition_test.rb +24 -4
- data/test/lib/vedeu/views/default_attributes_test.rb +10 -2
- data/test/lib/vedeu/views/view_test.rb +8 -15
- data/test/support/examples/material_colours_app.rb +0 -6
- data/vedeu.gemspec +1 -1
- metadata +58 -38
- data/examples/views/lines_line_stream.rb +0 -95
- data/examples/views/lines_line_streams.rb +0 -75
- data/examples/views/lines_line_streams_stream.rb +0 -78
- data/examples/views/lines_line_streams_stream_stream.rb +0 -50
- data/examples/views/lines_streams.rb +0 -93
- data/lib/vedeu/dsl/string/all.rb +0 -16
- data/lib/vedeu/geometries/dsl/validator.rb +0 -62
- data/lib/vedeu/presentation/background.rb +0 -54
- data/lib/vedeu/presentation/foreground.rb +0 -54
- data/lib/vedeu/repositories/parent.rb +0 -34
- data/test/lib/vedeu/geometries/dsl/validator_test.rb +0 -85
- data/test/lib/vedeu/presentation/background_test.rb +0 -74
- data/test/lib/vedeu/presentation/foreground_test.rb +0 -75
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
|
5
|
-
module Repositories
|
6
|
-
|
7
|
-
# When included into a class, provides the mechanism to retrieve
|
8
|
-
# the parent object for the class if available.
|
9
|
-
#
|
10
|
-
module Parent
|
11
|
-
|
12
|
-
include Vedeu::Common
|
13
|
-
|
14
|
-
# @return [NilClass|void]
|
15
|
-
def parent
|
16
|
-
present?(@parent) ? @parent : nil
|
17
|
-
end
|
18
|
-
|
19
|
-
# @return [NilClass|String|Symbol]
|
20
|
-
def name
|
21
|
-
if present?(@name)
|
22
|
-
@name
|
23
|
-
|
24
|
-
elsif parent && present?(parent.name)
|
25
|
-
parent.name
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
end # Parent
|
31
|
-
|
32
|
-
end # Repositories
|
33
|
-
|
34
|
-
end # Vedeu
|
@@ -1,85 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'test_helper'
|
4
|
-
|
5
|
-
module Vedeu
|
6
|
-
|
7
|
-
module Geometries
|
8
|
-
|
9
|
-
class ValidatorTestClass
|
10
|
-
include Vedeu::Geometries::Validator
|
11
|
-
end
|
12
|
-
|
13
|
-
describe Validator do
|
14
|
-
|
15
|
-
let(:included) { Vedeu::Geometries::ValidatorTestClass.new }
|
16
|
-
|
17
|
-
describe '#validate_height!' do
|
18
|
-
let(:_value) {}
|
19
|
-
|
20
|
-
subject { included.validate_height!(_value) }
|
21
|
-
|
22
|
-
context 'when the value is given' do
|
23
|
-
let(:_value) { 11 }
|
24
|
-
|
25
|
-
it { subject.must_equal(true) }
|
26
|
-
end
|
27
|
-
|
28
|
-
context 'when the value is not given' do
|
29
|
-
it { proc { subject }.must_raise(Vedeu::Error::InvalidSyntax) }
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe '#validate_horizontal_alignment!' do
|
34
|
-
let(:_value) {}
|
35
|
-
|
36
|
-
subject { included.validate_horizontal_alignment!(_value) }
|
37
|
-
|
38
|
-
context 'when the value is given' do
|
39
|
-
let(:_value) { :left }
|
40
|
-
|
41
|
-
it { subject.must_equal(true) }
|
42
|
-
end
|
43
|
-
|
44
|
-
context 'when the value is not given' do
|
45
|
-
it { proc { subject }.must_raise(Vedeu::Error::InvalidSyntax) }
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
describe '#validate_vertical_alignment!' do
|
50
|
-
let(:_value) {}
|
51
|
-
|
52
|
-
subject { included.validate_vertical_alignment!(_value) }
|
53
|
-
|
54
|
-
context 'when the value is given' do
|
55
|
-
let(:_value) { :top }
|
56
|
-
|
57
|
-
it { subject.must_equal(true) }
|
58
|
-
end
|
59
|
-
|
60
|
-
context 'when the value is not given' do
|
61
|
-
it { proc { subject }.must_raise(Vedeu::Error::InvalidSyntax) }
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
describe '#validate_width!' do
|
66
|
-
let(:_value) {}
|
67
|
-
|
68
|
-
subject { included.validate_width!(_value) }
|
69
|
-
|
70
|
-
context 'when the value is given' do
|
71
|
-
let(:_value) { 11 }
|
72
|
-
|
73
|
-
it { subject.must_equal(true) }
|
74
|
-
end
|
75
|
-
|
76
|
-
context 'when the value is not given' do
|
77
|
-
it { proc { subject }.must_raise(Vedeu::Error::InvalidSyntax) }
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
end # Validator
|
82
|
-
|
83
|
-
end # Geometries
|
84
|
-
|
85
|
-
end # Vedeu
|
@@ -1,74 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'test_helper'
|
4
|
-
|
5
|
-
module Vedeu
|
6
|
-
|
7
|
-
module Presentation
|
8
|
-
|
9
|
-
module Colour
|
10
|
-
|
11
|
-
describe Background do
|
12
|
-
|
13
|
-
let(:includer) { Vedeu::PresentationColourTestClass.new(attributes) }
|
14
|
-
let(:attributes) {
|
15
|
-
{
|
16
|
-
colour: colour,
|
17
|
-
parent: parent
|
18
|
-
}
|
19
|
-
}
|
20
|
-
let(:colour) {
|
21
|
-
{
|
22
|
-
background: background,
|
23
|
-
foreground: foreground
|
24
|
-
}
|
25
|
-
}
|
26
|
-
let(:background) { '#000033' }
|
27
|
-
let(:foreground) { '#aadd00' }
|
28
|
-
let(:parent) { Vedeu::ParentPresentationColourTestClass.new }
|
29
|
-
|
30
|
-
describe '#background' do
|
31
|
-
subject { includer.background }
|
32
|
-
|
33
|
-
it { subject.must_be_instance_of(Vedeu::Colours::Background) }
|
34
|
-
|
35
|
-
context 'when a colour is not set' do
|
36
|
-
let(:colour) {}
|
37
|
-
|
38
|
-
context 'when a parent is not available' do
|
39
|
-
let(:parent) {}
|
40
|
-
|
41
|
-
it { subject.colour.must_equal('') }
|
42
|
-
end
|
43
|
-
|
44
|
-
context 'when a parent is available' do
|
45
|
-
it { subject.colour.must_equal('#330000') }
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
context 'when a colour is set' do
|
50
|
-
it { subject.colour.must_equal('#000033') }
|
51
|
-
end
|
52
|
-
|
53
|
-
# @todo Add more tests.
|
54
|
-
end
|
55
|
-
|
56
|
-
describe '#background=' do
|
57
|
-
subject { includer.background = '#987654' }
|
58
|
-
|
59
|
-
it do
|
60
|
-
includer.colour.background.colour.must_equal('#000033')
|
61
|
-
subject
|
62
|
-
includer.colour.background.colour.must_equal('#987654')
|
63
|
-
end
|
64
|
-
|
65
|
-
it { subject.must_equal('#987654') }
|
66
|
-
end
|
67
|
-
|
68
|
-
end # Background
|
69
|
-
|
70
|
-
end # Colour
|
71
|
-
|
72
|
-
end # Presentation
|
73
|
-
|
74
|
-
end # Vedeu
|
@@ -1,75 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'test_helper'
|
4
|
-
|
5
|
-
module Vedeu
|
6
|
-
|
7
|
-
module Presentation
|
8
|
-
|
9
|
-
module Colour
|
10
|
-
|
11
|
-
describe Foreground do
|
12
|
-
|
13
|
-
let(:includer) { Vedeu::PresentationColourTestClass.new(attributes) }
|
14
|
-
let(:attributes) {
|
15
|
-
{
|
16
|
-
colour: colour,
|
17
|
-
parent: parent
|
18
|
-
}
|
19
|
-
}
|
20
|
-
let(:colour) {
|
21
|
-
{
|
22
|
-
background: background,
|
23
|
-
foreground: foreground
|
24
|
-
}
|
25
|
-
}
|
26
|
-
let(:background) { '#000033' }
|
27
|
-
let(:foreground) { '#aadd00' }
|
28
|
-
let(:parent) { Vedeu::ParentPresentationColourTestClass.new }
|
29
|
-
|
30
|
-
describe '#foreground' do
|
31
|
-
subject { includer.foreground }
|
32
|
-
|
33
|
-
it { subject.must_be_instance_of(Vedeu::Colours::Foreground) }
|
34
|
-
it { subject.colour.must_equal('#aadd00') }
|
35
|
-
|
36
|
-
context 'when a colour is not set' do
|
37
|
-
let(:colour) {}
|
38
|
-
|
39
|
-
context 'when a parent is not available' do
|
40
|
-
let(:parent) {}
|
41
|
-
|
42
|
-
it { subject.colour.must_equal('') }
|
43
|
-
end
|
44
|
-
|
45
|
-
context 'when a parent is available' do
|
46
|
-
it { subject.colour.must_equal('#00aadd') }
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
context 'when a colour is set' do
|
51
|
-
it { subject.colour.must_equal('#aadd00') }
|
52
|
-
end
|
53
|
-
|
54
|
-
# @todo Add more tests.
|
55
|
-
end
|
56
|
-
|
57
|
-
describe '#foreground=' do
|
58
|
-
subject { includer.foreground = '#123456' }
|
59
|
-
|
60
|
-
it do
|
61
|
-
includer.colour.foreground.colour.must_equal('#aadd00')
|
62
|
-
subject
|
63
|
-
includer.colour.foreground.colour.must_equal('#123456')
|
64
|
-
end
|
65
|
-
|
66
|
-
it { subject.must_equal('#123456') }
|
67
|
-
end
|
68
|
-
|
69
|
-
end # Foreground
|
70
|
-
|
71
|
-
end # Colour
|
72
|
-
|
73
|
-
end # Presentation
|
74
|
-
|
75
|
-
end # Vedeu
|