vedeu 0.2.9 → 0.2.10
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/LICENSE.txt +0 -3
- data/examples/configuration_app.rb +50 -0
- data/examples/cursor_app/cursor_app.rb +8 -3
- data/examples/focus_app.rb +5 -5
- data/examples/hello_world.rb +4 -4
- data/examples/lines_app/lines_app.rb +8 -3
- data/lib/vedeu.rb +2 -0
- data/lib/vedeu/api/api.rb +2 -2
- data/lib/vedeu/application.rb +1 -1
- data/lib/vedeu/configuration/api.rb +24 -9
- data/lib/vedeu/configuration/cli.rb +13 -12
- data/lib/vedeu/configuration/configuration.rb +135 -131
- data/lib/vedeu/input/input.rb +2 -0
- data/lib/vedeu/models/colour.rb +2 -0
- data/lib/vedeu/models/event.rb +8 -0
- data/lib/vedeu/support/log.rb +18 -119
- data/lib/vedeu/support/registrar.rb +12 -3
- data/test/lib/vedeu/api/interface_test.rb +10 -2
- data/test/lib/vedeu/configuration/api_test.rb +13 -5
- data/test/lib/vedeu/configuration/cli_test.rb +88 -78
- data/test/lib/vedeu/configuration/configuration_test.rb +14 -5
- data/test/lib/vedeu/models/menu_test.rb +3 -1
- data/test/lib/vedeu/output/compositor_test.rb +12 -11
- data/test/lib/vedeu/support/position_test.rb +3 -1
- data/test/lib/vedeu/support/refresh_test.rb +2 -2
- data/test/lib/vedeu/support/registrar_test.rb +8 -0
- data/test/lib/vedeu/support/repository_test.rb +8 -3
- data/test/lib/vedeu/support/trace_test.rb +3 -1
- data/test/test_helper.rb +12 -4
- data/vedeu.gemspec +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bff39cd80bb0bca7448d6cf083f2115665e55054
|
4
|
+
data.tar.gz: 93bc4d77d71b14632868a4389f150c7a48b15e31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c51486199b28763e4fee45eb2dcf7404bc4cd35c308237ad475dbd051d2ddbe826b8d3201e2abe5716eb24149cb14ffcde30512f0732c89e4c10d604d49146b
|
7
|
+
data.tar.gz: 1b4d18498d51ed6653501b017ecefd09e42daaaffd797c3e5a6f66ee204784938de563df224700624ffd22a786396c81c65e62c27365680f77eadec734383e2b
|
data/LICENSE.txt
CHANGED
@@ -1,7 +1,4 @@
|
|
1
1
|
Copyright (c) 2014 Gavin Laking
|
2
|
-
Copyright (c) 2013 Steve Klabnik - Monologger
|
3
|
-
(https://github.com/steveklabnik/mono_logger)
|
4
|
-
Note: Code used inline in Vedeu::Log.
|
5
2
|
Copyright (c) 2013 Michael Grosser - Ruco
|
6
3
|
(https://github.com/grosser/ruco)
|
7
4
|
Note: Code from ruco's Window class was used as basis of
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
lib_dir = File.dirname(__FILE__) + '/../lib'
|
4
|
+
$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
5
|
+
|
6
|
+
-> { its -> { a } }
|
7
|
+
trap('INT') { exit! }
|
8
|
+
|
9
|
+
require 'vedeu'
|
10
|
+
|
11
|
+
# This example application shows how configuration works.
|
12
|
+
#
|
13
|
+
# First, we use the configuration API to switch debugging on, and set the
|
14
|
+
# logging to go to a file in the /tmp directory.
|
15
|
+
#
|
16
|
+
# By passing the arguments: --log /path/to/log_file.log when executing this
|
17
|
+
# example, we can demonstrate that the client application configuration is
|
18
|
+
# overridden by command line arguments.
|
19
|
+
#
|
20
|
+
# Use 'space' to refresh, 'q' to exit.
|
21
|
+
class VedeuConfigurationApp
|
22
|
+
include Vedeu
|
23
|
+
|
24
|
+
configure do
|
25
|
+
debug!
|
26
|
+
log '/tmp/vedeu_configuration_app.log'
|
27
|
+
end
|
28
|
+
|
29
|
+
interface 'config' do
|
30
|
+
width 40
|
31
|
+
height 2
|
32
|
+
centred!
|
33
|
+
end
|
34
|
+
|
35
|
+
render do
|
36
|
+
view 'config' do
|
37
|
+
line Configuration.log.inspect + " " + Process.pid.to_s
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
keys('config') do
|
42
|
+
key(' ') { Vedeu.trigger(:_refresh_config_) }
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.start(argv = ARGV)
|
46
|
+
Vedeu::Launcher.new(argv).execute!
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
VedeuConfigurationApp.start(ARGV)
|
@@ -104,9 +104,14 @@ class VedeuCursorApp
|
|
104
104
|
|
105
105
|
focus('iron') # not working right?!
|
106
106
|
|
107
|
-
|
108
|
-
|
107
|
+
Vedeu.configure do
|
108
|
+
debug!
|
109
|
+
log '/tmp/vedeu_cursor_app.log'
|
110
|
+
end
|
111
|
+
|
112
|
+
def self.start(argv = ARGV)
|
113
|
+
Vedeu::Launcher.new(argv).execute!
|
109
114
|
end
|
110
115
|
end
|
111
116
|
|
112
|
-
VedeuCursorApp.start
|
117
|
+
VedeuCursorApp.start(ARGV)
|
data/examples/focus_app.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
lib_dir = File.dirname(__FILE__) + '
|
3
|
+
lib_dir = File.dirname(__FILE__) + '/../lib'
|
4
4
|
$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
5
5
|
|
6
6
|
-> { its -> { a } }
|
@@ -15,7 +15,7 @@ require 'vedeu'
|
|
15
15
|
#
|
16
16
|
# The focus order is: copper, aluminium, boron, dubnium, status.
|
17
17
|
#
|
18
|
-
# Use 'space' to change focus.
|
18
|
+
# Use 'space' to change focus, 'q' to exit.
|
19
19
|
class VedeuFocusApp
|
20
20
|
include Vedeu
|
21
21
|
|
@@ -84,9 +84,9 @@ class VedeuFocusApp
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
-
def self.start
|
88
|
-
Vedeu::Launcher.new(
|
87
|
+
def self.start(argv = ARGV)
|
88
|
+
Vedeu::Launcher.new(argv).execute!
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
|
-
VedeuFocusApp.start
|
92
|
+
VedeuFocusApp.start(ARGV)
|
data/examples/hello_world.rb
CHANGED
@@ -13,7 +13,7 @@ class HelloWorldApp
|
|
13
13
|
|
14
14
|
configure do
|
15
15
|
debug!
|
16
|
-
log '/tmp/
|
16
|
+
log '/tmp/vedeu_hello_world.log'
|
17
17
|
end
|
18
18
|
|
19
19
|
event(:_initialize_) { Vedeu.trigger(:_refresh_) }
|
@@ -34,9 +34,9 @@ class HelloWorldApp
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
def self.start
|
38
|
-
Vedeu::Launcher.execute!
|
37
|
+
def self.start(argv = ARGV)
|
38
|
+
Vedeu::Launcher.new(argv).execute!
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
HelloWorldApp.start
|
42
|
+
HelloWorldApp.start(ARGV)
|
@@ -52,9 +52,14 @@ class VedeuLinesApp
|
|
52
52
|
|
53
53
|
focus 'ruthenium'
|
54
54
|
|
55
|
-
|
56
|
-
|
55
|
+
Vedeu.configure do
|
56
|
+
debug!
|
57
|
+
log '/tmp/vedeu_lines_app.log'
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.start(argv = ARGV)
|
61
|
+
Vedeu::Launcher.new(argv).execute!
|
57
62
|
end
|
58
63
|
end
|
59
64
|
|
60
|
-
VedeuLinesApp.start
|
65
|
+
VedeuLinesApp.start(ARGV)
|
data/lib/vedeu.rb
CHANGED
data/lib/vedeu/api/api.rb
CHANGED
@@ -133,11 +133,11 @@ module Vedeu
|
|
133
133
|
Vedeu::Keymaps.use(key)
|
134
134
|
end
|
135
135
|
|
136
|
-
# Write a message to the Vedeu log file
|
136
|
+
# Write a message to the Vedeu log file.
|
137
137
|
#
|
138
138
|
# @param message [String] The message you wish to emit to the log
|
139
139
|
# file, useful for debugging.
|
140
|
-
# @param force [Boolean] When evaluates to true will
|
140
|
+
# @param force [Boolean] When evaluates to true will attempt to
|
141
141
|
# write to the log file regardless of the Configuration setting.
|
142
142
|
#
|
143
143
|
# @example
|
data/lib/vedeu/application.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
|
-
module
|
3
|
+
module Config
|
4
4
|
|
5
5
|
# The Configuration::API class parses client application configuration into
|
6
6
|
# options used by Vedeu to affect certain behaviours.
|
@@ -36,8 +36,10 @@ module Vedeu
|
|
36
36
|
#
|
37
37
|
# @return [Hash]
|
38
38
|
def configuration
|
39
|
-
if
|
40
|
-
options.merge({
|
39
|
+
if system_keys.any?
|
40
|
+
options.merge({
|
41
|
+
system_keys: Configuration.default_system_keys.merge(system_keys)
|
42
|
+
})
|
41
43
|
|
42
44
|
else
|
43
45
|
options
|
@@ -206,6 +208,19 @@ module Vedeu
|
|
206
208
|
options[:colour_mode] = value
|
207
209
|
end
|
208
210
|
|
211
|
+
# Sets the location of the log file.
|
212
|
+
#
|
213
|
+
# @example
|
214
|
+
# Vedeu.configure do
|
215
|
+
# log '/var/log/vedeu.log'
|
216
|
+
# ...
|
217
|
+
#
|
218
|
+
# @param filename [String]
|
219
|
+
# @return [String]
|
220
|
+
def log(filename = '')
|
221
|
+
options[:log] = filename
|
222
|
+
end
|
223
|
+
|
209
224
|
# Sets the key used to exit the client application. The default is `q`.
|
210
225
|
#
|
211
226
|
# @example
|
@@ -224,7 +239,7 @@ module Vedeu
|
|
224
239
|
|
225
240
|
Vedeu.log("Configuration::API exit_key: #{value}")
|
226
241
|
|
227
|
-
|
242
|
+
system_keys[:exit] = value
|
228
243
|
end
|
229
244
|
|
230
245
|
# Sets the key used to switch focus to the next defined interface. The
|
@@ -246,7 +261,7 @@ module Vedeu
|
|
246
261
|
|
247
262
|
Vedeu.log("Configuration::API focus_next: #{value}")
|
248
263
|
|
249
|
-
|
264
|
+
system_keys[:focus_next] = value
|
250
265
|
end
|
251
266
|
|
252
267
|
# Sets the key used to switch focus to the previous interface. The default
|
@@ -268,7 +283,7 @@ module Vedeu
|
|
268
283
|
|
269
284
|
Vedeu.log("Configuration::API focus_prev: #{value}")
|
270
285
|
|
271
|
-
|
286
|
+
system_keys[:focus_prev] = value
|
272
287
|
end
|
273
288
|
|
274
289
|
# Sets the key used to switch between raw and cooked mode in Vedeu. The
|
@@ -290,7 +305,7 @@ module Vedeu
|
|
290
305
|
|
291
306
|
Vedeu.log("Configuration::API mode_switch: #{value}")
|
292
307
|
|
293
|
-
|
308
|
+
system_keys[:mode_switch] = value
|
294
309
|
end
|
295
310
|
|
296
311
|
private
|
@@ -307,8 +322,8 @@ module Vedeu
|
|
307
322
|
# hash if none were redefined.
|
308
323
|
#
|
309
324
|
# @return [Hash]
|
310
|
-
def
|
311
|
-
@
|
325
|
+
def system_keys
|
326
|
+
@_system_keys ||= {}
|
312
327
|
end
|
313
328
|
|
314
329
|
# Checks that the value provided to {#colour_mode} is valid.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
|
-
module
|
3
|
+
module Config
|
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.
|
@@ -15,7 +15,7 @@ module Vedeu
|
|
15
15
|
# @param args [Array]
|
16
16
|
# @return [Hash]
|
17
17
|
def self.configure(args = [])
|
18
|
-
new(args
|
18
|
+
new(args).configuration
|
19
19
|
end
|
20
20
|
|
21
21
|
# Returns an instance of Configuration::CLI.
|
@@ -23,7 +23,8 @@ module Vedeu
|
|
23
23
|
# @param args [Array]
|
24
24
|
# @return [Configuration::CLI]
|
25
25
|
def initialize(args = [])
|
26
|
-
@args
|
26
|
+
@args = args
|
27
|
+
@options = {}
|
27
28
|
end
|
28
29
|
|
29
30
|
# Returns the configuration options set up by parsing the command-line
|
@@ -104,7 +105,15 @@ module Vedeu
|
|
104
105
|
|
105
106
|
end
|
106
107
|
end
|
108
|
+
|
109
|
+
opts.on('-l', '--log [FILENAME]', String,
|
110
|
+
'Specify the path for the log file.') do |filename|
|
111
|
+
Vedeu.log("Configuration::CLI log: #{filename}")
|
112
|
+
|
113
|
+
options[:log] = filename
|
114
|
+
end
|
107
115
|
end
|
116
|
+
|
108
117
|
parser.parse!(args)
|
109
118
|
|
110
119
|
options
|
@@ -112,15 +121,7 @@ module Vedeu
|
|
112
121
|
|
113
122
|
private
|
114
123
|
|
115
|
-
attr_reader :args
|
116
|
-
|
117
|
-
# Returns the options set via command-line arguments parsed by
|
118
|
-
# OptionParser, or an empty Hash if none were set or parsed.
|
119
|
-
#
|
120
|
-
# @return [Hash]
|
121
|
-
def options
|
122
|
-
@_options ||= {}
|
123
|
-
end
|
124
|
+
attr_reader :args, :options
|
124
125
|
|
125
126
|
end # CLI
|
126
127
|
|
@@ -2,121 +2,160 @@ module Vedeu
|
|
2
2
|
|
3
3
|
# Allows the customisation of Vedeu's behaviour through the configuration API
|
4
4
|
# or command-line arguments.
|
5
|
-
|
5
|
+
#
|
6
6
|
# Provides access to Vedeu's configuration, which was set with sensible
|
7
7
|
# defaults (influenced by environment variables), overridden by client
|
8
8
|
# application settings (via the configuration API), or any command-line
|
9
9
|
# arguments provided.
|
10
10
|
#
|
11
11
|
# @api private
|
12
|
-
|
12
|
+
class Configuration
|
13
|
+
|
14
|
+
include Singleton
|
15
|
+
|
16
|
+
class << self
|
17
|
+
|
18
|
+
# Configure Vedeu with sensible defaults. If the client application sets
|
19
|
+
# options, override the defaults with those, and if command-line arguments
|
20
|
+
# are provided at application invocation, override any options with the
|
21
|
+
# arguments provided.
|
22
|
+
#
|
23
|
+
# @param args [Array]
|
24
|
+
# @param block [Proc]
|
25
|
+
# @return [Hash]
|
26
|
+
def configure(args = [], &block)
|
27
|
+
instance.configure(args, &block)
|
28
|
+
end
|
13
29
|
|
14
|
-
|
30
|
+
# Returns the chosen colour mode.
|
31
|
+
#
|
32
|
+
# @return [Fixnum]
|
33
|
+
def colour_mode
|
34
|
+
instance.options[:colour_mode]
|
35
|
+
end
|
15
36
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
37
|
+
# Returns whether debugging is enabled or disabled. Default is false;
|
38
|
+
# meaning nothing apart from warnings are written to the log file.
|
39
|
+
#
|
40
|
+
# @return [Boolean]
|
41
|
+
def debug?
|
42
|
+
instance.options[:debug]
|
43
|
+
end
|
44
|
+
alias_method :debug, :debug?
|
45
|
+
|
46
|
+
# Returns whether the application is interactive (required user input) or
|
47
|
+
# standalone (will run until terminates of natural causes.) Default is
|
48
|
+
# true; meaning the application will require user input.
|
49
|
+
#
|
50
|
+
# @return [Boolean]
|
51
|
+
def interactive?
|
52
|
+
instance.options[:interactive]
|
53
|
+
end
|
54
|
+
alias_method :interactive, :interactive?
|
26
55
|
|
27
|
-
|
56
|
+
# Returns the path to the log file.
|
57
|
+
#
|
58
|
+
# @return [String]
|
59
|
+
def log
|
60
|
+
instance.options[:log]
|
61
|
+
end
|
28
62
|
|
29
|
-
|
30
|
-
|
63
|
+
# Returns whether the application will run through its main loop once or
|
64
|
+
# not. Default is false; meaning the application will loop forever or
|
65
|
+
# until terminated by the user.
|
66
|
+
#
|
67
|
+
# @return [Boolean]
|
68
|
+
def once?
|
69
|
+
instance.options[:once]
|
70
|
+
end
|
71
|
+
alias_method :once, :once?
|
31
72
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
73
|
+
# Returns
|
74
|
+
#
|
75
|
+
# @return [Hash]
|
76
|
+
def system_keys
|
77
|
+
instance.options[:system_keys]
|
78
|
+
end
|
38
79
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
end
|
46
|
-
alias_method :debug, :debug?
|
80
|
+
# Returns the terminal mode for the application. Default is `:raw`.
|
81
|
+
#
|
82
|
+
# @return [Symbol]
|
83
|
+
def terminal_mode
|
84
|
+
instance.options[:terminal_mode]
|
85
|
+
end
|
47
86
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
87
|
+
# Returns whether tracing is enabled or disabled. Tracing is very noisy in
|
88
|
+
# the log file (logging method calls and events trigger). Default is
|
89
|
+
# false; meaning tracing is disabled.
|
90
|
+
#
|
91
|
+
# @return [Boolean]
|
92
|
+
def trace?
|
93
|
+
instance.options[:trace]
|
94
|
+
end
|
95
|
+
alias_method :trace, :trace?
|
96
|
+
|
97
|
+
# Vedeu's default system keys. Use {#system_keys}.
|
98
|
+
#
|
99
|
+
# @return [Hash]
|
100
|
+
def default_system_keys
|
101
|
+
{
|
102
|
+
exit: 'q',
|
103
|
+
focus_next: :tab,
|
104
|
+
focus_prev: :shift_tab,
|
105
|
+
mode_switch: :escape,
|
106
|
+
}
|
107
|
+
end
|
57
108
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
#
|
62
|
-
# @return [Boolean]
|
63
|
-
def once?
|
64
|
-
options[:once]
|
65
|
-
end
|
66
|
-
alias_method :once, :once?
|
109
|
+
def options=(value)
|
110
|
+
instance.options = value
|
111
|
+
end
|
67
112
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
end
|
113
|
+
# Reset the configuration to the default values.
|
114
|
+
#
|
115
|
+
# @return [Hash]
|
116
|
+
def reset!
|
117
|
+
# Vedeu::Log.logger.debug('Resetting configuration.')
|
74
118
|
|
75
|
-
|
76
|
-
|
77
|
-
# @return [Symbol]
|
78
|
-
def terminal_mode
|
79
|
-
options[:terminal_mode]
|
80
|
-
end
|
119
|
+
instance.reset!
|
120
|
+
end
|
81
121
|
|
82
|
-
#
|
83
|
-
|
84
|
-
|
85
|
-
#
|
86
|
-
# @return [Boolean]
|
87
|
-
def trace?
|
88
|
-
options[:trace]
|
89
|
-
end
|
90
|
-
alias_method :trace, :trace?
|
122
|
+
end # Configuration eigenclass
|
123
|
+
|
124
|
+
attr_reader :options
|
91
125
|
|
92
|
-
#
|
126
|
+
# Create a new singleton instance of Configuration.
|
93
127
|
#
|
94
|
-
# @return [
|
95
|
-
def
|
128
|
+
# @return [Configuration]
|
129
|
+
def initialize
|
96
130
|
@options = defaults
|
97
131
|
end
|
98
132
|
|
99
|
-
#
|
133
|
+
# Set up default configuration and then allow the client application to
|
134
|
+
# modify it via the configuration API. After this, process any command line
|
135
|
+
# arguments as potential configuration and apply that.
|
100
136
|
#
|
137
|
+
# @param args [Array]
|
138
|
+
# @param block [Proc]
|
101
139
|
# @return [Hash]
|
102
|
-
def
|
103
|
-
|
104
|
-
exit: 'q',
|
105
|
-
focus_next: :tab,
|
106
|
-
focus_prev: :shift_tab,
|
107
|
-
mode_switch: :escape,
|
108
|
-
}
|
109
|
-
end
|
140
|
+
def configure(args = [], &block)
|
141
|
+
@options.merge!(Config::API.configure(&block)) if block_given?
|
110
142
|
|
111
|
-
|
143
|
+
@options.merge!(Config::CLI.configure(args)) if args.any?
|
112
144
|
|
113
|
-
|
145
|
+
@options
|
146
|
+
end
|
147
|
+
|
148
|
+
# Reset the configuration to the default values.
|
114
149
|
#
|
115
150
|
# @return [Hash]
|
116
|
-
def
|
117
|
-
|
151
|
+
def reset!
|
152
|
+
# Vedeu::Log.logger.debug('Resetting configuration.')
|
153
|
+
|
154
|
+
@options = defaults
|
118
155
|
end
|
119
156
|
|
157
|
+
private
|
158
|
+
|
120
159
|
# The Vedeu default options, which of course are influenced by environment
|
121
160
|
# variables also.
|
122
161
|
#
|
@@ -124,64 +163,29 @@ module Vedeu
|
|
124
163
|
def defaults
|
125
164
|
{
|
126
165
|
colour_mode: detect_colour_mode,
|
127
|
-
debug:
|
166
|
+
debug: false,
|
128
167
|
interactive: true,
|
168
|
+
log: '/tmp/vedeu.log',
|
129
169
|
once: false,
|
130
|
-
system_keys: default_system_keys,
|
170
|
+
system_keys: Configuration.default_system_keys,
|
131
171
|
terminal_mode: :raw,
|
132
|
-
trace:
|
172
|
+
trace: false,
|
133
173
|
}
|
134
174
|
end
|
135
175
|
|
136
|
-
# Attempt to determine the terminal colour mode via environment
|
137
|
-
# or be optimistic and settle for 256 colours.
|
176
|
+
# Attempt to determine the terminal colour mode via $TERM environment
|
177
|
+
# variable, or be optimistic and settle for 256 colours.
|
138
178
|
#
|
139
179
|
# @return [Fixnum]
|
140
180
|
def detect_colour_mode
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
when /-truecolor$/ then 16777216
|
147
|
-
else 256
|
148
|
-
end
|
149
|
-
|
150
|
-
elsif ENV['TERM']
|
151
|
-
case ENV['TERM']
|
152
|
-
when /-256color$/, 'xterm' then 256
|
153
|
-
when /-color$/, 'rxvt' then 16
|
154
|
-
else 256
|
155
|
-
end
|
156
|
-
|
157
|
-
else
|
158
|
-
256
|
159
|
-
|
181
|
+
case ENV['TERM']
|
182
|
+
when /-truecolor$/ then 16777216
|
183
|
+
when /-256color$/, 'xterm' then 256
|
184
|
+
when /-color$/, 'rxvt' then 16
|
185
|
+
else 256
|
160
186
|
end
|
161
187
|
end
|
162
188
|
|
163
|
-
# Determine the debug mode via an environment variable.
|
164
|
-
#
|
165
|
-
# @return [Boolean]
|
166
|
-
def detect_debug_mode
|
167
|
-
return false if ENV['VEDEU_TESTMODE']
|
168
|
-
|
169
|
-
return true if ENV['VEDEU_DEBUG']
|
170
|
-
|
171
|
-
false
|
172
|
-
end
|
173
|
-
|
174
|
-
# Determine the trace mode via an environment variable.
|
175
|
-
#
|
176
|
-
# @return [Boolean]
|
177
|
-
def detect_trace_mode
|
178
|
-
return false if ENV['VEDEU_TESTMODE']
|
179
|
-
|
180
|
-
return true if ENV['VEDEU_TRACE']
|
181
|
-
|
182
|
-
false
|
183
|
-
end
|
184
|
-
|
185
189
|
end # Configuration
|
186
190
|
|
187
191
|
end # Vedeu
|