vedeu 0.4.58 → 0.4.59
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +0 -558
- data/README.md +2 -0
- data/docs/dsl.md +66 -54
- data/lib/vedeu/all.rb +44 -16
- data/lib/vedeu/api.rb +0 -2
- data/lib/vedeu/bindings/drb.rb +0 -1
- data/lib/vedeu/bindings/menus.rb +0 -1
- data/lib/vedeu/bindings/movement.rb +0 -1
- data/lib/vedeu/bindings/system.rb +0 -1
- data/lib/vedeu/bindings/visibility.rb +0 -1
- data/lib/vedeu/bootstrap.rb +2 -2
- data/lib/vedeu/buffers/buffers.rb +0 -4
- data/lib/vedeu/cli/generator/all.rb +0 -4
- data/lib/vedeu/cli/generator/helpers.rb +0 -2
- data/lib/vedeu/cli/generator/templates/application/application.erb +8 -5
- data/lib/vedeu/cli/generator/view.rb +4 -2
- data/lib/vedeu/cli/main.rb +0 -2
- data/lib/vedeu/colours/backgrounds.rb +0 -1
- data/lib/vedeu/colours/colours.rb +0 -1
- data/lib/vedeu/colours/foregrounds.rb +0 -1
- data/lib/vedeu/configuration/api.rb +19 -6
- data/lib/vedeu/configuration/cli.rb +9 -1
- data/lib/vedeu/configuration/configuration.rb +9 -0
- data/lib/vedeu/cursor/cursor.rb +0 -2
- data/lib/vedeu/cursor/cursors.rb +0 -3
- data/lib/vedeu/debug.rb +0 -1
- data/lib/vedeu/dsl.rb +0 -1
- data/lib/vedeu/dsl/border.rb +69 -106
- data/lib/vedeu/dsl/composition.rb +1 -2
- data/lib/vedeu/dsl/geometry.rb +102 -67
- data/lib/vedeu/dsl/group.rb +21 -9
- data/lib/vedeu/dsl/interface.rb +0 -1
- data/lib/vedeu/dsl/keymap.rb +26 -36
- data/lib/vedeu/dsl/line.rb +5 -10
- data/lib/vedeu/dsl/menu.rb +7 -13
- data/lib/vedeu/dsl/presentation.rb +0 -1
- data/lib/vedeu/dsl/stream.rb +0 -1
- data/lib/vedeu/dsl/text.rb +0 -1
- data/lib/vedeu/dsl/use.rb +0 -1
- data/lib/vedeu/dsl/view.rb +28 -31
- data/lib/vedeu/events/event.rb +0 -3
- data/lib/vedeu/events/events.rb +0 -1
- data/lib/vedeu/events/trigger.rb +0 -1
- data/lib/vedeu/geometry/geometries.rb +0 -4
- data/lib/vedeu/geometry/geometry.rb +0 -2
- data/lib/vedeu/geometry/grid.rb +2 -25
- data/lib/vedeu/input/keymap.rb +0 -3
- data/lib/vedeu/input/keymaps.rb +0 -3
- data/lib/vedeu/launcher.rb +0 -1
- data/lib/vedeu/log.rb +0 -1
- data/lib/vedeu/models/char.rb +0 -5
- data/lib/vedeu/models/group.rb +0 -2
- data/lib/vedeu/models/groups.rb +0 -3
- data/lib/vedeu/models/interface.rb +0 -19
- data/lib/vedeu/models/interfaces.rb +0 -4
- data/lib/vedeu/models/menus.rb +0 -3
- data/lib/vedeu/null/interface.rb +6 -7
- data/lib/vedeu/output/border.rb +0 -2
- data/lib/vedeu/output/borders.rb +0 -4
- data/lib/vedeu/output/esc.rb +0 -1
- data/lib/vedeu/output/html_char.rb +0 -2
- data/lib/vedeu/output/refresh.rb +0 -3
- data/lib/vedeu/output/refresh_group.rb +0 -2
- data/lib/vedeu/output/renderers.rb +0 -13
- data/lib/vedeu/repositories.rb +2 -15
- data/lib/vedeu/repositories/model.rb +0 -2
- data/lib/vedeu/repositories/repository.rb +0 -2
- data/lib/vedeu/templating/template.rb +0 -2
- data/lib/vedeu/terminal.rb +0 -3
- data/lib/vedeu/timer.rb +0 -1
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/bootstrap_test.rb +8 -1
- data/test/lib/vedeu/configuration/api_test.rb +14 -0
- data/test/lib/vedeu/configuration/cli_test.rb +15 -0
- data/test/lib/vedeu/cursor/cursor_test.rb +0 -1
- data/test/lib/vedeu/models/interface_test.rb +12 -4
- data/test/lib/vedeu/null/interface_test.rb +3 -12
- data/test/support/helpers/model_test_class.rb +0 -3
- data/test/test_helper.rb +0 -2
- data/vedeu.gemspec +1 -1
- metadata +4 -4
@@ -5,7 +5,6 @@ module Vedeu
|
|
5
5
|
# The Configuration::API class parses client application configuration into
|
6
6
|
# options used by Vedeu to affect certain behaviours.
|
7
7
|
#
|
8
|
-
# @api public
|
9
8
|
class API
|
10
9
|
|
11
10
|
include Vedeu::Common
|
@@ -302,6 +301,20 @@ module Vedeu
|
|
302
301
|
options[:base_path] = path
|
303
302
|
end
|
304
303
|
|
304
|
+
# Sets the root of the client application. Vedeu will execute this
|
305
|
+
# controller first.
|
306
|
+
#
|
307
|
+
# @example
|
308
|
+
# Vedeu.configure do
|
309
|
+
# root YourApp::SomeController.new
|
310
|
+
# ...
|
311
|
+
#
|
312
|
+
# @param controller [Class]
|
313
|
+
# @return [Class]
|
314
|
+
def root(controller)
|
315
|
+
options[:root] = controller
|
316
|
+
end
|
317
|
+
|
305
318
|
# Sets the value of STDIN.
|
306
319
|
#
|
307
320
|
# @example
|
@@ -393,13 +406,13 @@ module Vedeu
|
|
393
406
|
# @return [Symbol]
|
394
407
|
# @see Vedeu::Config::API#raw!
|
395
408
|
# @see Vedeu::Config::API#cooked!
|
396
|
-
def terminal_mode(
|
397
|
-
if
|
398
|
-
options[:terminal_mode] =
|
409
|
+
def terminal_mode(mode)
|
410
|
+
if mode == :raw || mode == :cooked
|
411
|
+
options[:terminal_mode] = mode
|
399
412
|
|
400
413
|
else
|
401
|
-
fail Vedeu::InvalidSyntax,
|
402
|
-
|
414
|
+
fail Vedeu::InvalidSyntax,
|
415
|
+
'Terminal mode can be set to either :raw or :cooked'
|
403
416
|
|
404
417
|
end
|
405
418
|
end
|
@@ -5,7 +5,6 @@ module Vedeu
|
|
5
5
|
# The Configuration::CLI class parses command-line arguments using
|
6
6
|
# OptionParser into options used by Vedeu to affect certain behaviours.
|
7
7
|
#
|
8
|
-
# @api public
|
9
8
|
class CLI
|
10
9
|
|
11
10
|
# @param (see #initialize)
|
@@ -78,6 +77,7 @@ module Vedeu
|
|
78
77
|
:raw,
|
79
78
|
:run_many,
|
80
79
|
:run_once,
|
80
|
+
:root,
|
81
81
|
:standalone,
|
82
82
|
]
|
83
83
|
end
|
@@ -181,6 +181,14 @@ module Vedeu
|
|
181
181
|
end
|
182
182
|
end
|
183
183
|
|
184
|
+
# # @return [OptionParser]
|
185
|
+
def root
|
186
|
+
parser.on('-s', '--root []', String,
|
187
|
+
'Start the application from the specified controller.') do |c|
|
188
|
+
options[:root] = c
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
184
192
|
# @return [OptionParser]
|
185
193
|
def run_many
|
186
194
|
parser.on('-n', '--run-many',
|
@@ -174,6 +174,14 @@ module Vedeu
|
|
174
174
|
instance.options[:renderers]
|
175
175
|
end
|
176
176
|
|
177
|
+
# Returns the root of the client application. Vedeu will execute this
|
178
|
+
# controller first.
|
179
|
+
#
|
180
|
+
# @return [Class]
|
181
|
+
def root
|
182
|
+
instance.options[:root]
|
183
|
+
end
|
184
|
+
|
177
185
|
# Returns the redefined setting for STDIN.
|
178
186
|
#
|
179
187
|
# @return [File|IO]
|
@@ -274,6 +282,7 @@ module Vedeu
|
|
274
282
|
log: nil,
|
275
283
|
once: false,
|
276
284
|
renderers: [Vedeu::Renderers::Terminal.new],
|
285
|
+
root: nil,
|
277
286
|
stdin: nil,
|
278
287
|
stdout: nil,
|
279
288
|
stderr: nil,
|
data/lib/vedeu/cursor/cursor.rb
CHANGED
data/lib/vedeu/cursor/cursors.rb
CHANGED
data/lib/vedeu/debug.rb
CHANGED
data/lib/vedeu/dsl.rb
CHANGED
data/lib/vedeu/dsl/border.rb
CHANGED
@@ -2,11 +2,10 @@ module Vedeu
|
|
2
2
|
|
3
3
|
module DSL
|
4
4
|
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
# drawn or not.
|
5
|
+
# Borders are defined by name for each of the client application's
|
6
|
+
# interfaces or views. They can be enabled or disabled (which controls
|
7
|
+
# whether they are rendered or not), they have their own colours and styles,
|
8
|
+
# and each aspect of the border can be controlled.
|
10
9
|
#
|
11
10
|
# @example
|
12
11
|
# # Borders can be defined when defining your interface...
|
@@ -27,7 +26,6 @@ module Vedeu
|
|
27
26
|
# # ...
|
28
27
|
# end
|
29
28
|
#
|
30
|
-
# @api public
|
31
29
|
class Border
|
32
30
|
|
33
31
|
include Vedeu::DSL
|
@@ -36,7 +34,6 @@ module Vedeu
|
|
36
34
|
|
37
35
|
# Specify the border of an interface or view with a simple DSL.
|
38
36
|
#
|
39
|
-
# @example
|
40
37
|
# Vedeu.border 'some_interface' do
|
41
38
|
# # ...
|
42
39
|
# end
|
@@ -65,14 +62,9 @@ module Vedeu
|
|
65
62
|
# Set the character to be used to draw the bottom left corner of the
|
66
63
|
# border.
|
67
64
|
#
|
68
|
-
#
|
69
|
-
#
|
70
|
-
#
|
71
|
-
# border do
|
72
|
-
# bottom_left '+'
|
73
|
-
# # ...
|
74
|
-
# end
|
75
|
-
# end
|
65
|
+
# Vedeu.border 'border_demo' do
|
66
|
+
# bottom_left '+'
|
67
|
+
# # ... some code
|
76
68
|
# end
|
77
69
|
#
|
78
70
|
# @param char [String] Character to be used as the bottom left border
|
@@ -85,14 +77,9 @@ module Vedeu
|
|
85
77
|
# Set the character to be used to draw the bottom right corner of the
|
86
78
|
# border.
|
87
79
|
#
|
88
|
-
#
|
89
|
-
#
|
90
|
-
#
|
91
|
-
# border do
|
92
|
-
# bottom_right '+'
|
93
|
-
# # ...
|
94
|
-
# end
|
95
|
-
# end
|
80
|
+
# Vedeu.border 'border_demo' do
|
81
|
+
# bottom_right '+'
|
82
|
+
# # ... some code
|
96
83
|
# end
|
97
84
|
#
|
98
85
|
# @param char [String] Character to be used as the bottom right border
|
@@ -102,7 +89,12 @@ module Vedeu
|
|
102
89
|
model.bottom_right = char
|
103
90
|
end
|
104
91
|
|
105
|
-
# Disable
|
92
|
+
# Disable the border:
|
93
|
+
#
|
94
|
+
# Vedeu.border 'border_demo' do
|
95
|
+
# disable!
|
96
|
+
# # ... some other code (will be ignored)
|
97
|
+
# end
|
106
98
|
#
|
107
99
|
# @return [Boolean]
|
108
100
|
def disable!
|
@@ -112,11 +104,18 @@ module Vedeu
|
|
112
104
|
hide_left!
|
113
105
|
hide_right!
|
114
106
|
hide_top!
|
107
|
+
|
108
|
+
model.enabled
|
115
109
|
end
|
116
110
|
|
117
|
-
# Enable
|
111
|
+
# Enable the border:
|
118
112
|
# (Borders are enabled by default if defined for an interface).
|
119
113
|
#
|
114
|
+
# Vedeu.border 'border_demo' do
|
115
|
+
# enable!
|
116
|
+
# # ... some code
|
117
|
+
# end
|
118
|
+
#
|
120
119
|
# @return [Boolean]
|
121
120
|
def enable!
|
122
121
|
model.enabled = true
|
@@ -125,18 +124,15 @@ module Vedeu
|
|
125
124
|
show_left!
|
126
125
|
show_right!
|
127
126
|
show_top!
|
127
|
+
|
128
|
+
model.enabled
|
128
129
|
end
|
129
130
|
|
130
131
|
# Set the character to be used to draw a horizontal part of the border.
|
131
132
|
#
|
132
|
-
#
|
133
|
-
#
|
134
|
-
#
|
135
|
-
# border do
|
136
|
-
# horizontal '-'
|
137
|
-
# # ...
|
138
|
-
# end
|
139
|
-
# end
|
133
|
+
# Vedeu.border 'border_demo' do
|
134
|
+
# horizontal '-'
|
135
|
+
# # ... some code
|
140
136
|
# end
|
141
137
|
#
|
142
138
|
# @param char [String] Character to be used as the horizontal border
|
@@ -148,17 +144,12 @@ module Vedeu
|
|
148
144
|
|
149
145
|
# Enable/disable the bottom border.
|
150
146
|
#
|
151
|
-
#
|
152
|
-
#
|
153
|
-
#
|
154
|
-
#
|
155
|
-
#
|
156
|
-
#
|
157
|
-
# hide_bottom!
|
158
|
-
# # ... or
|
159
|
-
# show_bottom!
|
160
|
-
# end
|
161
|
-
# end
|
147
|
+
# Vedeu.border 'border_demo' do
|
148
|
+
# bottom true # or...
|
149
|
+
# bottom false # or...
|
150
|
+
# hide_bottom! # or...
|
151
|
+
# show_bottom!
|
152
|
+
# # ... some code
|
162
153
|
# end
|
163
154
|
#
|
164
155
|
# @param value [Boolean] All values evaluate as true except nil and
|
@@ -187,17 +178,12 @@ module Vedeu
|
|
187
178
|
|
188
179
|
# Enable/disable the left border.
|
189
180
|
#
|
190
|
-
#
|
191
|
-
#
|
192
|
-
#
|
193
|
-
#
|
194
|
-
#
|
195
|
-
#
|
196
|
-
# hide_left!
|
197
|
-
# # ... or
|
198
|
-
# show_left!
|
199
|
-
# end
|
200
|
-
# end
|
181
|
+
# Vedeu.border 'border_demo' do
|
182
|
+
# left true # or...
|
183
|
+
# left false # or...
|
184
|
+
# hide_left! # or...
|
185
|
+
# show_left!
|
186
|
+
# # ... some code
|
201
187
|
# end
|
202
188
|
#
|
203
189
|
# @param value [Boolean] All values evaluate as true except nil and
|
@@ -226,17 +212,12 @@ module Vedeu
|
|
226
212
|
|
227
213
|
# Enable/disable the right border.
|
228
214
|
#
|
229
|
-
#
|
230
|
-
#
|
231
|
-
#
|
232
|
-
#
|
233
|
-
#
|
234
|
-
#
|
235
|
-
# hide_right!
|
236
|
-
# # ... or
|
237
|
-
# show_right!
|
238
|
-
# end
|
239
|
-
# end
|
215
|
+
# Vedeu.border 'border_demo' do
|
216
|
+
# right true # or...
|
217
|
+
# right false # or...
|
218
|
+
# hide_right! # or...
|
219
|
+
# show_right!
|
220
|
+
# # ... some code
|
240
221
|
# end
|
241
222
|
#
|
242
223
|
# @param value [Boolean] All values evaluate as true except nil and
|
@@ -265,17 +246,13 @@ module Vedeu
|
|
265
246
|
|
266
247
|
# If you have you are showing a top border, you could add a title.
|
267
248
|
#
|
268
|
-
#
|
269
|
-
#
|
270
|
-
#
|
271
|
-
# geometry { width: 50 }
|
272
|
-
# border do
|
273
|
-
# title 'My Cool Title'
|
274
|
-
# # ...
|
275
|
-
# end
|
276
|
-
# end
|
249
|
+
# Vedeu.border 'border_demo' do
|
250
|
+
# title 'My Cool Title'
|
251
|
+
# # ... some code
|
277
252
|
# end
|
278
253
|
#
|
254
|
+
# produces, depending on other customisations:
|
255
|
+
#
|
279
256
|
# +- My Cool Title --------------------------------+
|
280
257
|
#
|
281
258
|
# @param value [String] The title.
|
@@ -286,17 +263,12 @@ module Vedeu
|
|
286
263
|
|
287
264
|
# Enable/disable the top border.
|
288
265
|
#
|
289
|
-
#
|
290
|
-
#
|
291
|
-
#
|
292
|
-
#
|
293
|
-
#
|
294
|
-
#
|
295
|
-
# hide_top!
|
296
|
-
# # ... or
|
297
|
-
# show_top!
|
298
|
-
# end
|
299
|
-
# end
|
266
|
+
# Vedeu.border 'border_demo' do
|
267
|
+
# top true # or...
|
268
|
+
# top false # or...
|
269
|
+
# hide_top! # or...
|
270
|
+
# show_top!
|
271
|
+
# # ... some code
|
300
272
|
# end
|
301
273
|
#
|
302
274
|
# @param value [Boolean] All values evaluate as true except nil and
|
@@ -325,14 +297,9 @@ module Vedeu
|
|
325
297
|
|
326
298
|
# Set the character to be used to draw the top left corner of the border.
|
327
299
|
#
|
328
|
-
#
|
329
|
-
#
|
330
|
-
#
|
331
|
-
# border do
|
332
|
-
# top_left '+'
|
333
|
-
# # ...
|
334
|
-
# end
|
335
|
-
# end
|
300
|
+
# Vedeu.border 'border_demo' do
|
301
|
+
# top_left '+'
|
302
|
+
# # ... some code
|
336
303
|
# end
|
337
304
|
#
|
338
305
|
# @param char [String] Character to be used as the top left border
|
@@ -344,12 +311,10 @@ module Vedeu
|
|
344
311
|
|
345
312
|
# Set the character to be used to draw the top right corner of the border.
|
346
313
|
#
|
347
|
-
#
|
348
|
-
#
|
349
|
-
#
|
350
|
-
#
|
351
|
-
# top_right '+'
|
352
|
-
# # ...
|
314
|
+
# Vedeu.border 'border_demo' do
|
315
|
+
# top_right '+'
|
316
|
+
# # ... some code
|
317
|
+
# end
|
353
318
|
#
|
354
319
|
# @param char [String] Character to be used as the top right border
|
355
320
|
# character.
|
@@ -360,12 +325,10 @@ module Vedeu
|
|
360
325
|
|
361
326
|
# Set the character to be used to draw a vertical part of the border.
|
362
327
|
#
|
363
|
-
#
|
364
|
-
#
|
365
|
-
#
|
366
|
-
#
|
367
|
-
# vertical '|'
|
368
|
-
# # ...
|
328
|
+
# Vedeu.border 'border_demo' do
|
329
|
+
# vertical '|'
|
330
|
+
# # ... some code
|
331
|
+
# end
|
369
332
|
#
|
370
333
|
# @param char [String] Character to be used as the vertical border
|
371
334
|
# character.
|
@@ -36,7 +36,6 @@ module Vedeu
|
|
36
36
|
# - Colours are defined in CSS-style values, i.e. `#ff0000` would be red.
|
37
37
|
# - Styles are named. See the table below for supported styles.
|
38
38
|
#
|
39
|
-
# @api public
|
40
39
|
class Composition
|
41
40
|
|
42
41
|
include Vedeu::DSL
|
@@ -103,7 +102,7 @@ module Vedeu
|
|
103
102
|
fail Vedeu::MissingRequired,
|
104
103
|
'Cannot render template without the name of the view.' unless name
|
105
104
|
fail Vedeu::MissingRequired,
|
106
|
-
|
105
|
+
'Cannot render template without a filename.' unless filename
|
107
106
|
|
108
107
|
content = Vedeu::Templating::Template.parse(object, filename)
|
109
108
|
lines = Vedeu::Wordwrap.for(content, options)
|