Vedeu Configuration
Vedeu provides a simple DSL for configuration.
Vedeu.configure do
# add configuration options here, each of which are listed
# below...
end
If you need to access the value of Vedeu's configuration for whatever reason, simply ask for it:
# => The current value of 'base_path'
Vedeu.config.base_path
Configuration Options
background
base_path
Override the base path for the application (for locating templates and other resources). By default the base path is just cwd but this will not work for many applications.
Vedeu.configure do
base_path '/path/to/application'
# ...
end
colour
Sets the background and foreground of the terminal.
Vedeu.configure do
colour background: '#ff0000', foreground: '#ffff00'
# ...
end
colour_mode
Sets the colour mode of the terminal.
Vedeu.configure do
colour_mode 256
# ...
end
compression / compression!
Compression reduces the number of escape sequences being sent to the terminal which improves redraw/render/refresh rate. By default it is enabled.
Sets boolean to enable/disable compression. Vedeu’s default setting is for compression to be enabled. Setting ‘compression` to false will disable compression.
Vedeu.configure do
compression! # enabled (default)
# ...
end
Vedeu.configure do
compression false
# ...
end
-
Be aware that running an application without compression will affect performance.
cooked / cooked!
Sets the terminal mode to ‘cooked`. Default terminal mode is `raw`. Also, see Vedeu::Config::API#raw!
Vedeu.configure do
cooked!
# ...
end
debug / debug!
Sets boolean to enable/disable debugging. Vedeu’s default setting is for debugging to be disabled. Using ‘debug!` or setting `debug` to true will enable debugging.
Enabling debugging will:
-
Enable ‘Vedeu::Logging::Timer` meaning various timing information is output to the log file.
-
Produce a full a backtrace to STDOUT and the log file upon unrecoverable error or unhandled exception.
Vedeu.configure do
debug! # ...
end
Vedeu.configure do
debug false # ...
end
drb / drb!
drb_host
drb_port
drb_height
Sets the height of the fake terminal in the DRb server.
Vedeu.configure do
drb_height 25
# ...
end
drb_width
Sets the width of the fake terminal in the DRb server.
Vedeu.configure do
drb_width 80
# ...
end
foreground
interactive / interactive!
log
Sets the location of the log file, or disables the log. By default, the log file is set to ‘/tmp/vedeu_bootstrap.log’.
# Log messages will be sent to the path given.
Vedeu.configure do
log '/var/log/vedeu.log'
# ...
end
# Log messages will be silently dropped.
Vedeu.configure do
log false
# ...
end
log_only
Only log specific message types. A complete list of message types can be found at Vedeu::Configuration.log_types.
Vedeu.configure do
log_only :debug, :event
# or
log_only [:debug, :info]
# ...
end
log_except
Log specific message types except those given. A complete list of message types can be found at Vedeu::Configuration.log_types.
Vedeu.configure do
log_except :debug, :event
# or
log_except [:debug, :info]
# ...
end
loggable?
Returns true if the given type was included in the :log_only configuration option or not included in the :log_except option.
profile / profile!
Sets boolean to enable/disable profiling. Vedeu’s default setting is for profiling to be disabled. Using ‘profile!` or setting `profile` to true will enable profiling.
Profile uses ‘ruby-prof’ to write a ‘vedeu_profile’ file to the /tmp directory which contains a call trace of the running application. Upon exit, this file can be examined to ascertain certain behaviours of Vedeu.
raw / raw!
Sets the terminal mode to ‘raw`. Default terminal mode is `raw`. Also, see Vedeu::Config::API#cooked!
Vedeu.configure do
raw!
# ...
end
renderer / renderers
Sets the renderers for Vedeu. Each renderer added must have the class method ‘.render’ defined as this will be called when rendering content.
Vedeu.configure do
renderer MyRenderer
# ...
end
Vedeu.configure do
renderers MyRenderer, MyOtherRenderer
# ...
end
root
Sets the root of the client application. Vedeu will execute this controller with action and optional arguments first.
Vedeu.configure do
root :controller, :action, args
# ...
end
run_once / run_once!
standalone / standalone!
stderr
Sets the value of STDERR.
Vedeu.configure do
stderr IO.console
# ...
end
stdin
Sets the value of STDIN.
Vedeu.configure do
stdin IO.console
# ...
end
stdout
Sets the value of STDOUT.
Vedeu.configure do
stdout IO.console
# ...
end
terminal_mode
Sets the terminal mode. Valid values can be either ‘:cooked’, ‘:fake’ or :raw’.
Vedeu.configure do
terminal_mode :cooked
# or...
terminal_mode :fake
# or...
terminal_mode :raw
# or...
terminal_mode = :raw
terminal_mode = :fake
terminal_mode = :cooked
# ... some code
end