vedeu 0.4.18 → 0.4.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/Rakefile +1 -0
- data/bin/vedeu_drb_server +0 -1
- data/bin/vedeu_test +0 -1
- data/config/rubocop_enabled.yml +1 -1
- data/examples/borders_app.rb +0 -1
- data/examples/colours_app.rb +0 -1
- data/examples/cursor_app.rb +0 -1
- data/examples/drb_app.rb +0 -1
- data/examples/geometry_app.rb +0 -1
- data/examples/hello_world.rb +0 -1
- data/examples/lines_app.rb +0 -1
- data/examples/material_colours_app.rb +0 -1
- data/examples/typed_commands/typed_commands_app.rb +0 -1
- data/examples/view_templates_app/view_templates_app.rb +0 -1
- data/lib/vedeu/api.rb +2 -1
- data/lib/vedeu/application.rb +3 -2
- data/lib/vedeu/bindings.rb +3 -5
- data/lib/vedeu/buffers/buffer.rb +8 -11
- data/lib/vedeu/buffers/display_buffer.rb +0 -2
- data/lib/vedeu/configuration/api.rb +1 -4
- data/lib/vedeu/configuration/cli.rb +153 -74
- data/lib/vedeu/configuration/configuration.rb +1 -2
- data/lib/vedeu/cursor/cursor.rb +0 -4
- data/lib/vedeu/cursor/move.rb +3 -6
- data/lib/vedeu/cursor/refresh_cursor.rb +12 -2
- data/lib/vedeu/distributed/client.rb +3 -2
- data/lib/vedeu/distributed/server.rb +4 -3
- data/lib/vedeu/distributed/subprocess.rb +3 -4
- data/lib/vedeu/distributed/test_application.rb +0 -1
- data/lib/vedeu/distributed/uri.rb +0 -1
- data/lib/vedeu/dsl/components/border.rb +3 -4
- data/lib/vedeu/dsl/components/geometry.rb +1 -5
- data/lib/vedeu/dsl/components/keymap.rb +1 -3
- data/lib/vedeu/dsl/components/menu.rb +1 -2
- data/lib/vedeu/dsl/composition.rb +3 -4
- data/lib/vedeu/dsl/group.rb +1 -4
- data/lib/vedeu/dsl/interface.rb +3 -10
- data/lib/vedeu/dsl/line.rb +3 -4
- data/lib/vedeu/dsl/shared/text.rb +0 -3
- data/lib/vedeu/dsl/stream.rb +3 -4
- data/lib/vedeu/dsl/view.rb +0 -3
- data/lib/vedeu/events/event.rb +3 -3
- data/lib/vedeu/events/trigger.rb +3 -2
- data/lib/vedeu/geometry/area.rb +0 -1
- data/lib/vedeu/geometry/canvas.rb +0 -1
- data/lib/vedeu/geometry/coordinate.rb +6 -7
- data/lib/vedeu/geometry/dimension.rb +3 -2
- data/lib/vedeu/geometry/geometry.rb +0 -6
- data/lib/vedeu/geometry/grid.rb +3 -2
- data/lib/vedeu/geometry/index_position.rb +0 -1
- data/lib/vedeu/geometry/position.rb +0 -1
- data/lib/vedeu/geometry/position_index.rb +0 -1
- data/lib/vedeu/geometry/position_validator.rb +6 -68
- data/lib/vedeu/input/all.rb +0 -2
- data/lib/vedeu/input/input.rb +3 -2
- data/lib/vedeu/input/key.rb +0 -1
- data/lib/vedeu/input/keymap.rb +4 -7
- data/lib/vedeu/input/mapper.rb +3 -2
- data/lib/vedeu/launcher.rb +3 -2
- data/lib/vedeu/main_loop.rb +1 -1
- data/lib/vedeu/models/cell.rb +0 -1
- data/lib/vedeu/models/char.rb +0 -1
- data/lib/vedeu/models/composition.rb +1 -7
- data/lib/vedeu/models/group.rb +0 -3
- data/lib/vedeu/models/interface.rb +0 -3
- data/lib/vedeu/models/line.rb +0 -4
- data/lib/vedeu/models/menu.rb +5 -8
- data/lib/vedeu/models/stream.rb +0 -4
- data/lib/vedeu/null/all.rb +11 -0
- data/lib/vedeu/null/border.rb +3 -1
- data/lib/vedeu/null/buffer.rb +0 -1
- data/lib/vedeu/null/generic.rb +4 -1
- data/lib/vedeu/null/geometry.rb +0 -1
- data/lib/vedeu/null/interface.rb +36 -7
- data/lib/vedeu/output/background.rb +0 -1
- data/lib/vedeu/output/border.rb +1 -6
- data/lib/vedeu/output/clear.rb +3 -2
- data/lib/vedeu/output/colour.rb +6 -18
- data/lib/vedeu/output/compressor.rb +5 -2
- data/lib/vedeu/output/esc.rb +4 -1
- data/lib/vedeu/output/foreground.rb +0 -5
- data/lib/vedeu/output/html_char.rb +3 -2
- data/lib/vedeu/output/output.rb +1 -5
- data/lib/vedeu/output/refresh.rb +1 -1
- data/lib/vedeu/output/renderers/all.rb +0 -1
- data/lib/vedeu/output/renderers/escape_sequence.rb +3 -2
- data/lib/vedeu/output/renderers/file.rb +85 -80
- data/lib/vedeu/output/renderers/html.rb +77 -72
- data/lib/vedeu/output/renderers/json.rb +45 -42
- data/lib/vedeu/output/renderers/null.rb +11 -8
- data/lib/vedeu/output/renderers/terminal.rb +41 -36
- data/lib/vedeu/output/renderers/text.rb +41 -36
- data/lib/vedeu/output/style.rb +0 -3
- data/lib/vedeu/output/text.rb +3 -2
- data/lib/vedeu/output/viewport.rb +3 -2
- data/lib/vedeu/output/virtual_terminal.rb +0 -1
- data/lib/vedeu/output/wordwrap.rb +3 -2
- data/lib/vedeu/repositories/all.rb +7 -6
- data/lib/vedeu/repositories/collection.rb +0 -1
- data/lib/vedeu/repositories/collections/chars.rb +0 -1
- data/lib/vedeu/repositories/collections/events.rb +0 -1
- data/lib/vedeu/repositories/collections/interfaces.rb +0 -1
- data/lib/vedeu/repositories/collections/keys.rb +0 -1
- data/lib/vedeu/repositories/collections/lines.rb +0 -1
- data/lib/vedeu/repositories/collections/streams.rb +0 -1
- data/lib/vedeu/repositories/model.rb +0 -1
- data/lib/vedeu/repositories/registerable.rb +29 -0
- data/lib/vedeu/repositories/repositories/background_colours.rb +0 -1
- data/lib/vedeu/repositories/repositories/borders.rb +2 -13
- data/lib/vedeu/repositories/repositories/buffers.rb +2 -13
- data/lib/vedeu/repositories/repositories/colours.rb +0 -1
- data/lib/vedeu/repositories/repositories/cursors.rb +1 -2
- data/lib/vedeu/repositories/repositories/events_repository.rb +0 -1
- data/lib/vedeu/repositories/repositories/foreground_colours.rb +0 -1
- data/lib/vedeu/repositories/repositories/geometries.rb +2 -13
- data/lib/vedeu/repositories/repositories/groups.rb +1 -2
- data/lib/vedeu/repositories/repositories/interfaces_repository.rb +2 -14
- data/lib/vedeu/repositories/repositories/keymaps.rb +1 -2
- data/lib/vedeu/repositories/repositories/menus.rb +1 -2
- data/lib/vedeu/repositories/repository.rb +14 -5
- data/lib/vedeu/storage/all.rb +0 -1
- data/lib/vedeu/storage/associative_store.rb +0 -1
- data/lib/vedeu/storage/conveyor_store.rb +0 -1
- data/lib/vedeu/storage/fifo_store.rb +0 -1
- data/lib/vedeu/support/log.rb +0 -3
- data/lib/vedeu/support/options.rb +3 -2
- data/lib/vedeu/support/template.rb +3 -4
- data/lib/vedeu/support/terminal.rb +0 -2
- data/lib/vedeu/support/trace.rb +6 -7
- data/lib/vedeu/support/visibility.rb +1 -2
- data/lib/vedeu.rb +3 -5
- data/test/lib/vedeu/buffers/buffer_test.rb +48 -13
- data/test/lib/vedeu/configuration/cli_test.rb +5 -4
- data/test/lib/vedeu/cursor/refresh_cursor_test.rb +37 -15
- data/test/lib/vedeu/distributed/subprocess_test.rb +1 -0
- data/test/lib/vedeu/dsl/shared/use_test.rb +1 -6
- data/test/lib/vedeu/main_loop_test.rb +11 -0
- data/test/lib/vedeu/null/interface_test.rb +27 -0
- data/test/lib/vedeu/output/output_test.rb +17 -10
- data/test/lib/vedeu/output/presentation_test.rb +35 -7
- data/test/lib/vedeu/output/renderers/escape_sequence_test.rb +50 -0
- data/test/lib/vedeu/output/renderers/file_test.rb +34 -30
- data/test/lib/vedeu/output/renderers/html_test.rb +61 -57
- data/test/lib/vedeu/output/renderers/json_test.rb +40 -36
- data/test/lib/vedeu/output/renderers/null_test.rb +12 -8
- data/test/lib/vedeu/output/renderers/terminal_test.rb +17 -13
- data/test/lib/vedeu/output/renderers/text_test.rb +17 -13
- data/test/lib/vedeu/repositories/model_test.rb +1 -1
- data/test/lib/vedeu/repositories/registerable_test.rb +28 -0
- data/test/lib/vedeu/storage/associative_store_test.rb +7 -0
- data/test/lib/vedeu/storage/conveyor_store_test.rb +7 -0
- data/test/lib/vedeu/storage/fifo_store_test.rb +7 -0
- data/test/support/helpers/model_test_class.rb +6 -2
- data/test/test_helper.rb +2 -0
- data/vedeu.gemspec +3 -2
- metadata +23 -6
- data/test/lib/vedeu/output/renderers/escape_sequence_renderer_test.rb +0 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dab76c44fae79844ccc5b6321392ee99a09c23d0
|
4
|
+
data.tar.gz: 43162ef0fdcf20ba49b09957d32316379e3e0583
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9774a3562701e47aaacc997d01dd157ce021c46b688adda4f56b4cdffb323c918189bc1038b0af46031aa858825449b865eb77b37b41d482aa106e6120f406e
|
7
|
+
data.tar.gz: 222d43c099bf843b27b616536b10b0cc316c6c0cb9bb09e06606ffd00362aa2ee02eb79f84cd09c4ac437d94270df33ec88a1fd4e328d0a6d22e8f9259b104a2
|
data/.rubocop.yml
CHANGED
data/Rakefile
CHANGED
data/bin/vedeu_drb_server
CHANGED
data/bin/vedeu_test
CHANGED
data/config/rubocop_enabled.yml
CHANGED
@@ -161,7 +161,7 @@ Style/DeprecatedHashMethods:
|
|
161
161
|
|
162
162
|
Style/Documentation:
|
163
163
|
Description: 'Document classes and non-namespace modules.'
|
164
|
-
Enabled:
|
164
|
+
Enabled: false
|
165
165
|
|
166
166
|
Style/DotPosition:
|
167
167
|
Description: 'Checks the position of the dot in multi-line method calls.'
|
data/examples/borders_app.rb
CHANGED
data/examples/colours_app.rb
CHANGED
data/examples/cursor_app.rb
CHANGED
data/examples/drb_app.rb
CHANGED
data/examples/geometry_app.rb
CHANGED
data/examples/hello_world.rb
CHANGED
data/examples/lines_app.rb
CHANGED
data/lib/vedeu/api.rb
CHANGED
data/lib/vedeu/application.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
3
|
# Orchestrates the running of the main application loop.
|
4
|
-
#
|
5
4
|
class Application
|
6
5
|
|
7
6
|
# @param (see #initialize)
|
@@ -64,12 +63,14 @@ module Vedeu
|
|
64
63
|
output
|
65
64
|
end
|
66
65
|
|
67
|
-
|
66
|
+
protected
|
68
67
|
|
69
68
|
# @!attribute [r] configuration
|
70
69
|
# @return [Configuration]
|
71
70
|
attr_reader :configuration
|
72
71
|
|
72
|
+
private
|
73
|
+
|
73
74
|
# Runs the application loop either once, or forever (exceptions and signals
|
74
75
|
# permitting).
|
75
76
|
#
|
data/lib/vedeu/bindings.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'vedeu/events/event'
|
2
|
-
|
3
1
|
module Vedeu
|
4
2
|
|
5
3
|
# Creates system events which when called provide a variety of core functions
|
@@ -171,9 +169,9 @@ module Vedeu
|
|
171
169
|
# Clears the whole terminal space, or the named interface area to be cleared
|
172
170
|
# if given.
|
173
171
|
Vedeu.bind(:_clear_) do |name|
|
174
|
-
if name
|
175
|
-
Vedeu::Clear.clear(Vedeu.interfaces.
|
176
|
-
|
172
|
+
if name
|
173
|
+
Vedeu::Clear.clear(Vedeu.interfaces.by_name(name),
|
174
|
+
clear_border: true, use_terminal_colours: true)
|
177
175
|
|
178
176
|
else
|
179
177
|
Vedeu::Terminal.virtual.clear if Vedeu::Configuration.drb?
|
data/lib/vedeu/buffers/buffer.rb
CHANGED
@@ -1,10 +1,7 @@
|
|
1
|
-
require 'vedeu/repositories/model'
|
2
|
-
|
3
1
|
module Vedeu
|
4
2
|
|
5
3
|
# The Buffer object represents the states of display for an interface. The
|
6
4
|
# states are 'front', 'back' and 'previous'.
|
7
|
-
#
|
8
5
|
class Buffer
|
9
6
|
|
10
7
|
include Vedeu::Model
|
@@ -76,10 +73,10 @@ module Vedeu
|
|
76
73
|
|
77
74
|
# @return [void]
|
78
75
|
def hide
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
76
|
+
return nil unless visible?
|
77
|
+
|
78
|
+
Vedeu::Visibility.hide(interface)
|
79
|
+
clear
|
83
80
|
end
|
84
81
|
|
85
82
|
# Return the content for this buffer.
|
@@ -103,10 +100,10 @@ module Vedeu
|
|
103
100
|
|
104
101
|
# @return [void]
|
105
102
|
def show
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
103
|
+
return nil if visible?
|
104
|
+
|
105
|
+
Vedeu::Visibility.show(interface)
|
106
|
+
render
|
110
107
|
end
|
111
108
|
|
112
109
|
private
|
@@ -1,12 +1,9 @@
|
|
1
|
-
require 'vedeu/support/common'
|
2
|
-
|
3
1
|
module Vedeu
|
4
2
|
|
5
3
|
module Config
|
6
4
|
|
7
5
|
# The Configuration::API class parses client application configuration into
|
8
6
|
# options used by Vedeu to affect certain behaviours.
|
9
|
-
#
|
10
7
|
class API
|
11
8
|
|
12
9
|
include Vedeu::Common
|
@@ -225,7 +222,7 @@ module Vedeu
|
|
225
222
|
# @param value [Boolean]
|
226
223
|
# @return [Boolean]
|
227
224
|
def trace!(value = true)
|
228
|
-
options[:debug] = true if value
|
225
|
+
options[:debug] = true if value
|
229
226
|
options[:trace] = value
|
230
227
|
end
|
231
228
|
alias_method :trace, :trace!
|
@@ -4,7 +4,6 @@ module Vedeu
|
|
4
4
|
|
5
5
|
# The Configuration::CLI class parses command-line arguments using
|
6
6
|
# OptionParser into options used by Vedeu to affect certain behaviours.
|
7
|
-
#
|
8
7
|
class CLI
|
9
8
|
|
10
9
|
# @param (see #initialize)
|
@@ -28,107 +27,187 @@ module Vedeu
|
|
28
27
|
#
|
29
28
|
# @return [Hash]
|
30
29
|
def configuration
|
31
|
-
|
32
|
-
opts.banner = "Usage: #{$PROGRAM_NAME} [options]"
|
30
|
+
setup!
|
33
31
|
|
34
|
-
|
35
|
-
'Run the application in interactive mode (default).') do
|
36
|
-
options[:interactive] = true
|
37
|
-
end
|
32
|
+
parser.parse!(args)
|
38
33
|
|
39
|
-
|
40
|
-
|
41
|
-
'i.e. not requiring intervention from the user.') do
|
42
|
-
options[:interactive] = false
|
43
|
-
end
|
34
|
+
Vedeu::Config.log(Esc.blue { '[cli]' }, options)
|
35
|
+
end
|
44
36
|
|
45
|
-
|
46
|
-
'Run the application loop once.') do
|
47
|
-
options[:once] = true
|
48
|
-
end
|
37
|
+
protected
|
49
38
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
end
|
39
|
+
# @!attribute [r] args
|
40
|
+
# @return [Array<String>]
|
41
|
+
attr_reader :args
|
54
42
|
|
55
|
-
|
56
|
-
|
57
|
-
|
43
|
+
# @!attribute [r] options
|
44
|
+
# @return [Hash]
|
45
|
+
attr_reader :options
|
58
46
|
|
59
|
-
|
60
|
-
options[:terminal_mode] = :raw
|
61
|
-
end
|
47
|
+
private
|
62
48
|
|
63
|
-
|
64
|
-
|
65
|
-
|
49
|
+
# @return [void]
|
50
|
+
def setup!
|
51
|
+
([:banner] + allowed_options).each { |opt| send(opt) }
|
52
|
+
end
|
66
53
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
end
|
54
|
+
# @return [OptionParser]
|
55
|
+
def parser
|
56
|
+
@parser ||= OptionParser.new
|
57
|
+
end
|
72
58
|
|
73
|
-
|
59
|
+
# @return [Array<Symbol>]
|
60
|
+
def allowed_options
|
61
|
+
[
|
62
|
+
:colour_mode,
|
63
|
+
:cooked,
|
64
|
+
:debug,
|
65
|
+
:drb,
|
66
|
+
:drb_height,
|
67
|
+
:drb_host,
|
68
|
+
:drb_port,
|
69
|
+
:drb_width,
|
70
|
+
:interactive,
|
71
|
+
:log,
|
72
|
+
:raw,
|
73
|
+
:run_many,
|
74
|
+
:run_once,
|
75
|
+
:standalone,
|
76
|
+
:trace,
|
77
|
+
]
|
78
|
+
end
|
79
|
+
|
80
|
+
# @return [String]
|
81
|
+
def banner
|
82
|
+
parser.banner = "Usage: #{$PROGRAM_NAME} [options]"
|
83
|
+
end
|
84
|
+
|
85
|
+
# @return [OptionParser]
|
86
|
+
def colour_mode
|
87
|
+
parser.on('-C', '--colour-mode [COLOURS]', Integer,
|
74
88
|
'Run application in either `8`, `16`, `256` or `16777216` ' \
|
75
89
|
'colour mode.') do |colours|
|
76
|
-
|
77
|
-
|
90
|
+
if [8, 16, 256, 16_777_216].include?(colours)
|
91
|
+
options[:colour_mode] = colours
|
78
92
|
|
79
|
-
|
80
|
-
|
93
|
+
else
|
94
|
+
options[:colour_mode] = 8
|
81
95
|
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
opts.on('-l', '--log [FILENAME]', String,
|
86
|
-
'Specify the path for the log file.') do |filename|
|
87
|
-
options[:log] = filename
|
88
96
|
end
|
97
|
+
end
|
98
|
+
end
|
89
99
|
|
90
|
-
|
91
|
-
|
92
|
-
|
100
|
+
# @return [OptionParser]
|
101
|
+
def cooked
|
102
|
+
parser.on('-c', '--cooked', 'Run application in cooked mode.') do
|
103
|
+
options[:terminal_mode] = :cooked
|
104
|
+
end
|
105
|
+
end
|
93
106
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
107
|
+
# @return [OptionParser]
|
108
|
+
def debug
|
109
|
+
parser.on('-d', '--debug', 'Run application with debugging on.') do
|
110
|
+
options[:debug] = true
|
111
|
+
end
|
112
|
+
end
|
99
113
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
114
|
+
# @return [OptionParser]
|
115
|
+
def drb
|
116
|
+
parser.on('--drb', 'Run application with DRb on.') do
|
117
|
+
options[:drb] = true
|
118
|
+
end
|
119
|
+
end
|
104
120
|
|
105
|
-
|
121
|
+
# @return [OptionParser]
|
122
|
+
def drb_height
|
123
|
+
parser.on('--drb-height',
|
106
124
|
'Set the height for fake terminal.') do |height|
|
107
|
-
|
108
|
-
|
109
|
-
|
125
|
+
# options[:drb] = true
|
126
|
+
options[:drb_height] = height
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
# @return [OptionParser]
|
131
|
+
def drb_host
|
132
|
+
parser.on('--drb-host',
|
133
|
+
'Set the hostname/IP for the DRb server.') do |hostname|
|
134
|
+
# options[:drb] = true
|
135
|
+
options[:drb_host] = hostname
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
# @return [OptionParser]
|
140
|
+
def drb_port
|
141
|
+
parser.on('--drb-port', 'Set the port for the DRb server.') do |port|
|
142
|
+
# options[:drb] = true
|
143
|
+
options[:drb_port] = port
|
144
|
+
end
|
145
|
+
end
|
110
146
|
|
111
|
-
|
147
|
+
# @return [OptionParser]
|
148
|
+
def drb_width
|
149
|
+
parser.on('--drb-width',
|
112
150
|
'Set the width for fake terminal.') do |width|
|
113
|
-
|
114
|
-
|
115
|
-
end
|
151
|
+
# options[:drb] = true
|
152
|
+
options[:drb_width] = width
|
116
153
|
end
|
154
|
+
end
|
117
155
|
|
118
|
-
|
156
|
+
# @return [OptionParser]
|
157
|
+
def interactive
|
158
|
+
parser.on('-i', '--interactive',
|
159
|
+
'Run the application in interactive mode (default).') do
|
160
|
+
options[:interactive] = true
|
161
|
+
end
|
162
|
+
end
|
119
163
|
|
120
|
-
|
164
|
+
# @return [OptionParser]
|
165
|
+
def log
|
166
|
+
parser.on('-l', '--log [FILENAME]', String,
|
167
|
+
'Specify the path for the log file.') do |filename|
|
168
|
+
options[:log] = filename
|
169
|
+
end
|
121
170
|
end
|
122
171
|
|
123
|
-
|
172
|
+
# @return [OptionParser]
|
173
|
+
def raw
|
174
|
+
parser.on('-r', '--raw', 'Run application in raw mode (default).') do
|
175
|
+
options[:terminal_mode] = :raw
|
176
|
+
end
|
177
|
+
end
|
124
178
|
|
125
|
-
#
|
126
|
-
|
127
|
-
|
179
|
+
# @return [OptionParser]
|
180
|
+
def run_many
|
181
|
+
parser.on('-n', '--run-many',
|
182
|
+
'Run the application loop continuously (default).') do
|
183
|
+
options[:once] = false
|
184
|
+
end
|
185
|
+
end
|
128
186
|
|
129
|
-
#
|
130
|
-
|
131
|
-
|
187
|
+
# @return [OptionParser]
|
188
|
+
def run_once
|
189
|
+
parser.on('-1', '--run-once', 'Run the application loop once.') do
|
190
|
+
options[:once] = true
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
# @return [OptionParser]
|
195
|
+
def standalone
|
196
|
+
parser.on('-I', '--noninteractive', '--standalone',
|
197
|
+
'Run the application non-interactively; ' \
|
198
|
+
'i.e. not requiring intervention from the user.') do
|
199
|
+
options[:interactive] = false
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
# @return [OptionParser]
|
204
|
+
def trace
|
205
|
+
parser.on('-D', '--trace', 'Run application with debugging on with ' \
|
206
|
+
'method and event tracing (noisy!).') do
|
207
|
+
options[:debug] = true
|
208
|
+
options[:trace] = true
|
209
|
+
end
|
210
|
+
end
|
132
211
|
|
133
212
|
end # CLI
|
134
213
|
|
data/lib/vedeu/cursor/cursor.rb
CHANGED
data/lib/vedeu/cursor/move.rb
CHANGED
@@ -1,7 +1,3 @@
|
|
1
|
-
require 'vedeu/cursor/cursor'
|
2
|
-
require 'vedeu/geometry/coordinate'
|
3
|
-
require 'vedeu/geometry/position_validator'
|
4
|
-
|
5
1
|
module Vedeu
|
6
2
|
|
7
3
|
# Adjusts the position of the cursor. To use this class, call the appropriate
|
@@ -32,7 +28,6 @@ module Vedeu
|
|
32
28
|
# The cursor will not exceed the border or boundary of the interface.
|
33
29
|
# The cursor will move freely within the bounds of the interface,
|
34
30
|
# irrespective of content.
|
35
|
-
#
|
36
31
|
class Move
|
37
32
|
|
38
33
|
extend Forwardable
|
@@ -122,7 +117,7 @@ module Vedeu
|
|
122
117
|
cursor
|
123
118
|
end
|
124
119
|
|
125
|
-
|
120
|
+
protected
|
126
121
|
|
127
122
|
# @!attribute [r] dx
|
128
123
|
# @return [Fixnum]
|
@@ -136,6 +131,8 @@ module Vedeu
|
|
136
131
|
# @return [String]
|
137
132
|
attr_reader :name
|
138
133
|
|
134
|
+
private
|
135
|
+
|
139
136
|
# @return [Hash<Symbol => Fixnum, String>]
|
140
137
|
def attributes
|
141
138
|
cursor.attributes
|
@@ -2,7 +2,6 @@ module Vedeu
|
|
2
2
|
|
3
3
|
# Handle the refreshing (redrawing) of a cursor, without redrawing the whole
|
4
4
|
# interface; unless the cursor's offset has caused the view to change.
|
5
|
-
#
|
6
5
|
class RefreshCursor
|
7
6
|
|
8
7
|
extend Forwardable
|
@@ -37,12 +36,14 @@ module Vedeu
|
|
37
36
|
Vedeu::Terminal.output(new_cursor.to_s)
|
38
37
|
end
|
39
38
|
|
40
|
-
|
39
|
+
protected
|
41
40
|
|
42
41
|
# @!attribute [r] name
|
43
42
|
# @return [String]
|
44
43
|
attr_reader :name
|
45
44
|
|
45
|
+
private
|
46
|
+
|
46
47
|
# @return [Boolean]
|
47
48
|
def refresh_view?
|
48
49
|
new_cursor.ox >= width || new_cursor.oy >= height
|
@@ -71,6 +72,15 @@ module Vedeu
|
|
71
72
|
@cursor ||= Vedeu.cursors.by_name(name)
|
72
73
|
end
|
73
74
|
|
75
|
+
# Fetch the border by name.
|
76
|
+
#
|
77
|
+
# @note
|
78
|
+
# Vedeu::Border is used in this way because if there is not a border
|
79
|
+
# defined, it will fallback to a Vedeu::Null::Border which uses
|
80
|
+
# Vedeu::Geometry to determine it's dimensions based on the name also.
|
81
|
+
# When a Vedeu::Geometry cannot be found, this falls back to a
|
82
|
+
# Vedeu::Null::Geometry which uses the current terminal's dimensions.
|
83
|
+
#
|
74
84
|
# @return (see Vedeu::Borders#by_name)
|
75
85
|
def border
|
76
86
|
@border ||= Vedeu.borders.by_name(name)
|
@@ -8,7 +8,6 @@ module Vedeu
|
|
8
8
|
# client = Vedeu::Distributed::Client.connect("druby://localhost:21420")
|
9
9
|
# client.input('a')
|
10
10
|
# client.output # => 'some content...'
|
11
|
-
#
|
12
11
|
class Client
|
13
12
|
|
14
13
|
# @param (see #initialize)
|
@@ -84,12 +83,14 @@ module Vedeu
|
|
84
83
|
:shutdown
|
85
84
|
end
|
86
85
|
|
87
|
-
|
86
|
+
protected
|
88
87
|
|
89
88
|
# @!attribute [r] uri
|
90
89
|
# @return [String]
|
91
90
|
attr_reader :uri
|
92
91
|
|
92
|
+
private
|
93
|
+
|
93
94
|
# @return [void]
|
94
95
|
def server
|
95
96
|
@server ||= DRbObject.new_with_uri(uri)
|