vedeu 0.8.6 → 0.8.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -2
- data/.travis.yml +1 -1
- data/README.md +2 -6
- data/config/rubocop_enabled.yml +0 -6
- data/docs/dsl/by_method/clock_time.md +4 -1
- data/lib/vedeu/application/application_controller.rb +2 -2
- data/lib/vedeu/application/controller.rb +3 -3
- data/lib/vedeu/borders/border.rb +6 -6
- data/lib/vedeu/borders/dsl.rb +26 -26
- data/lib/vedeu/borders/refresh.rb +2 -2
- data/lib/vedeu/borders/title.rb +4 -4
- data/lib/vedeu/buffers/refresh.rb +8 -7
- data/lib/vedeu/buffers/terminal.rb +1 -1
- data/lib/vedeu/buffers/view.rb +2 -2
- data/lib/vedeu/cells/clear.rb +1 -1
- data/lib/vedeu/cells/cursor.rb +6 -6
- data/lib/vedeu/cells/empty.rb +2 -2
- data/lib/vedeu/cells/escape.rb +6 -6
- data/lib/vedeu/coercers/alignment.rb +1 -1
- data/lib/vedeu/coercers/colour_attributes.rb +8 -16
- data/lib/vedeu/colours/background.rb +4 -8
- data/lib/vedeu/colours/colour.rb +4 -4
- data/lib/vedeu/colours/foreground.rb +4 -8
- data/lib/vedeu/colours/repository.rb +1 -1
- data/lib/vedeu/colours/translator.rb +6 -6
- data/lib/vedeu/common.rb +1 -1
- data/lib/vedeu/configuration/api.rb +15 -15
- data/lib/vedeu/configuration/configuration.rb +8 -8
- data/lib/vedeu/cursors/coordinate.rb +4 -4
- data/lib/vedeu/cursors/cursor.rb +2 -2
- data/lib/vedeu/distributed/client.rb +2 -2
- data/lib/vedeu/distributed/server.rb +8 -10
- data/lib/vedeu/distributed/subprocess.rb +1 -1
- data/lib/vedeu/distributed/uri.rb +1 -1
- data/lib/vedeu/dsl/cursors.rb +2 -2
- data/lib/vedeu/dsl/elements.rb +5 -5
- data/lib/vedeu/dsl/helpers/align.rb +1 -1
- data/lib/vedeu/dsl/helpers/attributes.rb +1 -1
- data/lib/vedeu/dsl/presentation.rb +15 -15
- data/lib/vedeu/dsl/view.rb +1 -1
- data/lib/vedeu/dsl/views.rb +1 -1
- data/lib/vedeu/editor/cursor.rb +1 -1
- data/lib/vedeu/editor/line.rb +2 -2
- data/lib/vedeu/editor/lines.rb +2 -2
- data/lib/vedeu/esc/borders.rb +19 -19
- data/lib/vedeu/esc/colours.rb +1 -1
- data/lib/vedeu/events/aliases.rb +3 -15
- data/lib/vedeu/events/event.rb +14 -14
- data/lib/vedeu/events/repository.rb +1 -1
- data/lib/vedeu/geometries/area/area.rb +5 -5
- data/lib/vedeu/geometries/area/dimension.rb +1 -1
- data/lib/vedeu/geometries/dsl/dsl.rb +7 -7
- data/lib/vedeu/geometries/geometry.rb +2 -2
- data/lib/vedeu/geometries/position.rb +6 -6
- data/lib/vedeu/groups/clear.rb +2 -2
- data/lib/vedeu/groups/group.rb +2 -2
- data/lib/vedeu/input/dsl.rb +1 -1
- data/lib/vedeu/input/key.rb +3 -3
- data/lib/vedeu/input/mapper.rb +2 -2
- data/lib/vedeu/input/read.rb +2 -4
- data/lib/vedeu/input/store.rb +1 -17
- data/lib/vedeu/input/translator.rb +49 -45
- data/lib/vedeu/interfaces/clear.rb +3 -3
- data/lib/vedeu/interfaces/dsl.rb +4 -4
- data/lib/vedeu/interfaces/interface.rb +2 -2
- data/lib/vedeu/logging/clock_time.rb +3 -3
- data/lib/vedeu/logging/debug.rb +14 -6
- data/lib/vedeu/logging/log.rb +1 -1
- data/lib/vedeu/menus/dsl.rb +2 -2
- data/lib/vedeu/menus/menu.rb +9 -9
- data/lib/vedeu/models/focus.rb +11 -11
- data/lib/vedeu/models/page.rb +1 -1
- data/lib/vedeu/models/row.rb +1 -1
- data/lib/vedeu/models/toggleable.rb +7 -7
- data/lib/vedeu/null/generic.rb +29 -29
- data/lib/vedeu/output/compressor_cache.rb +1 -11
- data/lib/vedeu/output/viewport.rb +4 -12
- data/lib/vedeu/output/write.rb +3 -3
- data/lib/vedeu/plugins/plugin.rb +1 -1
- data/lib/vedeu/presentation/colour.rb +1 -1
- data/lib/vedeu/presentation/presentation.rb +1 -1
- data/lib/vedeu/presentation/style.rb +4 -4
- data/lib/vedeu/renderers/all.rb +1 -14
- data/lib/vedeu/renderers/options.rb +1 -1
- data/lib/vedeu/repositories/all.rb +1 -0
- data/lib/vedeu/repositories/assemblage.rb +1 -1
- data/lib/vedeu/repositories/collection.rb +4 -4
- data/lib/vedeu/repositories/registerable.rb +2 -2
- data/lib/vedeu/repositories/repositories.rb +1 -1
- data/lib/vedeu/repositories/repository.rb +3 -3
- data/lib/vedeu/repositories/storage.rb +38 -0
- data/lib/vedeu/repositories/store.rb +5 -22
- data/lib/vedeu/runtime/application.rb +1 -1
- data/lib/vedeu/runtime/flags.rb +3 -3
- data/lib/vedeu/runtime/router.rb +3 -18
- data/lib/vedeu/templating/helpers.rb +5 -3
- data/lib/vedeu/templating/view_template.rb +26 -18
- data/lib/vedeu/terminal/terminal.rb +5 -5
- data/lib/vedeu/version.rb +1 -1
- data/lib/vedeu/views/chars.rb +1 -1
- data/lib/vedeu/views/composition.rb +4 -4
- data/lib/vedeu/views/default_attributes.rb +2 -2
- data/lib/vedeu/views/line.rb +6 -6
- data/lib/vedeu/views/lines.rb +1 -1
- data/lib/vedeu/views/stream.rb +6 -6
- data/lib/vedeu/views/streams.rb +1 -1
- data/lib/vedeu/views/view.rb +4 -4
- data/test/lib/vedeu/borders/border_test.rb +1 -1
- data/test/lib/vedeu/borders/caption_test.rb +1 -1
- data/test/lib/vedeu/borders/dsl_test.rb +2 -3
- data/test/lib/vedeu/borders/refresh_test.rb +1 -1
- data/test/lib/vedeu/borders/title_test.rb +1 -1
- data/test/lib/vedeu/buffers/buffer_test.rb +7 -7
- data/test/lib/vedeu/buffers/refresh_test.rb +1 -1
- data/test/lib/vedeu/colours/background_test.rb +27 -0
- data/test/lib/vedeu/colours/foreground_test.rb +27 -0
- data/test/lib/vedeu/cursors/cursor_test.rb +3 -3
- data/test/lib/vedeu/cursors/move_test.rb +1 -1
- data/test/lib/vedeu/cursors/refresh_test.rb +1 -1
- data/test/lib/vedeu/cursors/reposition_test.rb +2 -2
- data/test/lib/vedeu/dsl/view_test.rb +6 -8
- data/test/lib/vedeu/editor/cropper_test.rb +1 -1
- data/test/lib/vedeu/editor/cursor_test.rb +1 -1
- data/test/lib/vedeu/editor/document_test.rb +1 -1
- data/test/lib/vedeu/editor/editor_test.rb +1 -1
- data/test/lib/vedeu/events/aliases_test.rb +0 -14
- data/test/lib/vedeu/geometries/area/area_test.rb +1 -1
- data/test/lib/vedeu/geometries/geometry_test.rb +1 -1
- data/test/lib/vedeu/geometries/move_test.rb +1 -1
- data/test/lib/vedeu/groups/clear_test.rb +1 -1
- data/test/lib/vedeu/groups/dsl_test.rb +1 -1
- data/test/lib/vedeu/groups/group_test.rb +1 -1
- data/test/lib/vedeu/groups/refresh_test.rb +1 -1
- data/test/lib/vedeu/input/capture_test.rb +2 -2
- data/test/lib/vedeu/input/store_test.rb +0 -34
- data/test/lib/vedeu/interfaces/clear_test.rb +1 -1
- data/test/lib/vedeu/interfaces/dsl_test.rb +4 -4
- data/test/lib/vedeu/interfaces/interface_test.rb +1 -1
- data/test/lib/vedeu/menus/dsl_test.rb +1 -1
- data/test/lib/vedeu/null/generic_test.rb +1 -1
- data/test/lib/vedeu/output/compressor_cache_test.rb +0 -33
- data/test/lib/vedeu/renderers/all_test.rb +0 -8
- data/test/lib/vedeu/repositories/repository_test.rb +2 -2
- data/test/lib/vedeu/repositories/storage_test.rb +74 -0
- data/test/lib/vedeu/repositories/store_test.rb +10 -28
- data/test/lib/vedeu/runtime/router_test.rb +0 -8
- data/test/lib/vedeu/views/default_attributes_test.rb +5 -5
- data/test/lib/vedeu/views/view_test.rb +5 -2
- data/test/test_helper.rb +1 -1
- data/vedeu.gemspec +1 -1
- metadata +7 -4
data/lib/vedeu/output/write.rb
CHANGED
@@ -59,7 +59,7 @@ module Vedeu
|
|
59
59
|
# @!attribute [r] output
|
60
60
|
# @return [String]
|
61
61
|
attr_reader :output
|
62
|
-
|
62
|
+
alias value output
|
63
63
|
|
64
64
|
private
|
65
65
|
|
@@ -75,7 +75,7 @@ module Vedeu
|
|
75
75
|
def options
|
76
76
|
defaults.merge!(@options)
|
77
77
|
end
|
78
|
-
|
78
|
+
alias attributes options
|
79
79
|
|
80
80
|
# @return [String]
|
81
81
|
def output
|
@@ -102,7 +102,7 @@ module Vedeu
|
|
102
102
|
def to_s
|
103
103
|
@_to_s ||= super + Vedeu.esc.reset + position(position_end)
|
104
104
|
end
|
105
|
-
|
105
|
+
alias to_str to_s
|
106
106
|
|
107
107
|
end # Write
|
108
108
|
|
data/lib/vedeu/plugins/plugin.rb
CHANGED
@@ -62,7 +62,7 @@ module Vedeu
|
|
62
62
|
# @return [Hash<Symbol => Array<String|Symbol>|String|Symbol>]
|
63
63
|
def attributes
|
64
64
|
{
|
65
|
-
style: value
|
65
|
+
style: value,
|
66
66
|
}
|
67
67
|
end
|
68
68
|
|
@@ -73,7 +73,7 @@ module Vedeu
|
|
73
73
|
def eql?(other)
|
74
74
|
self.class == other.class && value == other.value
|
75
75
|
end
|
76
|
-
|
76
|
+
alias == eql?
|
77
77
|
|
78
78
|
# @return [String]
|
79
79
|
def to_ast
|
@@ -89,8 +89,8 @@ module Vedeu
|
|
89
89
|
|
90
90
|
@sequences ||= Array(value).flat_map { |v| Vedeu.esc.string(v) }.join
|
91
91
|
end
|
92
|
-
|
93
|
-
|
92
|
+
alias escape_sequences to_s
|
93
|
+
alias to_str to_s
|
94
94
|
|
95
95
|
end # Style
|
96
96
|
|
data/lib/vedeu/renderers/all.rb
CHANGED
@@ -8,6 +8,7 @@ module Vedeu
|
|
8
8
|
|
9
9
|
extend Enumerable
|
10
10
|
extend self
|
11
|
+
extend Vedeu::Repositories::Storage
|
11
12
|
|
12
13
|
# Instructs each renderer registered with Vedeu to clear their
|
13
14
|
# content.
|
@@ -56,15 +57,6 @@ module Vedeu
|
|
56
57
|
output
|
57
58
|
end
|
58
59
|
|
59
|
-
# @example
|
60
|
-
# Vedeu.renderers.reset!
|
61
|
-
#
|
62
|
-
# @return [Set]
|
63
|
-
def reset!
|
64
|
-
@storage = in_memory
|
65
|
-
end
|
66
|
-
alias_method :reset, :reset!
|
67
|
-
|
68
60
|
private
|
69
61
|
|
70
62
|
# @return [Set]
|
@@ -91,11 +83,6 @@ module Vedeu
|
|
91
83
|
@mutex ||= Mutex.new
|
92
84
|
end
|
93
85
|
|
94
|
-
# @return [Set]
|
95
|
-
def storage
|
96
|
-
@storage ||= in_memory
|
97
|
-
end
|
98
|
-
|
99
86
|
# @param block [Proc]
|
100
87
|
# @return [void]
|
101
88
|
def threaded(renderer, &block)
|
@@ -16,8 +16,8 @@ module Vedeu
|
|
16
16
|
# @!attribute [r] collection
|
17
17
|
# @return [Array|Vedeu::Repositories::Collection]
|
18
18
|
attr_reader :collection
|
19
|
-
|
20
|
-
|
19
|
+
alias all collection
|
20
|
+
alias value collection
|
21
21
|
|
22
22
|
# @!attribute [rw] parent
|
23
23
|
# @return [Fixnum]
|
@@ -66,7 +66,7 @@ module Vedeu
|
|
66
66
|
|
67
67
|
end
|
68
68
|
end
|
69
|
-
|
69
|
+
alias << add
|
70
70
|
|
71
71
|
# Returns the collection as a String.
|
72
72
|
#
|
@@ -74,7 +74,7 @@ module Vedeu
|
|
74
74
|
def to_s
|
75
75
|
collection.map(&:to_s).join
|
76
76
|
end
|
77
|
-
|
77
|
+
alias to_str to_s
|
78
78
|
|
79
79
|
end # Collection
|
80
80
|
|
@@ -60,7 +60,7 @@ module Vedeu
|
|
60
60
|
def reset!
|
61
61
|
@models = register
|
62
62
|
end
|
63
|
-
|
63
|
+
alias reset reset!
|
64
64
|
|
65
65
|
end # ClassMethods
|
66
66
|
|
@@ -72,7 +72,7 @@ module Vedeu
|
|
72
72
|
|
73
73
|
# @return [Boolean]
|
74
74
|
def null_model?
|
75
|
-
|
75
|
+
respond_to?(:null_model) && present?(:null_model)
|
76
76
|
end
|
77
77
|
|
78
78
|
end # InstanceMethods
|
@@ -143,7 +143,7 @@ module Vedeu
|
|
143
143
|
storage.delete(name)
|
144
144
|
storage unless storage.is_a?(Set)
|
145
145
|
end
|
146
|
-
|
146
|
+
alias delete remove
|
147
147
|
|
148
148
|
# Stores the model instance by name in the repository of the
|
149
149
|
# model.
|
@@ -164,8 +164,8 @@ module Vedeu
|
|
164
164
|
|
165
165
|
model
|
166
166
|
end
|
167
|
-
|
168
|
-
|
167
|
+
alias register store
|
168
|
+
alias add store
|
169
169
|
|
170
170
|
private
|
171
171
|
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Vedeu
|
2
|
+
|
3
|
+
module Repositories
|
4
|
+
|
5
|
+
# Provides behaviour for resetting and accessing the storage of
|
6
|
+
# various repositories.
|
7
|
+
#
|
8
|
+
# @api private
|
9
|
+
#
|
10
|
+
module Storage
|
11
|
+
|
12
|
+
extend self
|
13
|
+
|
14
|
+
# Remove all currently stored data for this repository.
|
15
|
+
#
|
16
|
+
# @return [void]
|
17
|
+
def reset!
|
18
|
+
Vedeu.log(type: :reset,
|
19
|
+
message: "Resetting repository '#{self.class.name}'")
|
20
|
+
|
21
|
+
@storage = in_memory
|
22
|
+
end
|
23
|
+
alias reset reset!
|
24
|
+
|
25
|
+
# Return whole repository; provides raw access to the storage
|
26
|
+
# for this repository.
|
27
|
+
#
|
28
|
+
# @return [void]
|
29
|
+
def storage
|
30
|
+
@storage ||= in_memory
|
31
|
+
end
|
32
|
+
alias all storage
|
33
|
+
|
34
|
+
end # Storage
|
35
|
+
|
36
|
+
end # Repositories
|
37
|
+
|
38
|
+
end # Vedeu
|
@@ -12,6 +12,10 @@ module Vedeu
|
|
12
12
|
|
13
13
|
include Enumerable
|
14
14
|
include Vedeu::Common
|
15
|
+
include Vedeu::Repositories::Storage
|
16
|
+
|
17
|
+
alias all storage
|
18
|
+
alias clear reset!
|
15
19
|
|
16
20
|
# @param block [Proc]
|
17
21
|
# @return [Enumerator]
|
@@ -36,7 +40,7 @@ module Vedeu
|
|
36
40
|
|
37
41
|
storage.include?(name)
|
38
42
|
end
|
39
|
-
|
43
|
+
alias registered? exists?
|
40
44
|
|
41
45
|
# Returns a collection of the names of all the registered
|
42
46
|
# entities.
|
@@ -50,18 +54,6 @@ module Vedeu
|
|
50
54
|
storage
|
51
55
|
end
|
52
56
|
|
53
|
-
# Remove all currently stored data.
|
54
|
-
#
|
55
|
-
# @return [Array|Hash|Set]
|
56
|
-
def reset!
|
57
|
-
Vedeu.log(type: :reset,
|
58
|
-
message: "(#{self.class.name}) #{registered.inspect}")
|
59
|
-
|
60
|
-
@storage = in_memory
|
61
|
-
end
|
62
|
-
alias_method :reset, :reset!
|
63
|
-
alias_method :clear, :reset
|
64
|
-
|
65
57
|
# Return the number of entries stored.
|
66
58
|
#
|
67
59
|
# @return [Fixnum]
|
@@ -69,15 +61,6 @@ module Vedeu
|
|
69
61
|
storage.size
|
70
62
|
end
|
71
63
|
|
72
|
-
# Return whole repository; provides raw access to the storage
|
73
|
-
# for this repository.
|
74
|
-
#
|
75
|
-
# @return [Array|Hash|Set]
|
76
|
-
def storage
|
77
|
-
@storage ||= in_memory
|
78
|
-
end
|
79
|
-
alias_method :all, :storage
|
80
|
-
|
81
64
|
# @return [Hash]
|
82
65
|
def in_memory
|
83
66
|
{}
|
data/lib/vedeu/runtime/flags.rb
CHANGED
@@ -30,7 +30,7 @@ module Vedeu
|
|
30
30
|
def reset!
|
31
31
|
instance.reset!
|
32
32
|
end
|
33
|
-
|
33
|
+
alias reset reset!
|
34
34
|
|
35
35
|
end # Eigenclass
|
36
36
|
|
@@ -49,14 +49,14 @@ module Vedeu
|
|
49
49
|
def reset!
|
50
50
|
self.options = defaults
|
51
51
|
end
|
52
|
-
|
52
|
+
alias reset reset!
|
53
53
|
|
54
54
|
private
|
55
55
|
|
56
56
|
# @return [Hash]
|
57
57
|
def defaults
|
58
58
|
{
|
59
|
-
ready: false
|
59
|
+
ready: false,
|
60
60
|
}
|
61
61
|
end
|
62
62
|
|
data/lib/vedeu/runtime/router.rb
CHANGED
@@ -11,6 +11,7 @@ module Vedeu
|
|
11
11
|
|
12
12
|
include Vedeu::Common
|
13
13
|
|
14
|
+
extend Vedeu::Repositories::Storage
|
14
15
|
extend self
|
15
16
|
|
16
17
|
# Registers a controller with the given controller name for the
|
@@ -30,7 +31,7 @@ module Vedeu
|
|
30
31
|
message: "Controller: ':#{controller}'")
|
31
32
|
|
32
33
|
if registered?(controller)
|
33
|
-
storage[controller]
|
34
|
+
storage[controller][:klass] = klass
|
34
35
|
|
35
36
|
else
|
36
37
|
storage.store(controller, klass: klass, actions: [])
|
@@ -85,7 +86,7 @@ module Vedeu
|
|
85
86
|
|
86
87
|
route(controller, action, args) if action_defined?(action, controller)
|
87
88
|
end
|
88
|
-
|
89
|
+
alias action goto
|
89
90
|
|
90
91
|
# Returns a boolean indicating whether the given controller name
|
91
92
|
# is already registered.
|
@@ -96,14 +97,6 @@ module Vedeu
|
|
96
97
|
storage.key?(controller)
|
97
98
|
end
|
98
99
|
|
99
|
-
# Removes all stored controllers with their respective actions.
|
100
|
-
#
|
101
|
-
# @return [Hash<void>]
|
102
|
-
def reset!
|
103
|
-
@storage = in_memory
|
104
|
-
end
|
105
|
-
alias_method :reset, :reset!
|
106
|
-
|
107
100
|
private
|
108
101
|
|
109
102
|
# Returns a boolean indicating whether the given action name is
|
@@ -163,14 +156,6 @@ module Vedeu
|
|
163
156
|
present?(storage[controller][:klass])
|
164
157
|
end
|
165
158
|
|
166
|
-
# Returns all the stored controllers and their respective
|
167
|
-
# actions.
|
168
|
-
#
|
169
|
-
# @return [Hash<Symbol => Hash<Symbol => String|Array<Symbol>>>]
|
170
|
-
def storage
|
171
|
-
@storage ||= in_memory
|
172
|
-
end
|
173
|
-
|
174
159
|
# Returns an empty collection ready for the storing of client
|
175
160
|
# application controllers and actions.
|
176
161
|
#
|
@@ -17,7 +17,7 @@ module Vedeu
|
|
17
17
|
def background(value, &block)
|
18
18
|
define_stream(background: value, &block)
|
19
19
|
end
|
20
|
-
|
20
|
+
alias bg background
|
21
21
|
|
22
22
|
# @param attributes [Hash]
|
23
23
|
# @option attributes foreground [String] The HTML/CSS foreground
|
@@ -38,7 +38,7 @@ module Vedeu
|
|
38
38
|
def foreground(value, &block)
|
39
39
|
define_stream(foreground: value, &block)
|
40
40
|
end
|
41
|
-
|
41
|
+
alias fg foreground
|
42
42
|
|
43
43
|
# @param value [Symbol]
|
44
44
|
# @param block [Proc]
|
@@ -53,11 +53,13 @@ module Vedeu
|
|
53
53
|
def define_stream(attributes = {}, &block)
|
54
54
|
fail Vedeu::Error::RequiresBlock unless block_given?
|
55
55
|
|
56
|
+
value = yield
|
57
|
+
|
56
58
|
encode(
|
57
59
|
Vedeu::Views::Stream.build(
|
58
60
|
colour: Vedeu::Colours::Colour.new(attributes),
|
59
61
|
style: Vedeu::Presentation::Style.new(attributes[:style]),
|
60
|
-
value:
|
62
|
+
value: value))
|
61
63
|
end
|
62
64
|
|
63
65
|
# @param data [String]
|