vedeu 0.8.9 → 0.8.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +1 -0
- data/docs/configuration/drb.md +6 -0
- data/docs/configuration/drb_host.md +6 -0
- data/docs/configuration/drb_port.md +6 -0
- data/docs/configuration/interactive.md +21 -0
- data/docs/configuration/run_once.md +8 -0
- data/docs/configuration/standalone.md +20 -0
- data/docs/dsl.md +1 -1
- data/lib/vedeu.rb +15 -5
- data/lib/vedeu/application/controller.rb +5 -6
- data/lib/vedeu/borders/border.rb +1 -5
- data/lib/vedeu/borders/title.rb +6 -1
- data/lib/vedeu/buffers/buffer.rb +1 -3
- data/lib/vedeu/buffers/empty.rb +1 -3
- data/lib/vedeu/buffers/refresh.rb +1 -1
- data/lib/vedeu/buffers/view.rb +1 -1
- data/lib/vedeu/cells/border.rb +1 -1
- data/lib/vedeu/cells/borders/edges/bottom_horizontal.rb +1 -1
- data/lib/vedeu/cells/borders/edges/left_vertical.rb +1 -1
- data/lib/vedeu/cells/borders/edges/right_vertical.rb +1 -1
- data/lib/vedeu/cells/borders/edges/top_horizontal.rb +1 -1
- data/lib/vedeu/cells/borders/horizontal.rb +1 -1
- data/lib/vedeu/cells/borders/vertical.rb +1 -1
- data/lib/vedeu/cells/borders/vertices/bottom_left.rb +1 -1
- data/lib/vedeu/cells/borders/vertices/bottom_right.rb +1 -1
- data/lib/vedeu/cells/borders/vertices/top_left.rb +1 -1
- data/lib/vedeu/cells/borders/vertices/top_right.rb +1 -1
- data/lib/vedeu/cells/cursor.rb +1 -1
- data/lib/vedeu/cells/empty.rb +1 -1
- data/lib/vedeu/coercers/coercer.rb +8 -0
- data/lib/vedeu/coercers/colour.rb +6 -4
- data/lib/vedeu/coercers/editor_line.rb +4 -1
- data/lib/vedeu/coercers/editor_lines.rb +18 -3
- data/lib/vedeu/coercers/lines.rb +2 -1
- data/lib/vedeu/coercers/page.rb +2 -6
- data/lib/vedeu/coercers/position.rb +1 -3
- data/lib/vedeu/coercers/row.rb +0 -1
- data/lib/vedeu/colours/colour.rb +1 -2
- data/lib/vedeu/configuration/api.rb +6 -69
- data/lib/vedeu/configuration/configuration.rb +1 -4
- data/lib/vedeu/cursors/coordinate.rb +1 -3
- data/lib/vedeu/cursors/cursor.rb +4 -7
- data/lib/vedeu/cursors/reposition.rb +1 -1
- data/lib/vedeu/distributed/test_application.rb +1 -3
- data/lib/vedeu/dsl/border.rb +3 -4
- data/lib/vedeu/dsl/geometry.rb +6 -7
- data/lib/vedeu/dsl/helpers/align.rb +1 -1
- data/lib/vedeu/dsl/helpers/attributes.rb +2 -2
- data/lib/vedeu/dsl/helpers/truncate.rb +1 -2
- data/lib/vedeu/dsl/helpers/wordwrap.rb +1 -3
- data/lib/vedeu/dsl/presentation.rb +18 -0
- data/lib/vedeu/editor/cursor.rb +1 -3
- data/lib/vedeu/editor/document.rb +1 -3
- data/lib/vedeu/editor/line.rb +4 -12
- data/lib/vedeu/editor/lines.rb +3 -29
- data/lib/vedeu/events/event.rb +1 -3
- data/lib/vedeu/geometries/area/dimension.rb +1 -3
- data/lib/vedeu/geometries/area/x_dimension.rb +1 -1
- data/lib/vedeu/geometries/area/y_dimension.rb +1 -1
- data/lib/vedeu/geometries/geometry.rb +1 -4
- data/lib/vedeu/geometries/move.rb +1 -1
- data/lib/vedeu/groups/group.rb +4 -7
- data/lib/vedeu/input/keymap.rb +1 -3
- data/lib/vedeu/input/keys.rb +2 -0
- data/lib/vedeu/input/mapper.rb +2 -0
- data/lib/vedeu/input/mouse.rb +2 -0
- data/lib/vedeu/input/read.rb +1 -7
- data/lib/vedeu/interfaces/clear.rb +1 -1
- data/lib/vedeu/interfaces/interface.rb +11 -6
- data/lib/vedeu/logging/lockless_log_device.rb +18 -2
- data/lib/vedeu/logging/timer.rb +17 -9
- data/lib/vedeu/menus/menu.rb +1 -3
- data/lib/vedeu/models/toggleable.rb +5 -6
- data/lib/vedeu/output/all.rb +3 -0
- data/lib/vedeu/output/compressor.rb +1 -1
- data/lib/vedeu/output/output.rb +2 -3
- data/lib/vedeu/output/refresh.rb +1 -1
- data/lib/vedeu/output/write.rb +3 -2
- data/lib/vedeu/renderers/options.rb +1 -3
- data/lib/vedeu/repositories/defaults.rb +1 -1
- data/lib/vedeu/repositories/model.rb +5 -6
- data/lib/vedeu/repositories/registerable.rb +6 -8
- data/lib/vedeu/runtime/flags.rb +2 -2
- data/lib/vedeu/support/y_coordinate.rb +1 -1
- data/lib/vedeu/version.rb +1 -1
- data/lib/vedeu/views/composition.rb +1 -3
- data/lib/vedeu/views/default_attributes.rb +2 -4
- data/lib/vedeu/views/value.rb +6 -8
- data/lib/vedeu/views/view.rb +9 -3
- data/test/lib/vedeu/application/application_helper_test.rb +3 -2
- data/test/lib/vedeu/application/controller_test.rb +10 -11
- data/test/lib/vedeu/application/helper_test.rb +3 -2
- data/test/lib/vedeu/application/view_test.rb +4 -3
- data/test/lib/vedeu/coercers/editor_line_test.rb +21 -0
- data/test/lib/vedeu/coercers/editor_lines_test.rb +41 -0
- data/test/lib/vedeu/coercers/page_test.rb +1 -1
- data/test/lib/vedeu/cursors/dsl_test.rb +11 -10
- data/test/lib/vedeu/dsl/dsl_test.rb +3 -2
- data/test/lib/vedeu/dsl/elements_test.rb +19 -21
- data/test/lib/vedeu/dsl/presentation_test.rb +42 -0
- data/test/lib/vedeu/editor/collection_test.rb +5 -4
- data/test/lib/vedeu/editor/line_test.rb +4 -27
- data/test/lib/vedeu/editor/lines_test.rb +4 -54
- data/test/lib/vedeu/logging/timer_test.rb +11 -1
- data/test/lib/vedeu/models/toggleable_test.rb +27 -25
- data/test/lib/vedeu/output/compressor_cache_test.rb +0 -3
- data/test/lib/vedeu/presentation/colour_test.rb +13 -12
- data/test/lib/vedeu/presentation/presentation_test.rb +4 -2
- data/test/lib/vedeu/presentation/styles_test.rb +5 -3
- data/test/lib/vedeu/renderers/options_test.rb +10 -12
- data/test/lib/vedeu/repositories/assemblage_test.rb +11 -10
- data/test/lib/vedeu/repositories/collection_test.rb +1 -1
- data/test/lib/vedeu/repositories/defaults_test.rb +9 -7
- data/test/lib/vedeu/repositories/model_test.rb +10 -9
- data/test/lib/vedeu/repositories/registerable_test.rb +19 -18
- data/test/lib/vedeu/repositories/repository_test.rb +7 -7
- data/test/lib/vedeu/repositories/store_test.rb +14 -13
- data/test/lib/vedeu/templating/helpers_test.rb +9 -8
- data/test/lib/vedeu/views/default_attributes_test.rb +17 -17
- data/test/lib/vedeu/views/value_test.rb +0 -1
- data/test/support/helpers/model_test_class.rb +1 -2
- metadata +8 -2
data/lib/vedeu/coercers/lines.rb
CHANGED
data/lib/vedeu/coercers/page.rb
CHANGED
@@ -11,9 +11,7 @@ module Vedeu
|
|
11
11
|
#
|
12
12
|
class Page < Vedeu::Coercers::Coercer
|
13
13
|
|
14
|
-
# @
|
15
|
-
# [Vedeu::Models::Page|Vedeu::Models::Row|Array<void>|void]
|
16
|
-
# @macro raise_invalid_syntax
|
14
|
+
# @macro raise_fatal
|
17
15
|
# @return [Vedeu::Models::Page]
|
18
16
|
def coerce
|
19
17
|
if coerced?
|
@@ -31,9 +29,7 @@ module Vedeu
|
|
31
29
|
klass.new(values)
|
32
30
|
|
33
31
|
else
|
34
|
-
|
35
|
-
"Cannot coerce as value is not an Array, #{klass} " \
|
36
|
-
"or Vedeu::Models::Row. Is a '#{value.class.name}'."
|
32
|
+
incoercible!
|
37
33
|
|
38
34
|
end
|
39
35
|
end
|
data/lib/vedeu/coercers/row.rb
CHANGED
data/lib/vedeu/colours/colour.rb
CHANGED
@@ -39,25 +39,7 @@ module Vedeu
|
|
39
39
|
.log(Vedeu.esc.green { '[api]' }, options)
|
40
40
|
end
|
41
41
|
|
42
|
-
#
|
43
|
-
# Vedeu is to be interactive.
|
44
|
-
#
|
45
|
-
# Vedeu.configure do
|
46
|
-
# interactive! # => same as `interactive true` or
|
47
|
-
# # `standalone false`
|
48
|
-
# # ...
|
49
|
-
# end
|
50
|
-
#
|
51
|
-
# Vedeu.configure do
|
52
|
-
# interactive true # => Allow user input.
|
53
|
-
# # ...
|
54
|
-
# end
|
55
|
-
#
|
56
|
-
# Vedeu.configure do
|
57
|
-
# interactive false # => Disallow user input.
|
58
|
-
# # ...
|
59
|
-
# end
|
60
|
-
#
|
42
|
+
# {include:file:docs/configuration/interactive.md}
|
61
43
|
# @param value [Boolean]
|
62
44
|
# @return [Boolean]
|
63
45
|
def interactive!(value = true)
|
@@ -65,25 +47,7 @@ module Vedeu
|
|
65
47
|
end
|
66
48
|
alias interactive interactive!
|
67
49
|
|
68
|
-
#
|
69
|
-
# setting {include:Vedeu::Config::API#interactive!} to false.
|
70
|
-
#
|
71
|
-
# Vedeu.configure do
|
72
|
-
# standalone! # => same as `standalone true` or
|
73
|
-
# # `interactive false`
|
74
|
-
# # ...
|
75
|
-
# end
|
76
|
-
#
|
77
|
-
# Vedeu.configure do
|
78
|
-
# standalone true # => Disallow user input.
|
79
|
-
# # ...
|
80
|
-
# end
|
81
|
-
#
|
82
|
-
# Vedeu.configure do
|
83
|
-
# standalone false # => Allow user input.
|
84
|
-
# # ...
|
85
|
-
# end
|
86
|
-
#
|
50
|
+
# {include:file:docs/configuration/standalone.md}
|
87
51
|
# @param value [Boolean]
|
88
52
|
# @return [Boolean]
|
89
53
|
def standalone!(value = true)
|
@@ -91,16 +55,7 @@ module Vedeu
|
|
91
55
|
end
|
92
56
|
alias standalone standalone!
|
93
57
|
|
94
|
-
#
|
95
|
-
# effect, using `run_once!` or setting `run_once` to true will
|
96
|
-
# allow Vedeu to initialize, run any client application code,
|
97
|
-
# cleanup, then terminate.
|
98
|
-
#
|
99
|
-
# Vedeu.configure do
|
100
|
-
# run_once!
|
101
|
-
# # ...
|
102
|
-
# end
|
103
|
-
#
|
58
|
+
# {include:file:docs/configuration/run_once.md}
|
104
59
|
# @param value [Boolean]
|
105
60
|
# @return [Boolean]
|
106
61
|
def run_once!(value = true)
|
@@ -108,13 +63,7 @@ module Vedeu
|
|
108
63
|
end
|
109
64
|
alias run_once run_once!
|
110
65
|
|
111
|
-
#
|
112
|
-
#
|
113
|
-
# Vedeu.configure do
|
114
|
-
# drb!
|
115
|
-
# # ...
|
116
|
-
# end
|
117
|
-
#
|
66
|
+
# {include:file:docs/configuration/drb.md}
|
118
67
|
# @param value [Boolean]
|
119
68
|
# @return [Boolean]
|
120
69
|
def drb!(value = true)
|
@@ -122,26 +71,14 @@ module Vedeu
|
|
122
71
|
end
|
123
72
|
alias drb drb!
|
124
73
|
|
125
|
-
#
|
126
|
-
#
|
127
|
-
# Vedeu.configure do
|
128
|
-
# drb_host 'localhost'
|
129
|
-
# # ...
|
130
|
-
# end
|
131
|
-
#
|
74
|
+
# {include:file:docs/configuration/drb_host.md}
|
132
75
|
# @param hostname [String]
|
133
76
|
# @return [String]
|
134
77
|
def drb_host(hostname = '')
|
135
78
|
options[:drb_host] = hostname
|
136
79
|
end
|
137
80
|
|
138
|
-
#
|
139
|
-
#
|
140
|
-
# Vedeu.configure do
|
141
|
-
# drb_port 12345
|
142
|
-
# # ...
|
143
|
-
# end
|
144
|
-
#
|
81
|
+
# {include:file:docs/configuration/drb_port.md}
|
145
82
|
# @param port [Fixnum|String]
|
146
83
|
# @return [String]
|
147
84
|
def drb_port(port = '')
|
@@ -350,10 +350,7 @@ module Vedeu
|
|
350
350
|
|
351
351
|
private
|
352
352
|
|
353
|
-
#
|
354
|
-
# environment variables also.
|
355
|
-
#
|
356
|
-
# @return [Hash<Symbol => void>]
|
353
|
+
# @macro defaults_method
|
357
354
|
def defaults
|
358
355
|
{
|
359
356
|
background: :default,
|
data/lib/vedeu/cursors/cursor.rb
CHANGED
@@ -229,10 +229,7 @@ module Vedeu
|
|
229
229
|
type: type)
|
230
230
|
end
|
231
231
|
|
232
|
-
#
|
233
|
-
#
|
234
|
-
# @return [Hash<Symbol => Boolean|Fixnum|String|
|
235
|
-
# Vedeu::Cursors::Repository>]
|
232
|
+
# @macro defaults_method
|
236
233
|
def defaults
|
237
234
|
{
|
238
235
|
name: '',
|
@@ -270,11 +267,11 @@ module Vedeu
|
|
270
267
|
end # Cursors
|
271
268
|
|
272
269
|
# @!method hide_cursor
|
273
|
-
# @see Vedeu::Toggleable::
|
270
|
+
# @see Vedeu::Toggleable::SingletonMethods.hide
|
274
271
|
# @!method show_cursor
|
275
|
-
# @see Vedeu::Toggleable::
|
272
|
+
# @see Vedeu::Toggleable::SingletonMethods#show
|
276
273
|
# @!method toggle_cursor
|
277
|
-
# @see Vedeu::Toggleable::
|
274
|
+
# @see Vedeu::Toggleable::SingletonMethods#toggle
|
278
275
|
def_delegators Vedeu::Cursors::Cursor,
|
279
276
|
:hide_cursor,
|
280
277
|
:show_cursor,
|
@@ -93,9 +93,7 @@ module Vedeu
|
|
93
93
|
File.dirname(__FILE__) + '/templates/default_application.vedeu'
|
94
94
|
end
|
95
95
|
|
96
|
-
# @
|
97
|
-
#
|
98
|
-
# @return [Hash<Symbol => String>]
|
96
|
+
# @macro defaults_method
|
99
97
|
def defaults
|
100
98
|
{
|
101
99
|
borders: read('default_borders.vedeu'),
|
data/lib/vedeu/dsl/border.rb
CHANGED
@@ -10,8 +10,7 @@ module Vedeu
|
|
10
10
|
#
|
11
11
|
module Border
|
12
12
|
|
13
|
-
#
|
14
|
-
#
|
13
|
+
# @macro module_instance_methods
|
15
14
|
module InstanceMethods
|
16
15
|
|
17
16
|
# Specify the border of an interface or view with a simple
|
@@ -36,7 +35,7 @@ module Vedeu
|
|
36
35
|
# @param name [String|Symbol] The name of the interface; this
|
37
36
|
# is already provided when we define the interface or view,
|
38
37
|
# setting it here is just mirroring functionality of
|
39
|
-
# {Vedeu::DSL::Border::
|
38
|
+
# {Vedeu::DSL::Border::SingletonMethods.border}.
|
40
39
|
# @param block [Proc]
|
41
40
|
# @macro raise_requires_block
|
42
41
|
# @macro raise_missing_required
|
@@ -78,7 +77,7 @@ module Vedeu
|
|
78
77
|
|
79
78
|
end # InstanceMethods
|
80
79
|
|
81
|
-
# @macro
|
80
|
+
# @macro module_included
|
82
81
|
def self.included(klass)
|
83
82
|
klass.include(Vedeu::DSL::Border::InstanceMethods)
|
84
83
|
end
|
data/lib/vedeu/dsl/geometry.rb
CHANGED
@@ -10,9 +10,8 @@ module Vedeu
|
|
10
10
|
#
|
11
11
|
module Geometry
|
12
12
|
|
13
|
-
#
|
14
|
-
|
15
|
-
module ClassMethods
|
13
|
+
# @macro module_singleton_methods
|
14
|
+
module SingletonMethods
|
16
15
|
|
17
16
|
# {include:file:docs/dsl/by_method/geometry.md}
|
18
17
|
# @param name [String|Symbol] The name of the interface or
|
@@ -40,7 +39,7 @@ module Vedeu
|
|
40
39
|
Vedeu::Geometries::Geometry.build(name: name, &block).store
|
41
40
|
end
|
42
41
|
|
43
|
-
end #
|
42
|
+
end # SingletonMethods
|
44
43
|
|
45
44
|
# Provide additional behaviour as instance methods.
|
46
45
|
#
|
@@ -50,7 +49,7 @@ module Vedeu
|
|
50
49
|
# @param name [String|Symbol] The name of the interface; this
|
51
50
|
# is already provided when we define the interface or view,
|
52
51
|
# setting it here is just mirroring functionality of
|
53
|
-
# {Vedeu::DSL::Geometry::
|
52
|
+
# {Vedeu::DSL::Geometry::SingletonMethods#geometry}.
|
54
53
|
# @param block [Proc]
|
55
54
|
# @macro raise_requires_block
|
56
55
|
# @macro raise_missing_required
|
@@ -66,9 +65,9 @@ module Vedeu
|
|
66
65
|
|
67
66
|
end # InstanceMethods
|
68
67
|
|
69
|
-
# @macro
|
68
|
+
# @macro module_included
|
70
69
|
def self.included(klass)
|
71
|
-
klass.extend(Vedeu::DSL::Geometry::
|
70
|
+
klass.extend(Vedeu::DSL::Geometry::SingletonMethods)
|
72
71
|
klass.include(Vedeu::DSL::Geometry::InstanceMethods)
|
73
72
|
end
|
74
73
|
|
@@ -113,7 +113,7 @@ module Vedeu
|
|
113
113
|
Vedeu::Colours::Colour.coerce(new_colour_options)
|
114
114
|
end
|
115
115
|
|
116
|
-
# @
|
116
|
+
# @macro defaults_method
|
117
117
|
def defaults
|
118
118
|
{
|
119
119
|
align: :none,
|
@@ -124,7 +124,7 @@ module Vedeu
|
|
124
124
|
style: nil,
|
125
125
|
truncate: false,
|
126
126
|
width: nil,
|
127
|
-
wordwrap:
|
127
|
+
wordwrap: true,
|
128
128
|
}
|
129
129
|
end
|
130
130
|
|
@@ -193,9 +193,7 @@ module Vedeu
|
|
193
193
|
'or there is no geometry registered with that name.'
|
194
194
|
end
|
195
195
|
|
196
|
-
#
|
197
|
-
#
|
198
|
-
# @return [Hash<Symbol => NilClass, String, Symbol>]
|
196
|
+
# @macro defaults_method
|
199
197
|
def defaults
|
200
198
|
{
|
201
199
|
ellipsis: '...',
|
@@ -94,6 +94,13 @@ module Vedeu
|
|
94
94
|
end
|
95
95
|
alias colour= colour
|
96
96
|
|
97
|
+
# Instruct the view to not use wordwrapping. (Default)
|
98
|
+
#
|
99
|
+
# @return [Boolean]
|
100
|
+
def no_wordwrap!
|
101
|
+
wordwrap(false)
|
102
|
+
end
|
103
|
+
|
97
104
|
# Define a style or styles for an interface, line or a stream.
|
98
105
|
#
|
99
106
|
# @param value [Array<Symbol>|Array<String>|Symbol|String]
|
@@ -122,6 +129,17 @@ module Vedeu
|
|
122
129
|
alias styles style
|
123
130
|
alias styles= style
|
124
131
|
|
132
|
+
# Specify whether the view should use wordwrapping (default).
|
133
|
+
#
|
134
|
+
# @param value [Boolean]
|
135
|
+
# @return [Boolean]
|
136
|
+
def wordwrap(value = true)
|
137
|
+
boolean = value ? true : false
|
138
|
+
|
139
|
+
model.wordwrap = boolean
|
140
|
+
end
|
141
|
+
alias wordwrap! wordwrap
|
142
|
+
|
125
143
|
private
|
126
144
|
|
127
145
|
# @return [Hash<Symbol => String>]
|
data/lib/vedeu/editor/cursor.rb
CHANGED
@@ -172,9 +172,7 @@ module Vedeu
|
|
172
172
|
@geometry ||= Vedeu.geometries.by_name(name)
|
173
173
|
end
|
174
174
|
|
175
|
-
#
|
176
|
-
#
|
177
|
-
# @return [Hash<Symbol => Fixnum|NilClass|String|Symbol>]
|
175
|
+
# @macro defaults_method
|
178
176
|
def defaults
|
179
177
|
{
|
180
178
|
name: '',
|
@@ -216,9 +216,7 @@ module Vedeu
|
|
216
216
|
@cursor ||= Vedeu::Editor::Cursor.new(name: name)
|
217
217
|
end
|
218
218
|
|
219
|
-
#
|
220
|
-
#
|
221
|
-
# @return [Hash<Symbol => void|Symbol]
|
219
|
+
# @macro defaults_method
|
222
220
|
def defaults
|
223
221
|
{
|
224
222
|
data: Vedeu::Editor::Lines.new([Vedeu::Editor::Line.new]),
|
data/lib/vedeu/editor/line.rb
CHANGED
@@ -20,18 +20,10 @@ module Vedeu
|
|
20
20
|
|
21
21
|
class << self
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
# @param collection [String|Vedeu::Editor::Line]
|
28
|
-
# @return (see #initialize)
|
29
|
-
def coerce(collection)
|
30
|
-
return collection if collection.is_a?(self)
|
31
|
-
return new(collection) if string?(collection)
|
32
|
-
|
33
|
-
new
|
34
|
-
end
|
23
|
+
extend Forwardable
|
24
|
+
|
25
|
+
def_delegators Vedeu::Coercers::EditorLine,
|
26
|
+
:coerce
|
35
27
|
|
36
28
|
end # Eigenclass
|
37
29
|
|