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/editor/lines.rb
CHANGED
@@ -20,36 +20,10 @@ module Vedeu
|
|
20
20
|
|
21
21
|
class << self
|
22
22
|
|
23
|
-
|
23
|
+
extend Forwardable
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
#
|
28
|
-
# @param document [Array<String>|Vedeu::Editor::Lines]
|
29
|
-
# @return (see #initialize)
|
30
|
-
def coerce(document)
|
31
|
-
if document.is_a?(self)
|
32
|
-
new(document.lines)
|
33
|
-
|
34
|
-
elsif document.is_a?(Array)
|
35
|
-
collection = document.map do |line|
|
36
|
-
Vedeu::Editor::Line.coerce(line)
|
37
|
-
end
|
38
|
-
|
39
|
-
new(collection)
|
40
|
-
|
41
|
-
elsif string?(document)
|
42
|
-
collection = document.lines.map(&:chomp).map do |line|
|
43
|
-
Vedeu::Editor::Line.coerce(line)
|
44
|
-
end
|
45
|
-
|
46
|
-
new(collection)
|
47
|
-
|
48
|
-
else
|
49
|
-
new
|
50
|
-
|
51
|
-
end
|
52
|
-
end
|
25
|
+
def_delegators Vedeu::Coercers::EditorLines,
|
26
|
+
:coerce
|
53
27
|
|
54
28
|
end # Eigenclass
|
55
29
|
|
data/lib/vedeu/events/event.rb
CHANGED
@@ -196,10 +196,7 @@ module Vedeu
|
|
196
196
|
}
|
197
197
|
end
|
198
198
|
|
199
|
-
#
|
200
|
-
#
|
201
|
-
# @return [Hash<Symbol => Boolean|Fixnum|NilClass|String|Symbol|
|
202
|
-
# Vedeu::Geometries::Repository]
|
199
|
+
# @macro defaults_method
|
203
200
|
def defaults
|
204
201
|
{
|
205
202
|
client: nil,
|
data/lib/vedeu/groups/group.rb
CHANGED
@@ -158,10 +158,7 @@ module Vedeu
|
|
158
158
|
|
159
159
|
private
|
160
160
|
|
161
|
-
#
|
162
|
-
#
|
163
|
-
# @return [Hash<Symbol => Boolean|Set|String|
|
164
|
-
# Vedeu::Groups::Repository]
|
161
|
+
# @macro defaults_method
|
165
162
|
def defaults
|
166
163
|
{
|
167
164
|
members: Set.new,
|
@@ -183,11 +180,11 @@ module Vedeu
|
|
183
180
|
end # Groups
|
184
181
|
|
185
182
|
# @!method hide_group
|
186
|
-
# @see Vedeu::Toggleable::
|
183
|
+
# @see Vedeu::Toggleable::SingletonMethods#hide
|
187
184
|
# @!method show_group
|
188
|
-
# @see Vedeu::Toggleable::
|
185
|
+
# @see Vedeu::Toggleable::SingletonMethods#show
|
189
186
|
# @!method toggle_group
|
190
|
-
# @see Vedeu::Toggleable::
|
187
|
+
# @see Vedeu::Toggleable::SingletonMethods#toggle
|
191
188
|
def_delegators Vedeu::Groups::Group,
|
192
189
|
:hide_group,
|
193
190
|
:show_group,
|
data/lib/vedeu/input/keymap.rb
CHANGED
data/lib/vedeu/input/keys.rb
CHANGED
data/lib/vedeu/input/mapper.rb
CHANGED
data/lib/vedeu/input/mouse.rb
CHANGED
data/lib/vedeu/input/read.rb
CHANGED
@@ -48,12 +48,6 @@ module Vedeu
|
|
48
48
|
input
|
49
49
|
end
|
50
50
|
|
51
|
-
protected
|
52
|
-
|
53
|
-
# @!attribute [r] input
|
54
|
-
# @return [NilClass|String]
|
55
|
-
attr_reader :input
|
56
|
-
|
57
51
|
private
|
58
52
|
|
59
53
|
# @return [IO]
|
@@ -66,7 +60,7 @@ module Vedeu
|
|
66
60
|
mode == :cooked
|
67
61
|
end
|
68
62
|
|
69
|
-
# @
|
63
|
+
# @macro defaults_method
|
70
64
|
def defaults
|
71
65
|
{
|
72
66
|
mode: :cooked,
|
@@ -43,6 +43,10 @@ module Vedeu
|
|
43
43
|
# @return [Vedeu::Views::Composition]
|
44
44
|
attr_accessor :parent
|
45
45
|
|
46
|
+
# @!attribute [rw] wordwrap
|
47
|
+
# @return [Boolean]
|
48
|
+
attr_accessor :wordwrap
|
49
|
+
|
46
50
|
# @!attribute [rw] zindex
|
47
51
|
# @return [Fixnum]
|
48
52
|
attr_accessor :zindex
|
@@ -60,6 +64,7 @@ module Vedeu
|
|
60
64
|
# @option attributes repository [Vedeu::Interfaces::Repository]
|
61
65
|
# @option attributes style [Vedeu::Presentation::Style]
|
62
66
|
# @option attributes visible [Boolean]
|
67
|
+
# @option attributes wordwrap [Boolean]
|
63
68
|
# @option attributes zindex [Fixnum]
|
64
69
|
# @return [Vedeu::Interfaces::Interface]
|
65
70
|
def initialize(attributes = {})
|
@@ -82,6 +87,7 @@ module Vedeu
|
|
82
87
|
repository: repository,
|
83
88
|
style: style,
|
84
89
|
visible: visible,
|
90
|
+
wordwrap: wordwrap,
|
85
91
|
zindex: zindex,
|
86
92
|
}
|
87
93
|
end
|
@@ -140,9 +146,7 @@ module Vedeu
|
|
140
146
|
|
141
147
|
private
|
142
148
|
|
143
|
-
#
|
144
|
-
#
|
145
|
-
# @return [Hash<Symbol => void>]
|
149
|
+
# @macro defaults_method
|
146
150
|
def defaults
|
147
151
|
{
|
148
152
|
client: nil,
|
@@ -156,6 +160,7 @@ module Vedeu
|
|
156
160
|
repository: Vedeu.interfaces,
|
157
161
|
style: :normal,
|
158
162
|
visible: true,
|
163
|
+
wordwrap: true,
|
159
164
|
zindex: 0,
|
160
165
|
}
|
161
166
|
end
|
@@ -165,11 +170,11 @@ module Vedeu
|
|
165
170
|
end # Interfaces
|
166
171
|
|
167
172
|
# @!method hide_interface
|
168
|
-
# @see Vedeu::Toggleable::
|
173
|
+
# @see Vedeu::Toggleable::SingletonMethods#hide
|
169
174
|
# @!method show_interface
|
170
|
-
# @see Vedeu::Toggleable::
|
175
|
+
# @see Vedeu::Toggleable::SingletonMethods#show
|
171
176
|
# @!method toggle_interface
|
172
|
-
# @see Vedeu::Toggleable::
|
177
|
+
# @see Vedeu::Toggleable::SingletonMethods#toggle
|
173
178
|
def_delegators Vedeu::Interfaces::Interface,
|
174
179
|
:hide_interface,
|
175
180
|
:show_interface,
|
@@ -16,10 +16,10 @@ module Vedeu
|
|
16
16
|
# @param log [void]
|
17
17
|
# @return [Vedeu::Logging::LocklessLogDevice]
|
18
18
|
def initialize(log = nil)
|
19
|
-
@dev = nil
|
20
19
|
@filename = nil
|
20
|
+
@log = log
|
21
21
|
|
22
|
-
if
|
22
|
+
if writable? && closeable?
|
23
23
|
@dev = log
|
24
24
|
|
25
25
|
else
|
@@ -46,8 +46,19 @@ module Vedeu
|
|
46
46
|
nil
|
47
47
|
end
|
48
48
|
|
49
|
+
protected
|
50
|
+
|
51
|
+
# @!attribute [r] log
|
52
|
+
# @return [String]
|
53
|
+
attr_reader :log
|
54
|
+
|
49
55
|
private
|
50
56
|
|
57
|
+
# @return [Boolean]
|
58
|
+
def closable?
|
59
|
+
log.respond_to?(:close)
|
60
|
+
end
|
61
|
+
|
51
62
|
# @param log [String]
|
52
63
|
# @return [void]
|
53
64
|
def open_logfile(log)
|
@@ -62,6 +73,11 @@ module Vedeu
|
|
62
73
|
end
|
63
74
|
end
|
64
75
|
|
76
|
+
# @return [Boolean]
|
77
|
+
def writable?
|
78
|
+
log.respond_to?(:write)
|
79
|
+
end
|
80
|
+
|
65
81
|
end # LocklessLogDevice
|
66
82
|
|
67
83
|
end # Logging
|
data/lib/vedeu/logging/timer.rb
CHANGED
@@ -33,24 +33,30 @@ module Vedeu
|
|
33
33
|
end
|
34
34
|
|
35
35
|
# Write an entry to the log file stating how long a section of
|
36
|
-
# code took in milliseconds
|
36
|
+
# code took in milliseconds when debugging is enabled and a
|
37
|
+
# block was Useful for debugging performance.
|
37
38
|
#
|
38
39
|
# @param block [Proc]
|
39
40
|
# @macro raise_requires_block
|
40
|
-
# @return [void] The return value of the executed
|
41
|
+
# @return [void|NilClass] The return value of the executed
|
42
|
+
# block if given, or nil if debugging is disabled.
|
41
43
|
def measure(&block)
|
42
|
-
|
44
|
+
if block_given?
|
45
|
+
if Vedeu.config.debug?
|
46
|
+
work = yield
|
43
47
|
|
44
|
-
|
45
|
-
|
48
|
+
Vedeu.log(type: :timer,
|
49
|
+
message: "#{message} took #{elapsed}ms.")
|
46
50
|
|
47
|
-
|
48
|
-
message: "#{message} took #{elapsed}ms.")
|
51
|
+
work
|
49
52
|
|
50
|
-
|
53
|
+
else
|
54
|
+
yield
|
55
|
+
|
56
|
+
end
|
51
57
|
|
52
58
|
else
|
53
|
-
|
59
|
+
fail Vedeu::Error::RequiresBlock if Vedeu.config.debug?
|
54
60
|
|
55
61
|
end
|
56
62
|
end
|
@@ -65,6 +71,8 @@ module Vedeu
|
|
65
71
|
# @return [String]
|
66
72
|
attr_reader :message
|
67
73
|
|
74
|
+
private
|
75
|
+
|
68
76
|
# Returns the elapsed time in milliseconds with 3 decimal
|
69
77
|
# places.
|
70
78
|
#
|
data/lib/vedeu/menus/menu.rb
CHANGED
@@ -43,9 +43,8 @@ module Vedeu
|
|
43
43
|
show
|
44
44
|
end
|
45
45
|
|
46
|
-
#
|
47
|
-
|
48
|
-
module ClassMethods
|
46
|
+
# @macro module_singleton_methods
|
47
|
+
module SingletonMethods
|
49
48
|
|
50
49
|
# Hides the named model, or without a name, the model with same
|
51
50
|
# name as the currently focussed interface.
|
@@ -143,11 +142,11 @@ module Vedeu
|
|
143
142
|
Vedeu.buffers.by_name(name)
|
144
143
|
end
|
145
144
|
|
146
|
-
end #
|
145
|
+
end # SingletonMethods
|
147
146
|
|
148
|
-
# @macro
|
147
|
+
# @macro module_included
|
149
148
|
def self.included(klass)
|
150
|
-
klass.extend(Vedeu::Toggleable::
|
149
|
+
klass.extend(Vedeu::Toggleable::SingletonMethods)
|
151
150
|
end
|
152
151
|
|
153
152
|
end # Toggleable
|
data/lib/vedeu/output/all.rb
CHANGED
data/lib/vedeu/output/output.rb
CHANGED
data/lib/vedeu/output/refresh.rb
CHANGED
data/lib/vedeu/output/write.rb
CHANGED
@@ -16,7 +16,8 @@ module Vedeu
|
|
16
16
|
include Vedeu::Presentation
|
17
17
|
|
18
18
|
# @api public
|
19
|
-
# @see
|
19
|
+
# @param (see #initialize)
|
20
|
+
# @return (see #write)
|
20
21
|
def self.write(output = nil, options = {})
|
21
22
|
new(output, options).write
|
22
23
|
end
|
@@ -63,7 +64,7 @@ module Vedeu
|
|
63
64
|
|
64
65
|
private
|
65
66
|
|
66
|
-
# @
|
67
|
+
# @macro defaults_method
|
67
68
|
def defaults
|
68
69
|
{
|
69
70
|
x: 1,
|