vedeu 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/api.md +0 -357
- data/docs/configuration.md +1 -1
- data/docs/dsl/by_method/add_command.md +5 -0
- data/docs/dsl/by_method/add_keypress.md +4 -0
- data/docs/dsl/by_method/all_commands.md +3 -0
- data/docs/dsl/by_method/all_keypresses.md +3 -0
- data/docs/dsl/by_method/background_colours.md +4 -0
- data/docs/dsl/by_method/bind.md +43 -0
- data/docs/dsl/by_method/bind_alias.md +4 -0
- data/docs/dsl/by_method/borders.md +6 -0
- data/docs/dsl/by_method/bound.md +3 -0
- data/docs/dsl/by_method/buffer_update.md +1 -0
- data/docs/dsl/by_method/buffer_write.md +1 -0
- data/docs/dsl/by_method/buffers.md +5 -0
- data/docs/dsl/by_method/clear_by_group.md +1 -0
- data/docs/dsl/by_method/clear_by_name.md +1 -0
- data/docs/dsl/by_method/clear_content_by_name.md +1 -0
- data/docs/dsl/by_method/clock_time.md +1 -0
- data/docs/dsl/by_method/cursor.md +1 -0
- data/docs/dsl/by_method/cursors.md +1 -0
- data/docs/dsl/by_method/direct_write.md +1 -0
- data/docs/dsl/by_method/documents.md +1 -0
- data/docs/dsl/by_method/drb_restart.md +1 -0
- data/docs/dsl/by_method/drb_start.md +1 -0
- data/docs/dsl/by_method/drb_status.md +1 -0
- data/docs/dsl/by_method/drb_stop.md +1 -0
- data/docs/dsl/by_method/events.md +1 -0
- data/docs/dsl/by_method/exit.md +1 -0
- data/docs/dsl/by_method/focus.md +1 -0
- data/docs/dsl/by_method/focus_by_name.md +1 -0
- data/docs/dsl/by_method/focus_next.md +1 -0
- data/docs/dsl/by_method/focus_previous.md +1 -0
- data/docs/dsl/by_method/focussed.md +1 -0
- data/docs/dsl/by_method/geometries.md +1 -0
- data/docs/dsl/by_method/geometry.md +1 -0
- data/docs/dsl/by_method/goto.md +5 -6
- data/docs/dsl/by_method/group.md +1 -0
- data/docs/dsl/by_method/groups.md +1 -0
- data/docs/dsl/by_method/hide_cursor.md +1 -0
- data/docs/dsl/by_method/hide_group.md +1 -0
- data/docs/dsl/by_method/hide_interface.md +1 -0
- data/docs/dsl/by_method/interface.md +1 -0
- data/docs/dsl/by_method/interfaces.md +1 -0
- data/docs/dsl/by_method/keymap.md +1 -0
- data/docs/dsl/by_method/keymap/interface.md +1 -0
- data/docs/dsl/by_method/keymap/key.md +1 -0
- data/docs/dsl/by_method/keymap/name.md +1 -0
- data/docs/dsl/by_method/keymaps.md +1 -0
- data/docs/dsl/by_method/last_command.md +4 -0
- data/docs/dsl/by_method/last_keypress.md +4 -0
- data/docs/dsl/by_method/log.md +1 -0
- data/docs/dsl/by_method/log_stderr.md +1 -0
- data/docs/dsl/by_method/log_stdout.md +1 -0
- data/docs/dsl/by_method/log_timestamp.md +1 -0
- data/docs/dsl/by_method/menu.md +1 -0
- data/docs/dsl/by_method/menus.md +1 -0
- data/docs/dsl/by_method/read.md +33 -0
- data/docs/dsl/by_method/ready.md +1 -0
- data/docs/dsl/by_method/render.md +1 -0
- data/docs/dsl/by_method/render_output.md +1 -0
- data/docs/dsl/by_method/renderer.md +1 -0
- data/docs/dsl/by_method/renderers.md +1 -0
- data/docs/dsl/by_method/renders.md +1 -0
- data/docs/dsl/by_method/show_cursor.md +1 -0
- data/docs/dsl/by_method/show_group.md +1 -0
- data/docs/dsl/by_method/show_interface.md +1 -0
- data/docs/dsl/by_method/toggle_cursor.md +1 -0
- data/docs/dsl/by_method/toggle_group.md +1 -0
- data/docs/dsl/by_method/toggle_interface.md +1 -0
- data/docs/dsl/by_method/trigger.md +1 -0
- data/docs/dsl/by_method/unbind.md +5 -0
- data/docs/dsl/by_method/unbind_alias.md +4 -0
- data/docs/dsl/by_method/views.md +1 -0
- data/docs/dsl/by_method/write.md +5 -0
- data/examples/views/lines_streams.rb +45 -0
- data/lib/vedeu/application/application_view.rb +1 -1
- data/lib/vedeu/borders/border.rb +2 -2
- data/lib/vedeu/cells/border.rb +1 -1
- data/lib/vedeu/cells/borders/bottom_horizontal.rb +1 -1
- data/lib/vedeu/cells/borders/bottom_left.rb +1 -1
- data/lib/vedeu/cells/borders/bottom_right.rb +1 -1
- data/lib/vedeu/cells/borders/horizontal.rb +1 -1
- data/lib/vedeu/cells/borders/left_vertical.rb +1 -1
- data/lib/vedeu/cells/borders/right_vertical.rb +1 -1
- data/lib/vedeu/cells/borders/top_horizontal.rb +1 -1
- data/lib/vedeu/cells/borders/top_left.rb +1 -1
- data/lib/vedeu/cells/borders/top_right.rb +1 -1
- data/lib/vedeu/cells/borders/vertical.rb +1 -1
- data/lib/vedeu/colours/background.rb +1 -1
- data/lib/vedeu/colours/foreground.rb +1 -1
- data/lib/vedeu/colours/translator.rb +4 -7
- data/lib/vedeu/colours/validator.rb +1 -1
- data/lib/vedeu/configuration/api.rb +1 -1
- data/lib/vedeu/configuration/configuration.rb +20 -11
- data/lib/vedeu/cursors/cursor.rb +2 -2
- data/lib/vedeu/distributed/server.rb +7 -7
- data/lib/vedeu/dsl/views.rb +1 -1
- data/lib/vedeu/esc/background.rb +1 -1
- data/lib/vedeu/esc/colours.rb +3 -0
- data/lib/vedeu/esc/esc.rb +11 -25
- data/lib/vedeu/esc/mouse.rb +14 -0
- data/lib/vedeu/events/aliases.rb +2 -13
- data/lib/vedeu/events/event.rb +2 -13
- data/lib/vedeu/input/read.rb +3 -3
- data/lib/vedeu/input/store.rb +6 -37
- data/lib/vedeu/interfaces/interface.rb +1 -1
- data/lib/vedeu/logging/debug.rb +1 -1
- data/lib/vedeu/logging/log.rb +6 -17
- data/lib/vedeu/logging/timer.rb +1 -1
- data/lib/vedeu/models/row.rb +1 -1
- data/lib/vedeu/output/write.rb +1 -3
- data/lib/vedeu/presentation/style.rb +1 -3
- data/lib/vedeu/renderers/all.rb +2 -2
- data/lib/vedeu/renderers/file.rb +1 -1
- data/lib/vedeu/renderers/options.rb +1 -1
- data/lib/vedeu/runtime/application.rb +10 -19
- data/lib/vedeu/runtime/bootstrap.rb +4 -4
- data/lib/vedeu/runtime/launcher.rb +3 -5
- data/lib/vedeu/terminal/mode.rb +1 -1
- data/lib/vedeu/terminal/terminal.rb +9 -10
- data/lib/vedeu/version.rb +1 -1
- data/lib/vedeu/views/char.rb +1 -1
- data/lib/vedeu/views/view.rb +1 -1
- data/test/lib/vedeu/colours/background_test.rb +1 -1
- data/test/lib/vedeu/configuration/api_test.rb +1 -1
- data/test/lib/vedeu/cursors/cursor_test.rb +2 -5
- data/test/lib/vedeu/distributed/server_test.rb +2 -2
- data/test/lib/vedeu/esc/mouse_test.rb +29 -1
- data/test/lib/vedeu/logging/timer_test.rb +2 -2
- data/test/lib/vedeu/renderers/html_test.rb +1 -1
- data/test/lib/vedeu/renderers/json_test.rb +1 -1
- data/test/lib/vedeu/renderers/options_test.rb +4 -4
- data/test/lib/vedeu/runtime/application_test.rb +4 -9
- data/test/lib/vedeu/runtime/bootstrap_test.rb +1 -1
- data/test/lib/vedeu/runtime/launcher_test.rb +1 -1
- data/test/lib/vedeu/terminal/mode_test.rb +5 -5
- data/test/lib/vedeu/terminal/terminal_test.rb +2 -2
- data/test/support/examples/material_colours_app.rb +2 -5
- data/test/test_helper.rb +1 -1
- metadata +5 -3
- data/examples/views/lines_streams_stream.rb +0 -48
@@ -155,14 +155,11 @@ module Vedeu
|
|
155
155
|
if registered?(colour)
|
156
156
|
retrieve(colour)
|
157
157
|
|
158
|
-
|
159
|
-
|
160
|
-
register(colour, format(rgb_prefix, *css_to_rgb))
|
161
|
-
|
162
|
-
else
|
163
|
-
register(colour, numbered)
|
158
|
+
elsif Vedeu.config.colour_mode == 16_777_216
|
159
|
+
register(colour, format(rgb_prefix, *css_to_rgb))
|
164
160
|
|
165
|
-
|
161
|
+
else
|
162
|
+
register(colour, numbered)
|
166
163
|
|
167
164
|
end
|
168
165
|
end
|
@@ -36,7 +36,7 @@ module Vedeu
|
|
36
36
|
# @return [Hash<Symbol => Boolean, Fixnum, String>]
|
37
37
|
def configuration
|
38
38
|
Vedeu::Config
|
39
|
-
.log(Vedeu
|
39
|
+
.log(Vedeu.esc.green { '[api]' }, options)
|
40
40
|
end
|
41
41
|
|
42
42
|
# Sets boolean to allow user input. The default behaviour of
|
@@ -16,6 +16,8 @@ module Vedeu
|
|
16
16
|
|
17
17
|
class << self
|
18
18
|
|
19
|
+
include Vedeu::Common
|
20
|
+
|
19
21
|
# Return the configured background colour for the client
|
20
22
|
# application.
|
21
23
|
#
|
@@ -55,8 +57,9 @@ module Vedeu
|
|
55
57
|
# {include:file:docs/dsl/by_method/configuration.md}
|
56
58
|
# @return [Vedeu::Configuration]
|
57
59
|
def configuration
|
58
|
-
|
60
|
+
self
|
59
61
|
end
|
62
|
+
alias_method :config, :configuration
|
60
63
|
|
61
64
|
# @return [Hash]
|
62
65
|
def colour
|
@@ -154,11 +157,11 @@ module Vedeu
|
|
154
157
|
end
|
155
158
|
|
156
159
|
# Returns a boolean indicating whether the log has been
|
157
|
-
# configured.
|
160
|
+
# configured; if {#log} contains a path, then this will be true.
|
158
161
|
#
|
159
162
|
# @return [Boolean]
|
160
163
|
def log?
|
161
|
-
log
|
164
|
+
present?(log)
|
162
165
|
end
|
163
166
|
|
164
167
|
# @return [Array<Symbol>]
|
@@ -178,8 +181,7 @@ module Vedeu
|
|
178
181
|
# @param type [Symbol]
|
179
182
|
# @return [Boolean]
|
180
183
|
def loggable?(type)
|
181
|
-
|
182
|
-
!Vedeu::Configuration.log_except.include?(type)
|
184
|
+
log_only.include?(type) || !log_except.include?(type)
|
183
185
|
end
|
184
186
|
|
185
187
|
# Returns whether mouse support was enabled or disabled.
|
@@ -350,10 +352,12 @@ module Vedeu
|
|
350
352
|
# @return [Fixnum]
|
351
353
|
def detect_colour_mode
|
352
354
|
case ENV['TERM']
|
353
|
-
when
|
354
|
-
|
355
|
-
when
|
356
|
-
|
355
|
+
when 'xterm-256color', 'screen-256color'
|
356
|
+
256
|
357
|
+
when 'xterm', 'screen', 'xterm-color', 'screen-color', 'rxvt'
|
358
|
+
16
|
359
|
+
else
|
360
|
+
256
|
357
361
|
end
|
358
362
|
end
|
359
363
|
|
@@ -364,14 +368,19 @@ module Vedeu
|
|
364
368
|
|
365
369
|
end # Configuration
|
366
370
|
|
367
|
-
|
368
|
-
|
371
|
+
# @!method config
|
372
|
+
# @see Vedeu::Configuration.config
|
369
373
|
# @!method configure
|
370
374
|
# @see Vedeu::Configuration.configure
|
371
375
|
# @!method configuration
|
372
376
|
# @see Vedeu::Configuration.configuration
|
373
377
|
def_delegators Vedeu::Configuration,
|
378
|
+
:config,
|
374
379
|
:configure,
|
375
380
|
:configuration
|
376
381
|
|
382
|
+
# Sets up a default configuration. Client applications calling using
|
383
|
+
# the `Vedeu.configure` API method will override these settings.
|
384
|
+
Vedeu.configure({})
|
385
|
+
|
377
386
|
end # Vedeu
|
data/lib/vedeu/cursors/cursor.rb
CHANGED
@@ -305,9 +305,9 @@ module Vedeu
|
|
305
305
|
#
|
306
306
|
# @return [String]
|
307
307
|
def visibility
|
308
|
-
return Vedeu
|
308
|
+
return Vedeu.esc.show_cursor if visible?
|
309
309
|
|
310
|
-
Vedeu
|
310
|
+
Vedeu.esc.hide_cursor
|
311
311
|
end
|
312
312
|
|
313
313
|
end # Cursor
|
@@ -96,7 +96,7 @@ module Vedeu
|
|
96
96
|
def restart
|
97
97
|
log('Attempting to restart')
|
98
98
|
|
99
|
-
return not_enabled unless Vedeu
|
99
|
+
return not_enabled unless Vedeu.config.drb?
|
100
100
|
|
101
101
|
if drb_running?
|
102
102
|
log('Restarting')
|
@@ -122,7 +122,7 @@ module Vedeu
|
|
122
122
|
#
|
123
123
|
# @return [void]
|
124
124
|
def shutdown
|
125
|
-
return not_enabled unless Vedeu
|
125
|
+
return not_enabled unless Vedeu.config.drb?
|
126
126
|
|
127
127
|
stop if drb_running?
|
128
128
|
|
@@ -140,7 +140,7 @@ module Vedeu
|
|
140
140
|
def start
|
141
141
|
log('Attempting to start')
|
142
142
|
|
143
|
-
return not_enabled unless Vedeu
|
143
|
+
return not_enabled unless Vedeu.config.drb?
|
144
144
|
|
145
145
|
if drb_running?
|
146
146
|
log('Already started')
|
@@ -163,7 +163,7 @@ module Vedeu
|
|
163
163
|
def status
|
164
164
|
log('Fetching status')
|
165
165
|
|
166
|
-
return not_enabled unless Vedeu
|
166
|
+
return not_enabled unless Vedeu.config.drb?
|
167
167
|
|
168
168
|
if drb_running?
|
169
169
|
log('Running')
|
@@ -187,7 +187,7 @@ module Vedeu
|
|
187
187
|
def stop
|
188
188
|
log('Attempting to stop')
|
189
189
|
|
190
|
-
return not_enabled unless Vedeu
|
190
|
+
return not_enabled unless Vedeu.config.drb?
|
191
191
|
|
192
192
|
if drb_running?
|
193
193
|
log('Stopping')
|
@@ -232,8 +232,8 @@ module Vedeu
|
|
232
232
|
|
233
233
|
# @return [String]
|
234
234
|
def uri
|
235
|
-
Vedeu::Distributed::Uri.new(Vedeu
|
236
|
-
Vedeu
|
235
|
+
Vedeu::Distributed::Uri.new(Vedeu.config.drb_host,
|
236
|
+
Vedeu.config.drb_port).to_s
|
237
237
|
end
|
238
238
|
|
239
239
|
end # Server
|
data/lib/vedeu/dsl/views.rb
CHANGED
@@ -202,7 +202,7 @@ module Vedeu
|
|
202
202
|
# @param block [Proc]
|
203
203
|
# @return [Vedeu::Views::Composition]
|
204
204
|
def composition(client, &block)
|
205
|
-
attrs = { client: client, colour: Vedeu
|
205
|
+
attrs = { client: client, colour: Vedeu.config.colour }
|
206
206
|
|
207
207
|
Vedeu::Views::Composition.build(attrs, &block)
|
208
208
|
end
|
data/lib/vedeu/esc/background.rb
CHANGED
data/lib/vedeu/esc/colours.rb
CHANGED
data/lib/vedeu/esc/esc.rb
CHANGED
@@ -18,6 +18,11 @@ module Vedeu
|
|
18
18
|
include Vedeu::EscapeSequences::Mouse
|
19
19
|
extend self
|
20
20
|
|
21
|
+
# @return [Vedeu::EscapeSequences::Esc]
|
22
|
+
def esc
|
23
|
+
self
|
24
|
+
end
|
25
|
+
|
21
26
|
# Return the stream with the escape sequences escaped so that
|
22
27
|
# they can be printed to the terminal instead of being
|
23
28
|
# interpreted by the terminal which will render them. This way
|
@@ -39,7 +44,7 @@ module Vedeu
|
|
39
44
|
# @param value [String|Symbol]
|
40
45
|
# @return [String]
|
41
46
|
def string(value = '')
|
42
|
-
return ''
|
47
|
+
return '' unless present?(value)
|
43
48
|
|
44
49
|
send(value)
|
45
50
|
rescue NoMethodError
|
@@ -55,7 +60,7 @@ module Vedeu
|
|
55
60
|
def border(&block)
|
56
61
|
return '' unless block_given?
|
57
62
|
|
58
|
-
|
63
|
+
border_on + yield + border_off
|
59
64
|
end
|
60
65
|
|
61
66
|
# @return [String]
|
@@ -81,29 +86,7 @@ module Vedeu
|
|
81
86
|
|
82
87
|
# @return [String]
|
83
88
|
def colour_reset
|
84
|
-
Vedeu::Colours::Colour.coerce(Vedeu
|
85
|
-
end
|
86
|
-
|
87
|
-
# @return [String]
|
88
|
-
def disable_mouse
|
89
|
-
if truthy?(Vedeu::Configuration.mouse)
|
90
|
-
"#{mouse_x10_off}"
|
91
|
-
|
92
|
-
else
|
93
|
-
''
|
94
|
-
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
# @return [String]
|
99
|
-
def enable_mouse
|
100
|
-
if truthy?(Vedeu::Configuration.mouse)
|
101
|
-
"#{mouse_x10_on}"
|
102
|
-
|
103
|
-
else
|
104
|
-
''
|
105
|
-
|
106
|
-
end
|
89
|
+
Vedeu::Colours::Colour.coerce(Vedeu.config.colour).to_s
|
107
90
|
end
|
108
91
|
|
109
92
|
# @return [String]
|
@@ -125,4 +108,7 @@ module Vedeu
|
|
125
108
|
|
126
109
|
end # EscapeSequences
|
127
110
|
|
111
|
+
def_delegators Vedeu::EscapeSequences::Esc.esc,
|
112
|
+
:esc
|
113
|
+
|
128
114
|
end # Vedeu
|
data/lib/vedeu/esc/mouse.rb
CHANGED
@@ -32,6 +32,20 @@ module Vedeu
|
|
32
32
|
|
33
33
|
extend self
|
34
34
|
|
35
|
+
# @return [String]
|
36
|
+
def disable_mouse
|
37
|
+
return mouse_x10_off if Vedeu.config.mouse?
|
38
|
+
|
39
|
+
''
|
40
|
+
end
|
41
|
+
|
42
|
+
# @return [String]
|
43
|
+
def enable_mouse
|
44
|
+
return mouse_x10_on if Vedeu.config.mouse?
|
45
|
+
|
46
|
+
''
|
47
|
+
end
|
48
|
+
|
35
49
|
# @return [String]
|
36
50
|
def mouse_x10_on
|
37
51
|
"\e[?9h"
|
data/lib/vedeu/events/aliases.rb
CHANGED
@@ -12,13 +12,7 @@ module Vedeu
|
|
12
12
|
include Vedeu::Common
|
13
13
|
extend self
|
14
14
|
|
15
|
-
#
|
16
|
-
# triggered, all the events stored in the group are also
|
17
|
-
# triggered.
|
18
|
-
#
|
19
|
-
# @example
|
20
|
-
# Vedeu.bind_alias(alias_name, event_name)
|
21
|
-
#
|
15
|
+
# {include:file:docs/dsl/by_method/bind_alias.md}
|
22
16
|
# @param alias_name [Symbol] The name of the alias. This can
|
23
17
|
# represent a single event or group of events.
|
24
18
|
# @param event_name [Symbol] The name of the event to bind to
|
@@ -53,12 +47,7 @@ module Vedeu
|
|
53
47
|
storage.include?(alias_name)
|
54
48
|
end
|
55
49
|
|
56
|
-
#
|
57
|
-
# but events stored within this alias are not.
|
58
|
-
#
|
59
|
-
# @example
|
60
|
-
# Vedeu.unbind_alias(alias_name)
|
61
|
-
#
|
50
|
+
# {include:file:docs/dsl/by_method/unbind_alias.md}
|
62
51
|
# @param alias_name [Symbol] The name of the alias.
|
63
52
|
# @return [Boolean|Hash<Symbol => Array<Symbol>>]
|
64
53
|
def unbind_alias(alias_name)
|
data/lib/vedeu/events/event.rb
CHANGED
@@ -93,12 +93,7 @@ module Vedeu
|
|
93
93
|
alias_method :event, :bind
|
94
94
|
alias_method :register, :bind
|
95
95
|
|
96
|
-
#
|
97
|
-
# registered.
|
98
|
-
#
|
99
|
-
# @example
|
100
|
-
# Vedeu.bound?(:some_event)
|
101
|
-
#
|
96
|
+
# {include:file:docs/dsl/by_method/bound.md}
|
102
97
|
# @param name [Symbol]
|
103
98
|
# @return [Boolean]
|
104
99
|
def bound?(name)
|
@@ -106,13 +101,7 @@ module Vedeu
|
|
106
101
|
Vedeu::Events::Aliases.registered?(name)
|
107
102
|
end
|
108
103
|
|
109
|
-
#
|
110
|
-
#
|
111
|
-
# Removes all events associated with the given name.
|
112
|
-
#
|
113
|
-
# @example
|
114
|
-
# Vedeu.unbind(:some_event)
|
115
|
-
#
|
104
|
+
# {include:file:docs/dsl/by_method/unbind.md}
|
116
105
|
# @param name [Symbol]
|
117
106
|
# @return [Boolean]
|
118
107
|
def unbind(name)
|