vedeu 0.6.8 → 0.6.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +9 -0
- data/README.md +1 -1
- data/docs/api.md +60 -67
- data/docs/configuration.md +8 -5
- data/docs/events.md +31 -15
- data/docs/events/application.md +12 -0
- data/docs/events/document.md +57 -0
- data/docs/events/drb.md +43 -0
- data/docs/events/focus.md +24 -0
- data/docs/events/menu.md +57 -0
- data/docs/events/movement.md +57 -0
- data/docs/events/refresh.md +25 -0
- data/docs/events/system.md +90 -0
- data/docs/events/visibility.md +68 -0
- data/lib/vedeu.rb +2 -2
- data/lib/vedeu/all.rb +3 -2
- data/lib/vedeu/api.rb +18 -18
- data/lib/vedeu/application/controller.rb +1 -1
- data/lib/vedeu/application/helper.rb +1 -1
- data/lib/vedeu/application/view.rb +1 -1
- data/lib/vedeu/bindings/application.rb +1 -12
- data/lib/vedeu/bindings/bindings.rb +3 -1
- data/lib/vedeu/bindings/document.rb +9 -62
- data/lib/vedeu/bindings/drb.rb +12 -56
- data/lib/vedeu/bindings/focus.rb +3 -28
- data/lib/vedeu/bindings/menus.rb +10 -66
- data/lib/vedeu/bindings/movement.rb +4 -69
- data/lib/vedeu/bindings/refresh.rb +3 -33
- data/lib/vedeu/bindings/system.rb +14 -100
- data/lib/vedeu/bindings/visibility.rb +20 -71
- data/lib/vedeu/borders/all.rb +4 -3
- data/lib/vedeu/borders/border.rb +39 -33
- data/lib/vedeu/borders/dsl.rb +40 -33
- data/lib/vedeu/borders/null.rb +2 -2
- data/lib/vedeu/borders/render.rb +29 -24
- data/lib/vedeu/borders/repository.rb +2 -2
- data/lib/vedeu/buffers/all.rb +8 -7
- data/lib/vedeu/buffers/buffer.rb +47 -39
- data/lib/vedeu/buffers/null.rb +2 -2
- data/lib/vedeu/buffers/refresh.rb +4 -3
- data/lib/vedeu/buffers/virtual_buffer.rb +122 -118
- data/lib/vedeu/buffers/virtual_buffers.rb +62 -56
- data/lib/vedeu/colours/background.rb +2 -1
- data/lib/vedeu/colours/colour.rb +21 -19
- data/lib/vedeu/colours/foreground.rb +2 -1
- data/lib/vedeu/colours/repository.rb +6 -5
- data/lib/vedeu/colours/translator.rb +39 -35
- data/lib/vedeu/configuration/api.rb +59 -51
- data/lib/vedeu/configuration/cli.rb +9 -7
- data/lib/vedeu/configuration/configuration.rb +41 -32
- data/lib/vedeu/cursors/cursor.rb +1 -1
- data/lib/vedeu/cursors/refresh.rb +20 -16
- data/lib/vedeu/distributed/server.rb +8 -6
- data/lib/vedeu/distributed/subprocess.rb +90 -86
- data/lib/vedeu/distributed/uri.rb +4 -3
- data/lib/vedeu/dsl/composition.rb +2 -2
- data/lib/vedeu/dsl/group.rb +4 -4
- data/lib/vedeu/dsl/interface.rb +5 -5
- data/lib/vedeu/dsl/presentation.rb +2 -2
- data/lib/vedeu/dsl/text.rb +1 -1
- data/lib/vedeu/editor/cropper.rb +4 -4
- data/lib/vedeu/editor/cursor.rb +6 -4
- data/lib/vedeu/editor/document.rb +20 -18
- data/lib/vedeu/editor/editor.rb +2 -2
- data/lib/vedeu/editor/line.rb +10 -5
- data/lib/vedeu/editor/lines.rb +2 -2
- data/lib/vedeu/internal_api.rb +4 -4
- data/lib/vedeu/models/focus.rb +197 -191
- data/lib/vedeu/models/group.rb +171 -159
- data/lib/vedeu/models/groups.rb +14 -10
- data/lib/vedeu/models/interface.rb +116 -110
- data/lib/vedeu/models/interfaces.rb +24 -20
- data/lib/vedeu/models/toggleable.rb +4 -4
- data/lib/vedeu/models/views/char.rb +1 -1
- data/lib/vedeu/models/views/composition.rb +1 -1
- data/lib/vedeu/models/views/line.rb +1 -1
- data/lib/vedeu/models/views/stream.rb +1 -1
- data/lib/vedeu/models/views/view.rb +1 -1
- data/lib/vedeu/null/interface.rb +1 -1
- data/lib/vedeu/null/view.rb +1 -1
- data/lib/vedeu/output/clear/named_interface.rb +1 -1
- data/lib/vedeu/output/compressor.rb +78 -73
- data/lib/vedeu/output/direct.rb +61 -57
- data/lib/vedeu/output/output.rb +34 -29
- data/lib/vedeu/output/{presentation.rb → presentation/presentation.rb} +2 -1
- data/lib/vedeu/output/presentation/style.rb +64 -18
- data/lib/vedeu/output/presentation/styles.rb +39 -0
- data/lib/vedeu/output/renderers/html.rb +2 -2
- data/lib/vedeu/output/renderers/json.rb +2 -1
- data/lib/vedeu/output/renderers/terminal.rb +3 -3
- data/lib/vedeu/output/renderers/text.rb +3 -3
- data/lib/vedeu/output/text.rb +186 -180
- data/lib/vedeu/output/wordwrap.rb +142 -138
- data/lib/vedeu/refresh/refresh.rb +2 -2
- data/lib/vedeu/templating/helpers.rb +11 -6
- data/lib/vedeu/templating/view_template.rb +1 -1
- data/lib/vedeu/terminal/terminal.rb +2 -2
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/borders/render_test.rb +1 -1
- data/test/lib/vedeu/buffers/buffer_test.rb +16 -14
- data/test/lib/vedeu/buffers/virtual_buffer_test.rb +105 -101
- data/test/lib/vedeu/buffers/virtual_buffers_test.rb +43 -39
- data/test/lib/vedeu/colours/colour_test.rb +4 -4
- data/test/lib/vedeu/cursors/cursor_test.rb +2 -2
- data/test/lib/vedeu/cursors/repository_test.rb +3 -3
- data/test/lib/vedeu/distributed/subprocess_test.rb +33 -29
- data/test/lib/vedeu/dsl/group_test.rb +3 -3
- data/test/lib/vedeu/dsl/interface_test.rb +6 -5
- data/test/lib/vedeu/dsl/line_test.rb +4 -2
- data/test/lib/vedeu/dsl/presentation_test.rb +2 -2
- data/test/lib/vedeu/dsl/text_test.rb +8 -8
- data/test/lib/vedeu/editor/document_test.rb +10 -6
- data/test/lib/vedeu/input/keymap_test.rb +1 -10
- data/test/lib/vedeu/models/focus_test.rb +177 -170
- data/test/lib/vedeu/models/group_test.rb +99 -95
- data/test/lib/vedeu/models/groups_test.rb +13 -9
- data/test/lib/vedeu/models/interface_test.rb +93 -87
- data/test/lib/vedeu/models/interfaces_test.rb +24 -20
- data/test/lib/vedeu/models/views/char_test.rb +2 -2
- data/test/lib/vedeu/models/views/line_test.rb +11 -7
- data/test/lib/vedeu/models/views/stream_test.rb +1 -1
- data/test/lib/vedeu/models/views/view_test.rb +1 -1
- data/test/lib/vedeu/output/clear/named_group_test.rb +1 -1
- data/test/lib/vedeu/output/clear/named_interface_test.rb +3 -1
- data/test/lib/vedeu/output/compressor_test.rb +126 -122
- data/test/lib/vedeu/output/direct_test.rb +49 -43
- data/test/lib/vedeu/output/output_test.rb +35 -31
- data/test/lib/vedeu/output/{presentation_test.rb → presentation/presentation_test.rb} +11 -7
- data/test/lib/vedeu/output/presentation/style_test.rb +88 -48
- data/test/lib/vedeu/output/presentation/styles_test.rb +84 -0
- data/test/lib/vedeu/output/text_test.rb +109 -105
- data/test/lib/vedeu/output/viewport_test.rb +3 -1
- data/test/lib/vedeu/output/wordwrap_test.rb +209 -205
- data/test/lib/vedeu/refresh/refresh_test.rb +3 -1
- data/test/lib/vedeu/templating/helpers_test.rb +6 -6
- data/test/lib/vedeu/templating/view_template_test.rb +1 -1
- metadata +17 -8
- data/lib/vedeu/output/style.rb +0 -76
- data/test/lib/vedeu/output/style_test.rb +0 -120
@@ -2,136 +2,140 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
{
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
5
|
+
module Models
|
6
|
+
|
7
|
+
describe Group do
|
8
|
+
|
9
|
+
let(:described) { Vedeu::Models::Group }
|
10
|
+
let(:instance) { described.new(attributes) }
|
11
|
+
let(:attributes) {
|
12
|
+
{
|
13
|
+
name: _name,
|
14
|
+
members: members,
|
15
|
+
repository: repository,
|
16
|
+
visible: visible,
|
17
|
+
}
|
15
18
|
}
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
19
|
+
let(:_name) { 'organics' }
|
20
|
+
let(:members) { Set.new(['carbon', 'nitrogen', 'oxygen']) }
|
21
|
+
let(:repository) { Vedeu.groups }
|
22
|
+
let(:visible) { true }
|
23
|
+
|
24
|
+
describe '#initialize' do
|
25
|
+
it { instance.must_be_instance_of(described) }
|
26
|
+
it {
|
27
|
+
instance.instance_variable_get('@attributes').must_be_instance_of(Hash)
|
28
|
+
}
|
29
|
+
it { instance.instance_variable_get('@members').must_equal(members) }
|
30
|
+
it { instance.instance_variable_get('@name').must_equal(_name) }
|
31
|
+
it {
|
32
|
+
instance.instance_variable_get('@repository').must_equal(repository)
|
33
|
+
}
|
34
|
+
it { instance.instance_variable_get('@visible').must_equal(visible) }
|
35
|
+
end
|
34
36
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
describe 'accessors' do
|
38
|
+
it { instance.must_respond_to(:name) }
|
39
|
+
it { instance.must_respond_to(:name=) }
|
40
|
+
it { instance.must_respond_to(:visible) }
|
41
|
+
it { instance.must_respond_to(:visible=) }
|
42
|
+
it { instance.must_respond_to(:visible?) }
|
43
|
+
end
|
42
44
|
|
43
|
-
|
44
|
-
|
45
|
+
describe '#add' do
|
46
|
+
subject { instance.add('hydrogen') }
|
45
47
|
|
46
|
-
|
48
|
+
it { subject.must_be_instance_of(Vedeu::Models::Group) }
|
47
49
|
|
48
|
-
|
49
|
-
|
50
|
-
|
50
|
+
context 'when the member already exists' do
|
51
|
+
it 'does not add the member again but returns a new Group' do
|
52
|
+
subject.wont_equal(instance)
|
53
|
+
end
|
51
54
|
end
|
52
|
-
end
|
53
55
|
|
54
|
-
|
55
|
-
|
56
|
-
|
56
|
+
context 'when the member does not exist' do
|
57
|
+
it 'adds the member and returns a new Group' do
|
58
|
+
subject.wont_equal(instance)
|
59
|
+
end
|
57
60
|
end
|
58
61
|
end
|
59
|
-
end
|
60
62
|
|
61
|
-
|
62
|
-
|
63
|
+
describe '#by_zindex' do
|
64
|
+
subject { instance.by_zindex }
|
63
65
|
|
64
|
-
|
66
|
+
it { subject.must_be_instance_of(Array) }
|
65
67
|
|
66
|
-
|
67
|
-
|
68
|
-
|
68
|
+
# @todo Add more tests.
|
69
|
+
# it { skip }
|
70
|
+
end
|
69
71
|
|
70
|
-
|
71
|
-
|
72
|
+
describe '#hide' do
|
73
|
+
subject { instance.hide }
|
72
74
|
|
73
|
-
|
74
|
-
|
75
|
+
it { subject.must_equal(instance) }
|
76
|
+
end
|
75
77
|
|
76
|
-
|
77
|
-
|
78
|
+
describe '#members' do
|
79
|
+
subject { instance.members }
|
78
80
|
|
79
|
-
|
81
|
+
it { subject.must_be_instance_of(Set) }
|
80
82
|
|
81
|
-
|
82
|
-
|
83
|
+
context 'when the group has no members' do
|
84
|
+
let(:members) { [] }
|
83
85
|
|
84
|
-
|
85
|
-
|
86
|
+
it 'returns an empty Set' do
|
87
|
+
subject.must_be_empty
|
88
|
+
end
|
86
89
|
end
|
87
|
-
end
|
88
90
|
|
89
|
-
|
90
|
-
|
91
|
-
|
91
|
+
context 'when the group has members' do
|
92
|
+
it 'returns a set of members' do
|
93
|
+
subject.wont_be_empty
|
94
|
+
end
|
92
95
|
end
|
93
96
|
end
|
94
|
-
end
|
95
97
|
|
96
|
-
|
97
|
-
|
98
|
+
describe '#remove' do
|
99
|
+
let(:member) { 'hydrogen' }
|
98
100
|
|
99
|
-
|
101
|
+
subject { instance.remove(member) }
|
100
102
|
|
101
|
-
|
103
|
+
it { subject.must_be_instance_of(described) }
|
102
104
|
|
103
|
-
|
104
|
-
|
105
|
+
context 'when the group is already empty' do
|
106
|
+
let(:members) { [] }
|
105
107
|
|
106
|
-
|
107
|
-
|
108
|
+
it { subject.wont_equal(instance) }
|
109
|
+
end
|
108
110
|
|
109
|
-
|
110
|
-
|
111
|
+
context 'when the member exists' do
|
112
|
+
let(:member) { 'oxygen' }
|
111
113
|
|
112
|
-
|
113
|
-
|
114
|
-
|
114
|
+
it { subject.wont_equal(instance) }
|
115
|
+
it { subject.members.wont_include(member) }
|
116
|
+
end
|
115
117
|
|
116
|
-
|
117
|
-
|
118
|
-
|
118
|
+
context 'when the member does not exist' do
|
119
|
+
it { subject.wont_equal(instance) }
|
120
|
+
it { subject.members.wont_include(member) }
|
121
|
+
end
|
119
122
|
end
|
120
|
-
end
|
121
123
|
|
122
|
-
|
123
|
-
|
124
|
+
describe '#reset' do
|
125
|
+
subject { instance.reset }
|
126
|
+
|
127
|
+
it { subject.must_be_instance_of(Vedeu::Models::Group) }
|
128
|
+
it { subject.members.must_be_empty }
|
129
|
+
end
|
124
130
|
|
125
|
-
|
126
|
-
|
127
|
-
end
|
131
|
+
describe '#show' do
|
132
|
+
subject { instance.show }
|
128
133
|
|
129
|
-
|
130
|
-
|
134
|
+
it { subject.must_equal(instance) }
|
135
|
+
end
|
131
136
|
|
132
|
-
|
133
|
-
end
|
137
|
+
end # Group
|
134
138
|
|
135
|
-
end #
|
139
|
+
end # Models
|
136
140
|
|
137
141
|
end # Vedeu
|
@@ -2,20 +2,24 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
|
5
|
-
|
5
|
+
module Models
|
6
6
|
|
7
|
-
|
7
|
+
describe Groups do
|
8
8
|
|
9
|
-
|
9
|
+
let(:described) { Vedeu::Models::Groups }
|
10
10
|
|
11
|
-
|
12
|
-
let(:_name) { 'carbon' }
|
11
|
+
it { described.must_respond_to(:groups) }
|
13
12
|
|
14
|
-
|
13
|
+
describe '#by_name' do
|
14
|
+
let(:_name) { 'carbon' }
|
15
15
|
|
16
|
-
|
17
|
-
end
|
16
|
+
subject { described.groups.by_name(_name) }
|
18
17
|
|
19
|
-
|
18
|
+
it { subject.must_be_instance_of(Vedeu::Models::Group) }
|
19
|
+
end
|
20
|
+
|
21
|
+
end # Groups
|
22
|
+
|
23
|
+
end # Models
|
20
24
|
|
21
25
|
end # Vedeu
|
@@ -2,93 +2,99 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
{
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
5
|
+
module Models
|
6
|
+
|
7
|
+
describe Interface do
|
8
|
+
|
9
|
+
let(:described) { Vedeu::Models::Interface }
|
10
|
+
let(:instance) { described.new(attributes) }
|
11
|
+
let(:attributes) {
|
12
|
+
{
|
13
|
+
client: client,
|
14
|
+
colour: colour,
|
15
|
+
delay: delay,
|
16
|
+
group: group,
|
17
|
+
name: _name,
|
18
|
+
parent: parent,
|
19
|
+
style: style,
|
20
|
+
visible: visible,
|
21
|
+
zindex: zindex,
|
22
|
+
}
|
20
23
|
}
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
24
|
+
let(:client) {}
|
25
|
+
let(:colour) {}
|
26
|
+
let(:delay) { 0.0 }
|
27
|
+
let(:group) { '' }
|
28
|
+
let(:_name) { 'hydrogen' }
|
29
|
+
let(:parent) {}
|
30
|
+
let(:repository) { Vedeu.interfaces }
|
31
|
+
let(:style) {}
|
32
|
+
let(:visible) { true }
|
33
|
+
let(:zindex) { 1 }
|
34
|
+
|
35
|
+
describe '#initialize' do
|
36
|
+
subject { instance }
|
37
|
+
|
38
|
+
it { subject.must_be_instance_of(described) }
|
39
|
+
it { subject.instance_variable_get('@client').must_equal(client) }
|
40
|
+
it { subject.instance_variable_get('@delay').must_equal(delay) }
|
41
|
+
it { subject.instance_variable_get('@group').must_equal(group) }
|
42
|
+
it { subject.instance_variable_get('@name').must_equal(_name) }
|
43
|
+
it { subject.instance_variable_get('@parent').must_equal(parent) }
|
44
|
+
it {
|
45
|
+
subject.instance_variable_get('@repository').must_equal(repository)
|
46
|
+
}
|
47
|
+
it { subject.instance_variable_get('@visible').must_equal(visible) }
|
48
|
+
it { subject.instance_variable_get('@zindex').must_equal(zindex) }
|
49
|
+
end
|
50
|
+
|
51
|
+
describe 'accessors' do
|
52
|
+
it { instance.must_respond_to(:client) }
|
53
|
+
it { instance.must_respond_to(:client=) }
|
54
|
+
it { instance.must_respond_to(:delay) }
|
55
|
+
it { instance.must_respond_to(:delay=) }
|
56
|
+
it { instance.must_respond_to(:group) }
|
57
|
+
it { instance.must_respond_to(:group=) }
|
58
|
+
it { instance.must_respond_to(:name) }
|
59
|
+
it { instance.must_respond_to(:name=) }
|
60
|
+
it { instance.must_respond_to(:parent) }
|
61
|
+
it { instance.must_respond_to(:parent=) }
|
62
|
+
it { instance.must_respond_to(:zindex) }
|
63
|
+
it { instance.must_respond_to(:zindex=) }
|
64
|
+
it { instance.must_respond_to(:visible) }
|
65
|
+
it { instance.must_respond_to(:visible=) }
|
66
|
+
it { instance.must_respond_to(:visible?) }
|
67
|
+
it { instance.must_respond_to(:attributes) }
|
68
|
+
end
|
69
|
+
|
70
|
+
describe '#hide' do
|
71
|
+
let(:buffer) { Vedeu::Buffers::Buffer.new }
|
72
|
+
|
73
|
+
before { Vedeu.buffers.stubs(:by_name).returns(buffer) }
|
74
|
+
|
75
|
+
subject { instance.hide }
|
76
|
+
|
77
|
+
it {
|
78
|
+
Vedeu.buffers.by_name('hydrogen').expects(:hide)
|
79
|
+
subject
|
80
|
+
}
|
81
|
+
end
|
82
|
+
|
83
|
+
describe '#show' do
|
84
|
+
let(:buffer) { Vedeu::Buffers::Buffer.new }
|
85
|
+
|
86
|
+
before { Vedeu.buffers.stubs(:by_name).returns(buffer) }
|
87
|
+
|
88
|
+
subject { instance.show }
|
89
|
+
|
90
|
+
it {
|
91
|
+
Vedeu.buffers.by_name('hydrogen').expects(:show)
|
92
|
+
subject
|
93
|
+
}
|
94
|
+
end
|
95
|
+
|
96
|
+
end # Interface
|
97
|
+
|
98
|
+
end # Models
|
93
99
|
|
94
100
|
end # Vedeu
|