vedeu 0.6.8 → 0.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +9 -0
- data/README.md +1 -1
- data/docs/api.md +60 -67
- data/docs/configuration.md +8 -5
- data/docs/events.md +31 -15
- data/docs/events/application.md +12 -0
- data/docs/events/document.md +57 -0
- data/docs/events/drb.md +43 -0
- data/docs/events/focus.md +24 -0
- data/docs/events/menu.md +57 -0
- data/docs/events/movement.md +57 -0
- data/docs/events/refresh.md +25 -0
- data/docs/events/system.md +90 -0
- data/docs/events/visibility.md +68 -0
- data/lib/vedeu.rb +2 -2
- data/lib/vedeu/all.rb +3 -2
- data/lib/vedeu/api.rb +18 -18
- data/lib/vedeu/application/controller.rb +1 -1
- data/lib/vedeu/application/helper.rb +1 -1
- data/lib/vedeu/application/view.rb +1 -1
- data/lib/vedeu/bindings/application.rb +1 -12
- data/lib/vedeu/bindings/bindings.rb +3 -1
- data/lib/vedeu/bindings/document.rb +9 -62
- data/lib/vedeu/bindings/drb.rb +12 -56
- data/lib/vedeu/bindings/focus.rb +3 -28
- data/lib/vedeu/bindings/menus.rb +10 -66
- data/lib/vedeu/bindings/movement.rb +4 -69
- data/lib/vedeu/bindings/refresh.rb +3 -33
- data/lib/vedeu/bindings/system.rb +14 -100
- data/lib/vedeu/bindings/visibility.rb +20 -71
- data/lib/vedeu/borders/all.rb +4 -3
- data/lib/vedeu/borders/border.rb +39 -33
- data/lib/vedeu/borders/dsl.rb +40 -33
- data/lib/vedeu/borders/null.rb +2 -2
- data/lib/vedeu/borders/render.rb +29 -24
- data/lib/vedeu/borders/repository.rb +2 -2
- data/lib/vedeu/buffers/all.rb +8 -7
- data/lib/vedeu/buffers/buffer.rb +47 -39
- data/lib/vedeu/buffers/null.rb +2 -2
- data/lib/vedeu/buffers/refresh.rb +4 -3
- data/lib/vedeu/buffers/virtual_buffer.rb +122 -118
- data/lib/vedeu/buffers/virtual_buffers.rb +62 -56
- data/lib/vedeu/colours/background.rb +2 -1
- data/lib/vedeu/colours/colour.rb +21 -19
- data/lib/vedeu/colours/foreground.rb +2 -1
- data/lib/vedeu/colours/repository.rb +6 -5
- data/lib/vedeu/colours/translator.rb +39 -35
- data/lib/vedeu/configuration/api.rb +59 -51
- data/lib/vedeu/configuration/cli.rb +9 -7
- data/lib/vedeu/configuration/configuration.rb +41 -32
- data/lib/vedeu/cursors/cursor.rb +1 -1
- data/lib/vedeu/cursors/refresh.rb +20 -16
- data/lib/vedeu/distributed/server.rb +8 -6
- data/lib/vedeu/distributed/subprocess.rb +90 -86
- data/lib/vedeu/distributed/uri.rb +4 -3
- data/lib/vedeu/dsl/composition.rb +2 -2
- data/lib/vedeu/dsl/group.rb +4 -4
- data/lib/vedeu/dsl/interface.rb +5 -5
- data/lib/vedeu/dsl/presentation.rb +2 -2
- data/lib/vedeu/dsl/text.rb +1 -1
- data/lib/vedeu/editor/cropper.rb +4 -4
- data/lib/vedeu/editor/cursor.rb +6 -4
- data/lib/vedeu/editor/document.rb +20 -18
- data/lib/vedeu/editor/editor.rb +2 -2
- data/lib/vedeu/editor/line.rb +10 -5
- data/lib/vedeu/editor/lines.rb +2 -2
- data/lib/vedeu/internal_api.rb +4 -4
- data/lib/vedeu/models/focus.rb +197 -191
- data/lib/vedeu/models/group.rb +171 -159
- data/lib/vedeu/models/groups.rb +14 -10
- data/lib/vedeu/models/interface.rb +116 -110
- data/lib/vedeu/models/interfaces.rb +24 -20
- data/lib/vedeu/models/toggleable.rb +4 -4
- data/lib/vedeu/models/views/char.rb +1 -1
- data/lib/vedeu/models/views/composition.rb +1 -1
- data/lib/vedeu/models/views/line.rb +1 -1
- data/lib/vedeu/models/views/stream.rb +1 -1
- data/lib/vedeu/models/views/view.rb +1 -1
- data/lib/vedeu/null/interface.rb +1 -1
- data/lib/vedeu/null/view.rb +1 -1
- data/lib/vedeu/output/clear/named_interface.rb +1 -1
- data/lib/vedeu/output/compressor.rb +78 -73
- data/lib/vedeu/output/direct.rb +61 -57
- data/lib/vedeu/output/output.rb +34 -29
- data/lib/vedeu/output/{presentation.rb → presentation/presentation.rb} +2 -1
- data/lib/vedeu/output/presentation/style.rb +64 -18
- data/lib/vedeu/output/presentation/styles.rb +39 -0
- data/lib/vedeu/output/renderers/html.rb +2 -2
- data/lib/vedeu/output/renderers/json.rb +2 -1
- data/lib/vedeu/output/renderers/terminal.rb +3 -3
- data/lib/vedeu/output/renderers/text.rb +3 -3
- data/lib/vedeu/output/text.rb +186 -180
- data/lib/vedeu/output/wordwrap.rb +142 -138
- data/lib/vedeu/refresh/refresh.rb +2 -2
- data/lib/vedeu/templating/helpers.rb +11 -6
- data/lib/vedeu/templating/view_template.rb +1 -1
- data/lib/vedeu/terminal/terminal.rb +2 -2
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/borders/render_test.rb +1 -1
- data/test/lib/vedeu/buffers/buffer_test.rb +16 -14
- data/test/lib/vedeu/buffers/virtual_buffer_test.rb +105 -101
- data/test/lib/vedeu/buffers/virtual_buffers_test.rb +43 -39
- data/test/lib/vedeu/colours/colour_test.rb +4 -4
- data/test/lib/vedeu/cursors/cursor_test.rb +2 -2
- data/test/lib/vedeu/cursors/repository_test.rb +3 -3
- data/test/lib/vedeu/distributed/subprocess_test.rb +33 -29
- data/test/lib/vedeu/dsl/group_test.rb +3 -3
- data/test/lib/vedeu/dsl/interface_test.rb +6 -5
- data/test/lib/vedeu/dsl/line_test.rb +4 -2
- data/test/lib/vedeu/dsl/presentation_test.rb +2 -2
- data/test/lib/vedeu/dsl/text_test.rb +8 -8
- data/test/lib/vedeu/editor/document_test.rb +10 -6
- data/test/lib/vedeu/input/keymap_test.rb +1 -10
- data/test/lib/vedeu/models/focus_test.rb +177 -170
- data/test/lib/vedeu/models/group_test.rb +99 -95
- data/test/lib/vedeu/models/groups_test.rb +13 -9
- data/test/lib/vedeu/models/interface_test.rb +93 -87
- data/test/lib/vedeu/models/interfaces_test.rb +24 -20
- data/test/lib/vedeu/models/views/char_test.rb +2 -2
- data/test/lib/vedeu/models/views/line_test.rb +11 -7
- data/test/lib/vedeu/models/views/stream_test.rb +1 -1
- data/test/lib/vedeu/models/views/view_test.rb +1 -1
- data/test/lib/vedeu/output/clear/named_group_test.rb +1 -1
- data/test/lib/vedeu/output/clear/named_interface_test.rb +3 -1
- data/test/lib/vedeu/output/compressor_test.rb +126 -122
- data/test/lib/vedeu/output/direct_test.rb +49 -43
- data/test/lib/vedeu/output/output_test.rb +35 -31
- data/test/lib/vedeu/output/{presentation_test.rb → presentation/presentation_test.rb} +11 -7
- data/test/lib/vedeu/output/presentation/style_test.rb +88 -48
- data/test/lib/vedeu/output/presentation/styles_test.rb +84 -0
- data/test/lib/vedeu/output/text_test.rb +109 -105
- data/test/lib/vedeu/output/viewport_test.rb +3 -1
- data/test/lib/vedeu/output/wordwrap_test.rb +209 -205
- data/test/lib/vedeu/refresh/refresh_test.rb +3 -1
- data/test/lib/vedeu/templating/helpers_test.rb +6 -6
- data/test/lib/vedeu/templating/view_template_test.rb +1 -1
- metadata +17 -8
- data/lib/vedeu/output/style.rb +0 -76
- data/test/lib/vedeu/output/style_test.rb +0 -120
@@ -3,7 +3,8 @@ module Vedeu
|
|
3
3
|
module Colours
|
4
4
|
|
5
5
|
# The class represents one half (the other, can be found at
|
6
|
-
# {Vedeu::Colours::Background}) of a terminal colour escape
|
6
|
+
# {Vedeu::Colours::Background}) of a terminal colour escape
|
7
|
+
# sequence.
|
7
8
|
#
|
8
9
|
class Foreground < Vedeu::Colours::Translator
|
9
10
|
|
@@ -2,8 +2,8 @@ module Vedeu
|
|
2
2
|
|
3
3
|
module Colours
|
4
4
|
|
5
|
-
# Allows the storing of HTML/CSS colours and their respective
|
6
|
-
# sequences.
|
5
|
+
# Allows the storing of HTML/CSS colours and their respective
|
6
|
+
# escape sequences.
|
7
7
|
#
|
8
8
|
class Repository
|
9
9
|
|
@@ -25,7 +25,8 @@ module Vedeu
|
|
25
25
|
storage.store(colour, escape_sequence)
|
26
26
|
end
|
27
27
|
|
28
|
-
# Returns a boolean indicating whether the colour has been
|
28
|
+
# Returns a boolean indicating whether the colour has been
|
29
|
+
# sregistered.
|
29
30
|
#
|
30
31
|
# @param colour [String]
|
31
32
|
# @return [Boolean]
|
@@ -49,8 +50,8 @@ module Vedeu
|
|
49
50
|
storage.fetch(colour, '')
|
50
51
|
end
|
51
52
|
|
52
|
-
# Retrieves the escape sequence of a registered colour, or
|
53
|
-
# colour with its respective escape sequence.
|
53
|
+
# Retrieves the escape sequence of a registered colour, or
|
54
|
+
# registers the colour with its respective escape sequence.
|
54
55
|
#
|
55
56
|
# @return [String]
|
56
57
|
def retrieve_or_register(colour, escape_sequence)
|
@@ -2,23 +2,27 @@ module Vedeu
|
|
2
2
|
|
3
3
|
module Colours
|
4
4
|
|
5
|
-
# Convert a CSS/HTML colour string into a terminal escape
|
5
|
+
# Convert a CSS/HTML colour string into a terminal escape
|
6
|
+
# sequence.
|
6
7
|
#
|
7
|
-
# If provided with an empty value or a string it cannot convert,
|
8
|
-
# return an empty string.
|
8
|
+
# If provided with an empty value or a string it cannot convert,
|
9
|
+
# it will return an empty string.
|
9
10
|
#
|
10
|
-
# When provided with a named colour, uses the terminal's value for
|
11
|
-
# colour. If a theme is being used with the terminal, which
|
12
|
-
# defaults, then the theme's colour will be used.
|
13
|
-
#
|
11
|
+
# When provided with a named colour, uses the terminal's value for
|
12
|
+
# that colour. If a theme is being used with the terminal, which
|
13
|
+
# overrides the defaults, then the theme's colour will be used.
|
14
|
+
# The recognised names are:
|
14
15
|
#
|
15
|
-
#
|
16
|
-
#
|
16
|
+
# :black, :red, :green, :yellow, :blue, :magenta, :cyan, :white,
|
17
|
+
# :default.
|
17
18
|
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
# a
|
19
|
+
# When a number between 0 and 255 is provided, Vedeu will use the
|
20
|
+
# terminal colour corresponding with that colour.
|
21
|
+
#
|
22
|
+
# Finally, when provided a CSS/HTML colour string e.g. '#ff0000',
|
23
|
+
# Vedeu will translate that to the 8-bit escape sequence or when
|
24
|
+
# you have a capable terminal and the `TERM=xterm-truecolor`
|
25
|
+
# environment variable set, a 24-bit representation.
|
22
26
|
#
|
23
27
|
# @todo More documentation required (create a fancy chart!)
|
24
28
|
#
|
@@ -29,8 +33,8 @@ module Vedeu
|
|
29
33
|
attr_reader :colour
|
30
34
|
alias_method :value, :colour
|
31
35
|
|
32
|
-
# Produces new objects of the correct class from the value,
|
33
|
-
# objects Colours::that have already been coerced.
|
36
|
+
# Produces new objects of the correct class from the value,
|
37
|
+
# ignores objects Colours::that have already been coerced.
|
34
38
|
#
|
35
39
|
# @param value [Object|NilClass]
|
36
40
|
# @return [Object]
|
@@ -113,8 +117,8 @@ module Vedeu
|
|
113
117
|
# processing.
|
114
118
|
#
|
115
119
|
# @param colour [String] A HTML/CSS colour code.
|
116
|
-
# @param escape_sequence [String] The HTML/CSS colour code as an
|
117
|
-
# sequence.
|
120
|
+
# @param escape_sequence [String] The HTML/CSS colour code as an
|
121
|
+
# escape sequence.
|
118
122
|
# @return [String]
|
119
123
|
def register(colour, escape_sequence)
|
120
124
|
repository.register(colour, escape_sequence)
|
@@ -144,16 +148,16 @@ module Vedeu
|
|
144
148
|
"\e[#{named_codes}m"
|
145
149
|
end
|
146
150
|
|
147
|
-
# Returns a boolean indicating whether the colour provided is a
|
148
|
-
# named colour.
|
151
|
+
# Returns a boolean indicating whether the colour provided is a
|
152
|
+
# valid named colour.
|
149
153
|
#
|
150
154
|
# @return [Boolean]
|
151
155
|
def valid_name?
|
152
156
|
Vedeu::Esc.codes.keys.include?(colour)
|
153
157
|
end
|
154
158
|
|
155
|
-
# Returns a boolean indicating whether the colour provided is a
|
156
|
-
# numbered colour.
|
159
|
+
# Returns a boolean indicating whether the colour provided is a
|
160
|
+
# terminal numbered colour.
|
157
161
|
#
|
158
162
|
# @return [Boolean]
|
159
163
|
def numbered?
|
@@ -167,8 +171,8 @@ module Vedeu
|
|
167
171
|
"#{numbered_prefix}#{css_to_numbered}m"
|
168
172
|
end
|
169
173
|
|
170
|
-
# Returns a boolean indicated whether the colour is a valid
|
171
|
-
# colour.
|
174
|
+
# Returns a boolean indicated whether the colour is a valid
|
175
|
+
# HTML/CSS colour.
|
172
176
|
#
|
173
177
|
# @return [Boolean]
|
174
178
|
def rgb?
|
@@ -190,16 +194,16 @@ module Vedeu
|
|
190
194
|
end
|
191
195
|
end
|
192
196
|
|
193
|
-
# Returns a boolean indicating whether the numbered colour is
|
194
|
-
# range of valid terminal numbered colours.
|
197
|
+
# Returns a boolean indicating whether the numbered colour is
|
198
|
+
# within the range of valid terminal numbered colours.
|
195
199
|
#
|
196
200
|
# @return [Boolean]
|
197
201
|
def valid_range?
|
198
202
|
colour >= 0 && colour <= 255
|
199
203
|
end
|
200
204
|
|
201
|
-
# Returns a collection of converted HTML/CSS octets as their
|
202
|
-
# equivalents.
|
205
|
+
# Returns a collection of converted HTML/CSS octets as their
|
206
|
+
# decimal equivalents.
|
203
207
|
#
|
204
208
|
# @example
|
205
209
|
# colour = '#aadd55'
|
@@ -225,32 +229,32 @@ module Vedeu
|
|
225
229
|
end
|
226
230
|
end
|
227
231
|
|
228
|
-
# Takes the red component of {#css_to_rgb} and converts to the
|
229
|
-
# value for setting the terminal red value.
|
232
|
+
# Takes the red component of {#css_to_rgb} and converts to the
|
233
|
+
# correct value for setting the terminal red value.
|
230
234
|
#
|
231
235
|
# @return [Fixnum]
|
232
236
|
def red
|
233
237
|
(css_to_rgb[0] / 51) * 36
|
234
238
|
end
|
235
239
|
|
236
|
-
# Takes the green component of {#css_to_rgb} and converts to the
|
237
|
-
# value for setting the terminal green value.
|
240
|
+
# Takes the green component of {#css_to_rgb} and converts to the
|
241
|
+
# correct value for setting the terminal green value.
|
238
242
|
#
|
239
243
|
# @return [Fixnum]
|
240
244
|
def green
|
241
245
|
(css_to_rgb[1] / 51) * 6
|
242
246
|
end
|
243
247
|
|
244
|
-
# Takes the blue component of {#css_to_rgb} and converts to the
|
245
|
-
# value for setting the terminal blue value.
|
248
|
+
# Takes the blue component of {#css_to_rgb} and converts to the
|
249
|
+
# correct value for setting the terminal blue value.
|
246
250
|
#
|
247
251
|
# @return [Fixnum]
|
248
252
|
def blue
|
249
253
|
(css_to_rgb[2] / 51) * 1
|
250
254
|
end
|
251
255
|
|
252
|
-
# @raise [Vedeu::Error::NotImplemented] Subclasses of this class
|
253
|
-
# implement this method.
|
256
|
+
# @raise [Vedeu::Error::NotImplemented] Subclasses of this class
|
257
|
+
# must implement this method.
|
254
258
|
# @return [Vedeu::Error::NotImplemented]
|
255
259
|
def not_implemented
|
256
260
|
fail Vedeu::Error::NotImplemented, 'Subclasses implement this.'
|
@@ -2,8 +2,9 @@ module Vedeu
|
|
2
2
|
|
3
3
|
module Config
|
4
4
|
|
5
|
-
# The Configuration::API class parses client application
|
6
|
-
# options used by Vedeu to affect certain
|
5
|
+
# The Configuration::API class parses client application
|
6
|
+
# configuration into options used by Vedeu to affect certain
|
7
|
+
# behaviours.
|
7
8
|
#
|
8
9
|
class API
|
9
10
|
|
@@ -16,8 +17,8 @@ module Vedeu
|
|
16
17
|
|
17
18
|
# Returns a new instance of Vedeu::Config::API.
|
18
19
|
#
|
19
|
-
# Configure Vedeu via a simple configuration API DSL. Options
|
20
|
-
# override the default Vedeu configuration set in
|
20
|
+
# Configure Vedeu via a simple configuration API DSL. Options
|
21
|
+
# set here override the default Vedeu configuration set in
|
21
22
|
# {Vedeu::Configuration#defaults}.
|
22
23
|
#
|
23
24
|
# Vedeu.configure do
|
@@ -37,11 +38,12 @@ module Vedeu
|
|
37
38
|
Vedeu::Config.log(Esc.green { '[api]' }, options)
|
38
39
|
end
|
39
40
|
|
40
|
-
# Sets boolean to allow user input. The default behaviour of
|
41
|
-
# be interactive.
|
41
|
+
# Sets boolean to allow user input. The default behaviour of
|
42
|
+
# Vedeu is to be interactive.
|
42
43
|
#
|
43
44
|
# Vedeu.configure do
|
44
|
-
# interactive! # => same as `interactive true` or
|
45
|
+
# interactive! # => same as `interactive true` or
|
46
|
+
# # `standalone false`
|
45
47
|
# # ...
|
46
48
|
# end
|
47
49
|
#
|
@@ -62,11 +64,12 @@ module Vedeu
|
|
62
64
|
end
|
63
65
|
alias_method :interactive, :interactive!
|
64
66
|
|
65
|
-
# Sets boolean to prevent user intervention. This is the same as
|
66
|
-
# {include:Vedeu::Config::API#interactive!} to false.
|
67
|
+
# Sets boolean to prevent user intervention. This is the same as
|
68
|
+
# setting {include:Vedeu::Config::API#interactive!} to false.
|
67
69
|
#
|
68
70
|
# Vedeu.configure do
|
69
|
-
# standalone! # => same as `standalone true` or
|
71
|
+
# standalone! # => same as `standalone true` or
|
72
|
+
# # `interactive false`
|
70
73
|
# # ...
|
71
74
|
# end
|
72
75
|
#
|
@@ -87,9 +90,10 @@ module Vedeu
|
|
87
90
|
end
|
88
91
|
alias_method :standalone, :standalone!
|
89
92
|
|
90
|
-
# Sets boolean to run the Vedeu main application loop once. In
|
91
|
-
# using `run_once!` or setting `run_once` to true will
|
92
|
-
# initialize, run any client application code,
|
93
|
+
# Sets boolean to run the Vedeu main application loop once. In
|
94
|
+
# effect, using `run_once!` or setting `run_once` to true will
|
95
|
+
# allow Vedeu to initialize, run any client application code,
|
96
|
+
# cleanup, then terminate.
|
93
97
|
#
|
94
98
|
# Vedeu.configure do
|
95
99
|
# run_once!
|
@@ -169,8 +173,8 @@ module Vedeu
|
|
169
173
|
options[:drb_width] = width
|
170
174
|
end
|
171
175
|
|
172
|
-
# Sets the terminal mode to `cooked`. Default terminal mode is
|
173
|
-
# Also, see {Vedeu::Config::API#raw!}
|
176
|
+
# Sets the terminal mode to `cooked`. Default terminal mode is
|
177
|
+
# `raw`. Also, see {Vedeu::Config::API#raw!}
|
174
178
|
#
|
175
179
|
# Vedeu.configure do
|
176
180
|
# cooked!
|
@@ -183,7 +187,8 @@ module Vedeu
|
|
183
187
|
end
|
184
188
|
alias_method :cooked, :cooked!
|
185
189
|
|
186
|
-
# Sets the terminal mode to `fake`. Default terminal mode is
|
190
|
+
# Sets the terminal mode to `fake`. Default terminal mode is
|
191
|
+
# `raw`.
|
187
192
|
#
|
188
193
|
# @example
|
189
194
|
# Vedeu.configure do
|
@@ -197,8 +202,8 @@ module Vedeu
|
|
197
202
|
end
|
198
203
|
alias_method :fake, :fake!
|
199
204
|
|
200
|
-
# Sets the terminal mode to `raw`. Default terminal mode is
|
201
|
-
# Also, see {Vedeu::Config::API#cooked!}
|
205
|
+
# Sets the terminal mode to `raw`. Default terminal mode is
|
206
|
+
# `raw`. Also, see {Vedeu::Config::API#cooked!}
|
202
207
|
#
|
203
208
|
# Vedeu.configure do
|
204
209
|
# raw!
|
@@ -211,13 +216,13 @@ module Vedeu
|
|
211
216
|
end
|
212
217
|
alias_method :raw, :raw!
|
213
218
|
|
214
|
-
# Sets boolean to enable/disable debugging. Vedeu's default
|
215
|
-
# for debugging to be disabled. Using `debug!` or
|
216
|
-
# will enable debugging.
|
219
|
+
# Sets boolean to enable/disable debugging. Vedeu's default
|
220
|
+
# setting is for debugging to be disabled. Using `debug!` or
|
221
|
+
# setting `debug` to true will enable debugging.
|
217
222
|
#
|
218
223
|
# @note
|
219
|
-
# Be aware that running an application with debugging enabled
|
220
|
-
# affect performance.
|
224
|
+
# Be aware that running an application with debugging enabled
|
225
|
+
# will affect performance.
|
221
226
|
#
|
222
227
|
# Vedeu.configure do
|
223
228
|
# debug!
|
@@ -244,14 +249,15 @@ module Vedeu
|
|
244
249
|
# end
|
245
250
|
#
|
246
251
|
# @note
|
247
|
-
# iTerm 2 on Mac OSX will handle the true colour setting
|
248
|
-
# whereas Terminator on Linux will not display
|
249
|
-
# compatibility across platforms, it is
|
250
|
-
# the colour mode at all and
|
252
|
+
# iTerm 2 on Mac OSX will handle the true colour setting
|
253
|
+
# (16777216), whereas Terminator on Linux will not display
|
254
|
+
# colours correctly. For compatibility across platforms, it is
|
255
|
+
# recommended to either not set the colour mode at all and
|
256
|
+
# allow it to be detected, or use 256 here.
|
251
257
|
#
|
252
258
|
# @param value [Fixnum]
|
253
|
-
# @raise [Vedeu::Error::InvalidSyntax] When the value parameter
|
254
|
-
# of +8+, +16+, +256+ or +16777216+.
|
259
|
+
# @raise [Vedeu::Error::InvalidSyntax] When the value parameter
|
260
|
+
# is not one of +8+, +16+, +256+ or +16777216+.
|
255
261
|
# @return [Boolean]
|
256
262
|
def colour_mode(value = nil)
|
257
263
|
unless valid_colour_mode?(value)
|
@@ -290,8 +296,9 @@ module Vedeu
|
|
290
296
|
options[:log_only] = types
|
291
297
|
end
|
292
298
|
|
293
|
-
# Sets the renderers for Vedeu. Each renderer added must have
|
294
|
-
# method '.render' defined as this will be called when
|
299
|
+
# Sets the renderers for Vedeu. Each renderer added must have
|
300
|
+
# the class method '.render' defined as this will be called when
|
301
|
+
# rendering content.
|
295
302
|
#
|
296
303
|
# Vedeu.configure do
|
297
304
|
# renderer MyRenderer
|
@@ -310,9 +317,9 @@ module Vedeu
|
|
310
317
|
end
|
311
318
|
alias_method :renderers, :renderer
|
312
319
|
|
313
|
-
# Override the base path for the application (for locating
|
314
|
-
# other resources). By default the base path is
|
315
|
-
# not work for many applications.
|
320
|
+
# Override the base path for the application (for locating
|
321
|
+
# templates and other resources). By default the base path is
|
322
|
+
# just cwd but this will not work for many applications.
|
316
323
|
#
|
317
324
|
# Vedeu.configure do
|
318
325
|
# base_path '/path/to/application'
|
@@ -325,8 +332,8 @@ module Vedeu
|
|
325
332
|
options[:base_path] = path
|
326
333
|
end
|
327
334
|
|
328
|
-
# Sets the root of the client application. Vedeu will execute
|
329
|
-
# controller with action and optional arguments first.
|
335
|
+
# Sets the root of the client application. Vedeu will execute
|
336
|
+
# this controller with action and optional arguments first.
|
330
337
|
#
|
331
338
|
# Vedeu.configure do
|
332
339
|
# root :controller, :action, args
|
@@ -378,13 +385,13 @@ module Vedeu
|
|
378
385
|
options[:stderr] = io
|
379
386
|
end
|
380
387
|
|
381
|
-
# Compression reduces the number of escape sequences being sent
|
382
|
-
# terminal which improves redraw/render/refresh rate. By
|
383
|
-
# enabled.
|
388
|
+
# Compression reduces the number of escape sequences being sent
|
389
|
+
# to the terminal which improves redraw/render/refresh rate. By
|
390
|
+
# default it is enabled.
|
384
391
|
#
|
385
|
-
# Sets boolean to enable/disable compression. Vedeu's default
|
386
|
-
# for compression to be enabled. Setting
|
387
|
-
# disable compression.
|
392
|
+
# Sets boolean to enable/disable compression. Vedeu's default
|
393
|
+
# setting is for compression to be enabled. Setting
|
394
|
+
# `compression` to false will disable compression.
|
388
395
|
#
|
389
396
|
# Vedeu.configure do
|
390
397
|
# compression! # enabled (default)
|
@@ -397,9 +404,10 @@ module Vedeu
|
|
397
404
|
# end
|
398
405
|
#
|
399
406
|
# @note
|
400
|
-
# - Be aware that running an application without compression
|
401
|
-
# affect performance.
|
402
|
-
# - Compression cannot yet be configured using a CLI option
|
407
|
+
# - Be aware that running an application without compression
|
408
|
+
# will affect performance.
|
409
|
+
# - Compression cannot yet be configured using a CLI option
|
410
|
+
# flag.
|
403
411
|
#
|
404
412
|
# @param value [Boolean]
|
405
413
|
# @return [Boolean]
|
@@ -408,8 +416,8 @@ module Vedeu
|
|
408
416
|
end
|
409
417
|
alias_method :compression!, :compression
|
410
418
|
|
411
|
-
# Sets the terminal mode. Valid values can be either ':cooked',
|
412
|
-
# :raw'.
|
419
|
+
# Sets the terminal mode. Valid values can be either ':cooked',
|
420
|
+
# ':fake' or :raw'.
|
413
421
|
#
|
414
422
|
# Vedeu.configure do
|
415
423
|
# terminal_mode :cooked
|
@@ -426,8 +434,8 @@ module Vedeu
|
|
426
434
|
# end
|
427
435
|
#
|
428
436
|
# @param mode [Symbol] Either ':cooked', ':fake' or ':raw'.
|
429
|
-
# @raise [Vedeu::Error::InvalidSyntax] When the mode is not
|
430
|
-
# ':fake' or ':raw'.
|
437
|
+
# @raise [Vedeu::Error::InvalidSyntax] When the mode is not
|
438
|
+
# ':cooked', ':fake' or ':raw'.
|
431
439
|
# @return [Symbol]
|
432
440
|
# @see Vedeu::Config::API#cooked!
|
433
441
|
# @see Vedeu::Config::API#fake!
|
@@ -445,8 +453,8 @@ module Vedeu
|
|
445
453
|
|
446
454
|
private
|
447
455
|
|
448
|
-
# Returns the options set via the configuration API DSL or an
|
449
|
-
# when none were set.
|
456
|
+
# Returns the options set via the configuration API DSL or an
|
457
|
+
# empty Hash when none were set.
|
450
458
|
#
|
451
459
|
# @return [Hash]
|
452
460
|
def options
|
@@ -3,7 +3,8 @@ module Vedeu
|
|
3
3
|
module Config
|
4
4
|
|
5
5
|
# The Configuration::CLI class parses command-line arguments using
|
6
|
-
# OptionParser into options used by Vedeu to affect certain
|
6
|
+
# OptionParser into options used by Vedeu to affect certain
|
7
|
+
# behaviours.
|
7
8
|
#
|
8
9
|
class CLI
|
9
10
|
|
@@ -14,9 +15,9 @@ module Vedeu
|
|
14
15
|
|
15
16
|
# Returns a new instance of Vedeu::Config::CLI.
|
16
17
|
#
|
17
|
-
# Configure Vedeu via command-line arguments. Options set here
|
18
|
-
# arguments override the client application configuration
|
19
|
-
# {Vedeu::API#configure}.
|
18
|
+
# Configure Vedeu via command-line arguments. Options set here
|
19
|
+
# via arguments override the client application configuration
|
20
|
+
# set via {Vedeu::API#configure}.
|
20
21
|
#
|
21
22
|
# @param args [Array]
|
22
23
|
# @return [Vedeu::Configuration::CLI]
|
@@ -25,8 +26,8 @@ module Vedeu
|
|
25
26
|
@options = {}
|
26
27
|
end
|
27
28
|
|
28
|
-
# Returns the configuration options set up by parsing the
|
29
|
-
# arguments passed to the client application.
|
29
|
+
# Returns the configuration options set up by parsing the
|
30
|
+
# command-line arguments passed to the client application.
|
30
31
|
#
|
31
32
|
# @return [Hash]
|
32
33
|
def configuration
|
@@ -49,7 +50,8 @@ module Vedeu
|
|
49
50
|
|
50
51
|
private
|
51
52
|
|
52
|
-
# Setup Vedeu using CLI configuration options for the client
|
53
|
+
# Setup Vedeu using CLI configuration options for the client
|
54
|
+
# application.
|
53
55
|
#
|
54
56
|
# @return [void]
|
55
57
|
def setup!
|