vedeu 0.6.20 → 0.6.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/README.md +4 -0
- data/Rakefile +13 -0
- data/bin/vedeu_drb_server +6 -6
- data/docs/api.md +14 -0
- data/docs/dsl.md +12 -12
- data/docs/events/document.md +4 -2
- data/docs/events/drb.md +4 -0
- data/docs/events/focus.md +2 -0
- data/docs/events/menu.md +2 -0
- data/docs/events/movement.md +7 -5
- data/docs/events/refresh.md +2 -0
- data/docs/events/system.md +5 -0
- data/docs/events/view.md +2 -0
- data/docs/events/visibility.md +2 -0
- data/lib/vedeu.rb +0 -23
- data/lib/vedeu/all.rb +2 -4
- data/lib/vedeu/application/application_view.rb +1 -1
- data/lib/vedeu/borders/all.rb +3 -3
- data/lib/vedeu/borders/border.rb +2 -2
- data/lib/vedeu/borders/dsl.rb +21 -27
- data/lib/vedeu/borders/null.rb +2 -15
- data/lib/vedeu/borders/render.rb +1 -1
- data/lib/vedeu/borders/repository.rb +9 -0
- data/lib/vedeu/buffers/buffer.rb +2 -2
- data/lib/vedeu/buffers/null.rb +1 -31
- data/lib/vedeu/buffers/refresh.rb +8 -8
- data/lib/vedeu/buffers/repository.rb +9 -0
- data/lib/vedeu/colours/backgrounds.rb +9 -0
- data/lib/vedeu/colours/colour.rb +1 -1
- data/lib/vedeu/colours/foregrounds.rb +9 -0
- data/lib/vedeu/common.rb +22 -13
- data/lib/vedeu/configuration/configuration.rb +6 -0
- data/lib/vedeu/cursors/cursor.rb +13 -8
- data/lib/vedeu/cursors/refresh.rb +2 -2
- data/lib/vedeu/cursors/repository.rb +18 -1
- data/lib/vedeu/distributed/server.rb +23 -0
- data/lib/vedeu/distributed/templates/default_borders.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_geometries.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_interfaces.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_keymaps.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_menus.vedeu +1 -1
- data/lib/vedeu/distributed/templates/default_views.vedeu +1 -1
- data/lib/vedeu/dsl/composition.rb +7 -17
- data/lib/vedeu/dsl/dsl.rb +12 -0
- data/lib/vedeu/dsl/interface.rb +32 -33
- data/lib/vedeu/dsl/keymap.rb +13 -19
- data/lib/vedeu/dsl/line.rb +3 -13
- data/lib/vedeu/dsl/shared.rb +5 -5
- data/lib/vedeu/dsl/stream.rb +0 -10
- data/lib/vedeu/dsl/use.rb +6 -6
- data/lib/vedeu/dsl/view.rb +17 -19
- data/lib/vedeu/editor/cursor.rb +32 -10
- data/lib/vedeu/editor/document.rb +33 -35
- data/lib/vedeu/editor/editor.rb +3 -4
- data/lib/vedeu/editor/insert.rb +1 -1
- data/lib/vedeu/editor/line.rb +1 -8
- data/lib/vedeu/editor/lines.rb +1 -1
- data/lib/vedeu/editor/repository.rb +9 -0
- data/lib/vedeu/esc/esc.rb +2 -1
- data/lib/vedeu/events/aliases.rb +8 -1
- data/lib/vedeu/events/event.rb +8 -0
- data/lib/vedeu/events/repository.rb +9 -0
- data/lib/vedeu/events/trigger.rb +9 -5
- data/lib/vedeu/geometry/coordinate.rb +2 -2
- data/lib/vedeu/geometry/dsl.rb +32 -38
- data/lib/vedeu/geometry/generic_coordinate.rb +1 -1
- data/lib/vedeu/geometry/geometry.rb +3 -3
- data/lib/vedeu/geometry/null.rb +2 -24
- data/lib/vedeu/geometry/repository.rb +9 -0
- data/lib/vedeu/groups/clear.rb +7 -3
- data/lib/vedeu/groups/dsl.rb +29 -35
- data/lib/vedeu/groups/group.rb +28 -4
- data/lib/vedeu/groups/refresh.rb +3 -2
- data/lib/vedeu/groups/repository.rb +9 -0
- data/lib/vedeu/input/capture.rb +1 -1
- data/lib/vedeu/input/keymap.rb +2 -1
- data/lib/vedeu/input/keymaps.rb +9 -0
- data/lib/vedeu/input/mapper.rb +4 -0
- data/lib/vedeu/input/translator.rb +1 -1
- data/lib/vedeu/logging/debug.rb +13 -0
- data/lib/vedeu/logging/log.rb +8 -0
- data/lib/vedeu/logging/timer.rb +13 -0
- data/lib/vedeu/menus/dsl.rb +8 -18
- data/lib/vedeu/menus/menu.rb +8 -4
- data/lib/vedeu/menus/null.rb +1 -1
- data/lib/vedeu/menus/repository.rb +9 -0
- data/lib/vedeu/models/cell.rb +5 -0
- data/lib/vedeu/models/escape.rb +5 -0
- data/lib/vedeu/models/focus.rb +20 -5
- data/lib/vedeu/models/interface.rb +10 -1
- data/lib/vedeu/models/interfaces.rb +9 -0
- data/lib/vedeu/models/toggleable.rb +19 -4
- data/lib/vedeu/models/views/char.rb +6 -1
- data/lib/vedeu/models/views/html_char.rb +1 -4
- data/lib/vedeu/models/views/line.rb +1 -1
- data/lib/vedeu/models/views/view.rb +1 -1
- data/lib/vedeu/null/generic.rb +14 -2
- data/lib/vedeu/null/interface.rb +1 -1
- data/lib/vedeu/null/view.rb +1 -1
- data/lib/vedeu/output/clear/interface.rb +5 -1
- data/lib/vedeu/output/compressor.rb +8 -4
- data/lib/vedeu/output/direct.rb +4 -4
- data/lib/vedeu/output/presentation/all.rb +15 -0
- data/lib/vedeu/output/presentation/presentation.rb +0 -7
- data/lib/vedeu/output/refresh/refresh.rb +1 -3
- data/lib/vedeu/output/renderers/all.rb +10 -0
- data/lib/vedeu/output/renderers/terminal.rb +1 -3
- data/lib/vedeu/repositories/collection.rb +3 -3
- data/lib/vedeu/repositories/model.rb +1 -1
- data/lib/vedeu/repositories/repository.rb +8 -8
- data/lib/vedeu/repositories/store.rb +3 -2
- data/lib/vedeu/runtime/application.rb +4 -0
- data/lib/vedeu/runtime/bootstrap.rb +1 -1
- data/lib/vedeu/runtime/flags.rb +7 -0
- data/lib/vedeu/runtime/main_loop.rb +2 -0
- data/lib/vedeu/runtime/router.rb +4 -0
- data/lib/vedeu/templating/decoder.rb +1 -1
- data/lib/vedeu/templating/encoder.rb +1 -1
- data/lib/vedeu/templating/helpers.rb +2 -0
- data/lib/vedeu/templating/template.rb +1 -1
- data/lib/vedeu/terminal/buffer.rb +7 -0
- data/lib/vedeu/terminal/terminal.rb +8 -0
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/borders/dsl_test.rb +0 -6
- data/test/lib/vedeu/borders/null_test.rb +0 -12
- data/test/lib/vedeu/buffers/null_test.rb +0 -37
- data/test/lib/vedeu/common_test.rb +33 -0
- data/test/lib/vedeu/cursors/cursor_test.rb +1 -1
- data/test/lib/vedeu/dsl/composition_test.rb +0 -6
- data/test/lib/vedeu/dsl/dsl_test.rb +1 -0
- data/test/lib/vedeu/dsl/interface_test.rb +0 -6
- data/test/lib/vedeu/dsl/keymap_test.rb +0 -5
- data/test/lib/vedeu/dsl/line_test.rb +0 -7
- data/test/lib/vedeu/dsl/stream_test.rb +0 -7
- data/test/lib/vedeu/editor/cursor_test.rb +23 -8
- data/test/lib/vedeu/editor/document_test.rb +27 -23
- data/test/lib/vedeu/editor/line_test.rb +0 -30
- data/test/lib/vedeu/geometry/dsl_test.rb +0 -5
- data/test/lib/vedeu/geometry/null_test.rb +0 -30
- data/test/lib/vedeu/groups/dsl_test.rb +0 -6
- data/test/lib/vedeu/groups/group_test.rb +15 -7
- data/test/lib/vedeu/menus/dsl_test.rb +0 -5
- data/test/lib/vedeu/models/cell_test.rb +4 -0
- data/test/lib/vedeu/models/escape_test.rb +4 -0
- data/test/lib/vedeu/models/views/char_test.rb +4 -0
- data/test/lib/vedeu/null/generic_test.rb +13 -0
- data/test/lib/vedeu/terminal/buffer_test.rb +3 -2
- data/test/lib/vedeu_test.rb +81 -3
- data/test/support/examples/borders_app.rb +1 -3
- data/test/support/examples/drb_app.rb +1 -3
- data/test/support/examples/editor_app.rb +2 -4
- data/test/support/examples/focus_app.rb +1 -3
- data/test/support/examples/hello_world.rb +1 -6
- data/test/support/examples/material_colours_app.rb +1 -3
- data/test/support/examples/view_templates_app/view_templates_app.rb +1 -3
- data/test/support/helpers/model_test_class.rb +1 -5
- data/test/support/who.rb +29 -0
- data/test/test_helper.rb +0 -1
- metadata +5 -17
- data/lib/vedeu/api/all.rb +0 -15
- data/lib/vedeu/api/external.rb +0 -194
- data/lib/vedeu/api/internal.rb +0 -177
- data/test/lib/vedeu/api/external_test.rb +0 -74
- data/test/lib/vedeu/api/internal_test.rb +0 -33
- data/test/support/examples/typed_commands/command.erb +0 -1
- data/test/support/examples/typed_commands/output.erb +0 -1
- data/test/support/examples/typed_commands/status.erb +0 -1
- data/test/support/examples/typed_commands/typed_commands_app.rb +0 -94
@@ -1,12 +1,5 @@
|
|
1
|
-
require 'vedeu/output/presentation/colour'
|
2
|
-
require 'vedeu/output/presentation/styles'
|
3
|
-
require 'vedeu/output/presentation/style'
|
4
|
-
|
5
1
|
module Vedeu
|
6
2
|
|
7
|
-
# This module allows the sharing of presentation concerns between
|
8
|
-
# the models: Interface, View, Line and Stream.
|
9
|
-
#
|
10
3
|
module Presentation
|
11
4
|
|
12
5
|
include Vedeu::Presentation::Colour
|
@@ -104,6 +104,16 @@ module Vedeu
|
|
104
104
|
|
105
105
|
end # Renderers
|
106
106
|
|
107
|
+
# @example
|
108
|
+
# Vedeu.renderer
|
109
|
+
# Vedeu.renderers
|
110
|
+
#
|
111
|
+
# @!method renderer
|
112
|
+
# @see Vedeu::Renderers#renderer
|
113
|
+
# @!method renderers
|
114
|
+
# @see Vedeu::Renderers#renderers
|
115
|
+
def_delegators Vedeu::Renderers, :renderer, :renderers
|
116
|
+
|
107
117
|
end # Vedeu
|
108
118
|
|
109
119
|
require 'vedeu/output/renderers/options'
|
@@ -19,12 +19,12 @@ module Vedeu
|
|
19
19
|
attr_accessor :parent
|
20
20
|
|
21
21
|
# @!attribute [rw] name
|
22
|
-
# @return [String]
|
22
|
+
# @return [String|Symbol|NilClass]
|
23
23
|
attr_accessor :name
|
24
24
|
|
25
25
|
# @param collection [Array|Vedeu::Repositories::Collection]
|
26
26
|
# @param parent [void]
|
27
|
-
# @param name [String|NilClass]
|
27
|
+
# @param name [String|Symbol|NilClass]
|
28
28
|
# @return [Vedeu::Repositories::Collection]
|
29
29
|
def self.coerce(collection = [], parent = nil, name = nil)
|
30
30
|
if collection.is_a?(Vedeu::Repositories::Collection)
|
@@ -40,7 +40,7 @@ module Vedeu
|
|
40
40
|
#
|
41
41
|
# @param collection [void]
|
42
42
|
# @param parent [void]
|
43
|
-
# @param name [String|NilClass]
|
43
|
+
# @param name [String|Symbol|NilClass]
|
44
44
|
# @return [Vedeu::Repositories::Collection]
|
45
45
|
def initialize(collection = [], parent = nil, name = nil)
|
46
46
|
@collection = collection
|
@@ -55,12 +55,12 @@ module Vedeu
|
|
55
55
|
# @example
|
56
56
|
# # Fetch the cursor belonging to the interface of the same
|
57
57
|
# # name.
|
58
|
-
# Vedeu.cursors.by_name(
|
58
|
+
# Vedeu.cursors.by_name(:some_name)
|
59
59
|
#
|
60
60
|
# # Fetch the names of the interfaces belonging to this group.
|
61
61
|
# Vedeu.groups.by_name(name)
|
62
62
|
#
|
63
|
-
# @param name [String] The name of the stored model.
|
63
|
+
# @param name [String|Symbol] The name of the stored model.
|
64
64
|
# @return [void]
|
65
65
|
def by_name(name)
|
66
66
|
name ||= Vedeu.focus
|
@@ -79,7 +79,7 @@ module Vedeu
|
|
79
79
|
|
80
80
|
# Find the model by name.
|
81
81
|
#
|
82
|
-
# @param name [String]
|
82
|
+
# @param name [String|Symbol]
|
83
83
|
# @return [Hash<String => Object>|NilClass]
|
84
84
|
def find(name)
|
85
85
|
storage[name]
|
@@ -88,7 +88,7 @@ module Vedeu
|
|
88
88
|
# Find the model attributes by name, raises an exception when
|
89
89
|
# the model cannot be found.
|
90
90
|
#
|
91
|
-
# @param name [String]
|
91
|
+
# @param name [String|Symbol]
|
92
92
|
# @raise [Vedeu::Error::ModelNotFound] When the model cannot be
|
93
93
|
# found with this name.
|
94
94
|
# @return [Hash<String => Object>]
|
@@ -100,7 +100,7 @@ module Vedeu
|
|
100
100
|
# Find a model by name, registers the model by name when not
|
101
101
|
# found.
|
102
102
|
#
|
103
|
-
# @param name [String]
|
103
|
+
# @param name [String|Symbol]
|
104
104
|
# @return [void]
|
105
105
|
def find_or_create(name)
|
106
106
|
return find(name) if registered?(name)
|
@@ -119,10 +119,10 @@ module Vedeu
|
|
119
119
|
# Returns a boolean indicating whether the named model is
|
120
120
|
# registered.
|
121
121
|
#
|
122
|
-
# @param name [String]
|
122
|
+
# @param name [String|Symbol]
|
123
123
|
# @return [Boolean]
|
124
124
|
def registered?(name)
|
125
|
-
return false if
|
125
|
+
return false if absent?(name)
|
126
126
|
return false if empty?
|
127
127
|
|
128
128
|
storage.include?(name)
|
@@ -131,7 +131,7 @@ module Vedeu
|
|
131
131
|
# Returns the storage with the named model removed, or false
|
132
132
|
# when the model does not exist.
|
133
133
|
#
|
134
|
-
# @param name [String]
|
134
|
+
# @param name [String|Symbol]
|
135
135
|
# @return [Hash|FalseClass]
|
136
136
|
def remove(name)
|
137
137
|
return false if empty?
|
@@ -7,6 +7,7 @@ module Vedeu
|
|
7
7
|
module Store
|
8
8
|
|
9
9
|
include Enumerable
|
10
|
+
include Vedeu::Common
|
10
11
|
|
11
12
|
# @param block [Proc]
|
12
13
|
# @return [Enumerator]
|
@@ -24,10 +25,10 @@ module Vedeu
|
|
24
25
|
# Returns a boolean indicating whether the named model is
|
25
26
|
# registered.
|
26
27
|
#
|
27
|
-
# @param name [String]
|
28
|
+
# @param name [String|Symbol]
|
28
29
|
# @return [Boolean]
|
29
30
|
def exists?(name)
|
30
|
-
return false if empty? ||
|
31
|
+
return false if empty? || absent?(name)
|
31
32
|
|
32
33
|
storage.include?(name)
|
33
34
|
end
|
data/lib/vedeu/runtime/flags.rb
CHANGED
data/lib/vedeu/runtime/router.rb
CHANGED
@@ -17,7 +17,7 @@ module Vedeu
|
|
17
17
|
# @param object [Class]
|
18
18
|
# @param path [String]
|
19
19
|
# @param options [Hash]
|
20
|
-
# @option options name [String] The name of an interface.
|
20
|
+
# @option options name [String|Symbol] The name of an interface.
|
21
21
|
# @return [Vedeu::Templating::Template]
|
22
22
|
def initialize(object, path, options = {})
|
23
23
|
@object = object
|
@@ -26,6 +26,9 @@ module Vedeu
|
|
26
26
|
|
27
27
|
# Clear the output.
|
28
28
|
#
|
29
|
+
# @example
|
30
|
+
# Vedeu.clear
|
31
|
+
#
|
29
32
|
# @return [String|void] Most likely to be a String.
|
30
33
|
def clear
|
31
34
|
reset
|
@@ -137,4 +140,8 @@ module Vedeu
|
|
137
140
|
|
138
141
|
end # Terminal
|
139
142
|
|
143
|
+
# @!method clear
|
144
|
+
# @see Vedeu::Terminal::Buffer#clear
|
145
|
+
def_delegators Vedeu::Terminal::Buffer, :clear
|
146
|
+
|
140
147
|
end # Vedeu
|
@@ -216,4 +216,12 @@ module Vedeu
|
|
216
216
|
|
217
217
|
end # Terminal
|
218
218
|
|
219
|
+
# @!method height
|
220
|
+
# @see Vedeu::Terminal#height
|
221
|
+
# @!method resize
|
222
|
+
# @see Vedeu::Terminal#resize
|
223
|
+
# @!method width
|
224
|
+
# @see Vedeu::Terminal#width
|
225
|
+
def_delegators Vedeu::Terminal, :height, :resize, :width
|
226
|
+
|
219
227
|
end # Vedeu
|
data/lib/vedeu/version.rb
CHANGED
@@ -13,12 +13,6 @@ module Vedeu
|
|
13
13
|
let(:attributes) { { name: 'borders' } }
|
14
14
|
let(:boolean) { true }
|
15
15
|
|
16
|
-
describe '#initialize' do
|
17
|
-
it { instance.must_be_instance_of(described) }
|
18
|
-
it { instance.instance_variable_get('@model').must_equal(model) }
|
19
|
-
it { instance.instance_variable_get('@client').must_equal(client) }
|
20
|
-
end
|
21
|
-
|
22
16
|
describe '.border' do
|
23
17
|
it { described.must_respond_to(:border) }
|
24
18
|
end
|
@@ -60,12 +60,6 @@ module Vedeu
|
|
60
60
|
it { subject.must_equal(12) }
|
61
61
|
end
|
62
62
|
|
63
|
-
describe '#enabled?' do
|
64
|
-
subject { instance.enabled? }
|
65
|
-
|
66
|
-
it { subject.must_be_instance_of(FalseClass) }
|
67
|
-
end
|
68
|
-
|
69
63
|
describe '#height' do
|
70
64
|
subject { instance.height }
|
71
65
|
|
@@ -73,12 +67,6 @@ module Vedeu
|
|
73
67
|
it { subject.must_equal(7) }
|
74
68
|
end
|
75
69
|
|
76
|
-
describe '#null?' do
|
77
|
-
subject { instance.null? }
|
78
|
-
|
79
|
-
it { subject.must_be_instance_of(TrueClass) }
|
80
|
-
end
|
81
|
-
|
82
70
|
describe '#render' do
|
83
71
|
subject { instance.render }
|
84
72
|
|
@@ -7,43 +7,6 @@ module Vedeu
|
|
7
7
|
describe Null do
|
8
8
|
|
9
9
|
let(:described) { Vedeu::Buffers::Null }
|
10
|
-
let(:instance) { described.new(attributes) }
|
11
|
-
let(:attributes){
|
12
|
-
{
|
13
|
-
name: _name
|
14
|
-
}
|
15
|
-
}
|
16
|
-
let(:_name) { 'null_buffer' }
|
17
|
-
|
18
|
-
describe '#initialize' do
|
19
|
-
it { instance.must_be_instance_of(described) }
|
20
|
-
it {
|
21
|
-
instance.instance_variable_get('@attributes').must_equal(attributes)
|
22
|
-
}
|
23
|
-
it { instance.instance_variable_get('@name').must_equal(_name) }
|
24
|
-
end
|
25
|
-
|
26
|
-
describe 'accessors' do
|
27
|
-
it { instance.must_respond_to(:name) }
|
28
|
-
end
|
29
|
-
|
30
|
-
describe '#null' do
|
31
|
-
subject { instance.null }
|
32
|
-
|
33
|
-
it { subject.must_be_instance_of(NilClass) }
|
34
|
-
|
35
|
-
it { instance.must_respond_to(:clear) }
|
36
|
-
it { instance.must_respond_to(:hide) }
|
37
|
-
it { instance.must_respond_to(:render) }
|
38
|
-
it { instance.must_respond_to(:show) }
|
39
|
-
it { instance.must_respond_to(:toggle) }
|
40
|
-
end
|
41
|
-
|
42
|
-
describe '#null?' do
|
43
|
-
subject { instance.null? }
|
44
|
-
|
45
|
-
it { subject.must_be_instance_of(TrueClass) }
|
46
|
-
end
|
47
10
|
|
48
11
|
end # Null
|
49
12
|
|
@@ -10,6 +10,10 @@ module Vedeu
|
|
10
10
|
present?(variable)
|
11
11
|
end
|
12
12
|
|
13
|
+
def undefined_value_test(variable)
|
14
|
+
absent?(variable)
|
15
|
+
end
|
16
|
+
|
13
17
|
end # VedeuCommonClass
|
14
18
|
|
15
19
|
describe Common do
|
@@ -17,6 +21,35 @@ module Vedeu
|
|
17
21
|
let(:described) { Vedeu::VedeuCommonClass }
|
18
22
|
let(:instance) { described.new }
|
19
23
|
|
24
|
+
describe '#absent?' do
|
25
|
+
subject { instance.undefined_value_test(_value) }
|
26
|
+
|
27
|
+
context 'when the variable is a Fixnum' do
|
28
|
+
let(:_value) { 17 }
|
29
|
+
|
30
|
+
it { subject.must_equal(false) }
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'when the variable is not nil or empty' do
|
34
|
+
let(:_value) { 'not empty' }
|
35
|
+
|
36
|
+
it { subject.must_equal(false) }
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'when the variable is nil or empty' do
|
40
|
+
let(:_value) { [] }
|
41
|
+
|
42
|
+
it { subject.must_equal(true) }
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'when dealing with keys which may not exist or have a value' do
|
46
|
+
let(:attributes) { {} }
|
47
|
+
let(:_value) { attributes[:not_found] }
|
48
|
+
|
49
|
+
it { subject.must_equal(true) }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
20
53
|
describe '#demodulize' do
|
21
54
|
let(:klass) { described }
|
22
55
|
|