vedeu 0.4.52 → 0.4.53
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/events.md +15 -5
- data/lib/vedeu/application/application_view.rb +0 -4
- data/lib/vedeu/bindings/all.rb +22 -1
- data/lib/vedeu/bindings/drb.rb +89 -13
- data/lib/vedeu/bindings/menus.rb +123 -13
- data/lib/vedeu/bindings/movement.rb +147 -26
- data/lib/vedeu/bindings/system.rb +284 -0
- data/lib/vedeu/bindings/visibility.rb +117 -13
- data/lib/vedeu/dsl/all.rb +2 -1
- data/lib/vedeu/output/compressor.rb +2 -0
- data/lib/vedeu/output/refresh.rb +20 -5
- data/lib/vedeu/output/refresh_group.rb +6 -1
- data/lib/vedeu/output/render_border.rb +1 -1
- data/lib/vedeu/output/renderers/all.rb +1 -0
- data/lib/vedeu/output/renderers/escape_sequence.rb +2 -16
- data/lib/vedeu/output/renderers/null.rb +2 -16
- data/lib/vedeu/output/renderers/renderer_options.rb +26 -0
- data/lib/vedeu/output/renderers/terminal.rb +2 -14
- data/lib/vedeu/output/renderers/text.rb +2 -16
- data/lib/vedeu/repositories/all.rb +23 -1
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/bindings/system_test.rb +44 -0
- data/test/lib/vedeu/output/refresh_group_test.rb +10 -2
- data/test/lib/vedeu/output/refresh_test.rb +6 -23
- data/test/lib/vedeu/output/renderers/renderer_options_test.rb +12 -0
- data/test/lib/vedeu/templating/preprocessor_test.rb +11 -10
- metadata +8 -10
- data/docs/events/drb.md +0 -49
- data/docs/events/main.md +0 -109
- data/docs/events/menus.md +0 -72
- data/docs/events/movement.md +0 -105
- data/docs/events/visibility.md +0 -61
- data/lib/vedeu/bindings/bindings.rb +0 -86
- data/test/lib/vedeu/bindings/bindings_test.rb +0 -40
data/lib/vedeu/output/refresh.rb
CHANGED
@@ -4,13 +4,23 @@ module Vedeu
|
|
4
4
|
|
5
5
|
# Refreshes the terminal.
|
6
6
|
#
|
7
|
-
# @
|
7
|
+
# @note
|
8
|
+
# In the cases of {#all} and {#by_group}, the interfaces will be refreshed
|
9
|
+
# in z-index order, meaning that interfaces with a lower z-index will be
|
10
|
+
# drawn first. This means overlapping interfaces will be drawn as specified.
|
11
|
+
#
|
12
|
+
# @api public
|
8
13
|
module Refresh
|
9
14
|
|
10
15
|
module_function
|
11
16
|
|
12
17
|
# Refresh all registered interfaces.
|
13
18
|
#
|
19
|
+
# @example
|
20
|
+
# Vedeu.trigger(:_refresh_)
|
21
|
+
#
|
22
|
+
# Vedeu::Refresh.all
|
23
|
+
#
|
14
24
|
# @return [Array]
|
15
25
|
def all
|
16
26
|
Vedeu.timer('Refresh All') do
|
@@ -27,10 +37,10 @@ module Vedeu
|
|
27
37
|
|
28
38
|
# Refresh an interface, or collection of interfaces belonging to a group.
|
29
39
|
#
|
30
|
-
# @
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
40
|
+
# @example
|
41
|
+
# Vedeu.trigger(:_refresh_group_, group_name)
|
42
|
+
#
|
43
|
+
# Vedeu::Refresh.by_group(group_name)
|
34
44
|
#
|
35
45
|
# @param group_name [String] The name of the group to be refreshed.
|
36
46
|
# @return [Array|ModelNotFound] A collection of the names of interfaces
|
@@ -43,6 +53,11 @@ module Vedeu
|
|
43
53
|
|
44
54
|
# Refresh an interface by name.
|
45
55
|
#
|
56
|
+
# @example
|
57
|
+
# Vedeu.trigger(:_refresh_, name)
|
58
|
+
#
|
59
|
+
# Vedeu::Refresh.by_name(name)
|
60
|
+
#
|
46
61
|
# @param name [String] The name of the interface to be refreshed using the
|
47
62
|
# named buffer.
|
48
63
|
# @return [Array|ModelNotFound]
|
@@ -7,6 +7,8 @@ module Vedeu
|
|
7
7
|
# @api private
|
8
8
|
class RefreshGroup
|
9
9
|
|
10
|
+
include Vedeu::Common
|
11
|
+
|
10
12
|
# @param name [String]
|
11
13
|
# @return [void]
|
12
14
|
def self.by_name(name)
|
@@ -44,7 +46,10 @@ module Vedeu
|
|
44
46
|
|
45
47
|
# @return [Set]
|
46
48
|
def members
|
47
|
-
Vedeu
|
49
|
+
fail Vedeu::MissingRequired,
|
50
|
+
'Cannot refresh group with an empty group name.' unless present?(name)
|
51
|
+
|
52
|
+
Vedeu.groups.by_name(name).members
|
48
53
|
end
|
49
54
|
|
50
55
|
end # RefreshGroup
|
@@ -177,7 +177,7 @@ module Vedeu
|
|
177
177
|
end
|
178
178
|
|
179
179
|
# From the second element of {#title_characters} remove the border from each
|
180
|
-
# {#
|
180
|
+
# {#build_horizontal} Vedeu::Char, and add the title character.
|
181
181
|
#
|
182
182
|
# @return [Array<Vedeu::Char>]
|
183
183
|
def titlebar
|
@@ -7,6 +7,8 @@ module Vedeu
|
|
7
7
|
# @api private
|
8
8
|
class EscapeSequence
|
9
9
|
|
10
|
+
include Vedeu::RendererOptions
|
11
|
+
|
10
12
|
# Returns a new instance of Vedeu::Renderers::EscapeSequence.
|
11
13
|
#
|
12
14
|
# @param options [Hash]
|
@@ -24,22 +26,6 @@ module Vedeu
|
|
24
26
|
end.join
|
25
27
|
end
|
26
28
|
|
27
|
-
private
|
28
|
-
|
29
|
-
# Combines the options provided at instantiation with the default values.
|
30
|
-
#
|
31
|
-
# @return [Hash<Symbol => void>]
|
32
|
-
def options
|
33
|
-
defaults.merge!(@options)
|
34
|
-
end
|
35
|
-
|
36
|
-
# The default values for a new instance of this class.
|
37
|
-
#
|
38
|
-
# @return [Hash<Symbol => void>]
|
39
|
-
def defaults
|
40
|
-
{}
|
41
|
-
end
|
42
|
-
|
43
29
|
end # EscapeSequence
|
44
30
|
|
45
31
|
end # Renderers
|
@@ -7,6 +7,8 @@ module Vedeu
|
|
7
7
|
# @api private
|
8
8
|
class Null
|
9
9
|
|
10
|
+
include Vedeu::RendererOptions
|
11
|
+
|
10
12
|
# Returns a new instance of Vedeu::Renderers::Null.
|
11
13
|
#
|
12
14
|
# @param options [Hash]
|
@@ -21,22 +23,6 @@ module Vedeu
|
|
21
23
|
output
|
22
24
|
end
|
23
25
|
|
24
|
-
private
|
25
|
-
|
26
|
-
# Combines the options provided at instantiation with the default values.
|
27
|
-
#
|
28
|
-
# @return [Hash<Symbol => void>]
|
29
|
-
def options
|
30
|
-
defaults.merge!(@options)
|
31
|
-
end
|
32
|
-
|
33
|
-
# The default values for a new instance of this class.
|
34
|
-
#
|
35
|
-
# @return [Hash<Symbol => void>]
|
36
|
-
def defaults
|
37
|
-
{}
|
38
|
-
end
|
39
|
-
|
40
26
|
end # Null
|
41
27
|
|
42
28
|
end # Renderers
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Vedeu
|
2
|
+
|
3
|
+
# Provides shared functionality to Vedeu::Renderer classes.
|
4
|
+
#
|
5
|
+
# @api private
|
6
|
+
module RendererOptions
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
# Combines the options provided at instantiation with the default values.
|
11
|
+
#
|
12
|
+
# @return [Hash<Symbol => void>]
|
13
|
+
def options
|
14
|
+
defaults.merge!(@options)
|
15
|
+
end
|
16
|
+
|
17
|
+
# The default values for a new instance of this class.
|
18
|
+
#
|
19
|
+
# @return [Hash<Symbol => void>]
|
20
|
+
def defaults
|
21
|
+
{}
|
22
|
+
end
|
23
|
+
|
24
|
+
end # RendererOptions
|
25
|
+
|
26
|
+
end # Vedeu
|
@@ -8,6 +8,8 @@ module Vedeu
|
|
8
8
|
# @api private
|
9
9
|
class Terminal
|
10
10
|
|
11
|
+
include Vedeu::RendererOptions
|
12
|
+
|
11
13
|
# Returns a new instance of Vedeu::Renderers::Terminal.
|
12
14
|
#
|
13
15
|
# @param options [Hash]
|
@@ -32,20 +34,6 @@ module Vedeu
|
|
32
34
|
end
|
33
35
|
end
|
34
36
|
|
35
|
-
# Combines the options provided at instantiation with the default values.
|
36
|
-
#
|
37
|
-
# @return [Hash<Symbol => void>]
|
38
|
-
def options
|
39
|
-
defaults.merge!(@options)
|
40
|
-
end
|
41
|
-
|
42
|
-
# The default values for a new instance of this class.
|
43
|
-
#
|
44
|
-
# @return [Hash<Symbol => void>]
|
45
|
-
def defaults
|
46
|
-
{}
|
47
|
-
end
|
48
|
-
|
49
37
|
end # Terminal
|
50
38
|
|
51
39
|
end # Renderers
|
@@ -8,6 +8,8 @@ module Vedeu
|
|
8
8
|
# @api private
|
9
9
|
class Text
|
10
10
|
|
11
|
+
include Vedeu::RendererOptions
|
12
|
+
|
11
13
|
# Returns a new instance of Vedeu::Renderers::Text.
|
12
14
|
#
|
13
15
|
# @param options [Hash]
|
@@ -22,22 +24,6 @@ module Vedeu
|
|
22
24
|
Vedeu::Compressor.render(output)
|
23
25
|
end
|
24
26
|
|
25
|
-
private
|
26
|
-
|
27
|
-
# Combines the options provided at instantiation with the default values.
|
28
|
-
#
|
29
|
-
# @return [Hash<Symbol => void>]
|
30
|
-
def options
|
31
|
-
defaults.merge!(@options)
|
32
|
-
end
|
33
|
-
|
34
|
-
# The default values for a new instance of this class.
|
35
|
-
#
|
36
|
-
# @return [Hash<Symbol => void>]
|
37
|
-
def defaults
|
38
|
-
{}
|
39
|
-
end
|
40
|
-
|
41
27
|
end # Text
|
42
28
|
|
43
29
|
end # Renderers
|
@@ -12,17 +12,39 @@ module Vedeu
|
|
12
12
|
storage.add(klass)
|
13
13
|
end
|
14
14
|
|
15
|
+
# List all models stored in each registered repository.
|
16
|
+
#
|
17
|
+
# @return [Array]
|
18
|
+
def registered
|
19
|
+
all.map do |repository|
|
20
|
+
registered = repository.send(:registered)
|
21
|
+
|
22
|
+
Vedeu.log(type: :debug,
|
23
|
+
message: "Repository '#{repository.class.name}':" \
|
24
|
+
" #{registered.inspect}")
|
25
|
+
|
26
|
+
registered
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
15
30
|
# Remove all stored models from the repository.
|
16
31
|
#
|
17
32
|
# @return [TrueClass]
|
18
33
|
def reset!
|
19
|
-
|
34
|
+
all.map { |repository| repository.send(:reset) }
|
20
35
|
|
21
36
|
true
|
22
37
|
end
|
23
38
|
|
24
39
|
private
|
25
40
|
|
41
|
+
# Access all the repositories stored.
|
42
|
+
#
|
43
|
+
# @return [Array]
|
44
|
+
def all
|
45
|
+
storage.map(&:repository)
|
46
|
+
end
|
47
|
+
|
26
48
|
# Access to the storage for this repository.
|
27
49
|
#
|
28
50
|
# @return [Array]
|
data/lib/vedeu/version.rb
CHANGED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
module Bindings
|
6
|
+
|
7
|
+
describe System do
|
8
|
+
|
9
|
+
context 'the system events needed by Vedeu to run are defined' do
|
10
|
+
it { Vedeu.bound?(:_clear_).must_equal(true) }
|
11
|
+
it { Vedeu.bound?(:_clear_group_).must_equal(true) }
|
12
|
+
it { Vedeu.bound?(:_cleanup_).must_equal(true) }
|
13
|
+
it { Vedeu.bound?(:_command_).must_equal(true) }
|
14
|
+
it { Vedeu.bound?(:_exit_).must_equal(true) }
|
15
|
+
it { Vedeu.bound?(:_initialize_).must_equal(true) }
|
16
|
+
it { Vedeu.bound?(:_keypress_).must_equal(true) }
|
17
|
+
it { Vedeu.bound?(:_log_).must_equal(true) }
|
18
|
+
it { Vedeu.bound?(:_mode_switch_).must_equal(true) }
|
19
|
+
it { Vedeu.bound?(:_refresh_).must_equal(true) }
|
20
|
+
it { Vedeu.bound?(:_refresh_cursor_).must_equal(true) }
|
21
|
+
it { Vedeu.bound?(:_refresh_group_).must_equal(true) }
|
22
|
+
it { Vedeu.bound?(:_resize_).must_equal(true) }
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'the geometry specific events are defined' do
|
26
|
+
it { Vedeu.bound?(:_maximise_).must_equal(true) }
|
27
|
+
it { Vedeu.bound?(:_unmaximise_).must_equal(true) }
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'the focus specific events are defined' do
|
31
|
+
it { Vedeu.bound?(:_focus_by_name_).must_equal(true) }
|
32
|
+
it { Vedeu.bound?(:_focus_next_).must_equal(true) }
|
33
|
+
it { Vedeu.bound?(:_focus_prev_).must_equal(true) }
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'the refresh event for all registered interfaces is defined' do
|
37
|
+
it { Vedeu.bound?(:_refresh_).must_equal(true) }
|
38
|
+
end
|
39
|
+
|
40
|
+
end # System
|
41
|
+
|
42
|
+
end # Bindings
|
43
|
+
|
44
|
+
end # Vedeu
|
@@ -20,8 +20,16 @@ module Vedeu
|
|
20
20
|
describe '#by_name' do
|
21
21
|
subject { instance.by_name }
|
22
22
|
|
23
|
-
|
24
|
-
|
23
|
+
context 'when the name is not present' do
|
24
|
+
let(:_name) { '' }
|
25
|
+
|
26
|
+
it { proc { subject }.must_raise(Vedeu::MissingRequired) }
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'when the name is present' do
|
30
|
+
# @todo
|
31
|
+
# it { skip }
|
32
|
+
end
|
25
33
|
end
|
26
34
|
|
27
35
|
end # RefreshGroup
|
@@ -34,32 +34,15 @@ module Vedeu
|
|
34
34
|
end
|
35
35
|
|
36
36
|
describe '.by_group' do
|
37
|
-
let(:
|
38
|
-
let(:
|
37
|
+
let(:group_name) { 'elements' }
|
38
|
+
let(:_name) { 'aluminium' }
|
39
39
|
|
40
40
|
subject { described.by_group(group_name) }
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
it { proc { subject }.must_raise(ModelNotFound) }
|
48
|
-
end
|
49
|
-
|
50
|
-
context 'when there are registered groups' do
|
51
|
-
let(:group_name) { 'elements' }
|
52
|
-
|
53
|
-
before do
|
54
|
-
Vedeu::Group.new(name: group_name, members: _name).store
|
55
|
-
end
|
56
|
-
|
57
|
-
it do
|
58
|
-
Vedeu.buffers.expects(:by_name).with(_name).returns(buffer)
|
59
|
-
buffer.expects(:render)
|
60
|
-
subject
|
61
|
-
end
|
62
|
-
end
|
42
|
+
it {
|
43
|
+
Vedeu::RefreshGroup.expects(:by_name).with(group_name)
|
44
|
+
subject
|
45
|
+
}
|
63
46
|
end
|
64
47
|
|
65
48
|
describe '.by_name' do
|
@@ -15,6 +15,14 @@ module Vedeu
|
|
15
15
|
"More text here\n"
|
16
16
|
]
|
17
17
|
}
|
18
|
+
let(:expected) {
|
19
|
+
[
|
20
|
+
Vedeu::Stream.new(value: 'Some text here'),
|
21
|
+
Vedeu::Stream.new(value: 'Yay!',
|
22
|
+
colour: Vedeu::Colour.coerce(foreground: '#0f0')),
|
23
|
+
Vedeu::Stream.new(value: 'More text here')
|
24
|
+
]
|
25
|
+
}
|
18
26
|
|
19
27
|
describe '#initialize' do
|
20
28
|
it { instance.must_be_instance_of(described) }
|
@@ -22,19 +30,12 @@ module Vedeu
|
|
22
30
|
end
|
23
31
|
|
24
32
|
describe '.process' do
|
25
|
-
|
33
|
+
subject { described.process(lines) }
|
34
|
+
|
35
|
+
it { subject.must_equal(expected) }
|
26
36
|
end
|
27
37
|
|
28
38
|
describe '#process' do
|
29
|
-
let(:expected) {
|
30
|
-
[
|
31
|
-
Vedeu::Stream.new(value: 'Some text here'),
|
32
|
-
Vedeu::Stream.new(value: 'Yay!',
|
33
|
-
colour: Vedeu::Colour.coerce({ foreground: '#0f0' })),
|
34
|
-
Vedeu::Stream.new(value: 'More text here')
|
35
|
-
]
|
36
|
-
}
|
37
|
-
|
38
39
|
subject { instance.process }
|
39
40
|
|
40
41
|
it { subject.must_equal(expected) }
|