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.configuration.base_path
Configuration Options
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_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.
At this time, debugging only toggles between viewing a full backtrace (true) upon exception or only its top line (false).
Vedeu.configure do
debug!
# ...
end
Vedeu.configure do
debug false
# ...
end
drb / drb!
Sets boolean to run a DRb server.
Vedeu.configure do
drb!
# ...
end
drb_host
Sets the hostname or IP address of the DRb server.
Vedeu.configure do
drb_host 'localhost'
# ...
end
drb_port
Sets the port of the DRb server.
Vedeu.configure do
drb_port 12345
# ...
end
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
interactive / interactive!
Sets boolean to allow user input. The default behaviour of Vedeu is to be interactive.
Vedeu.configure do
interactive! # => same as `interactive true` or
# `standalone false`
# ...
end
Vedeu.configure do
interactive true # => Allow user input.
# ...
end
Vedeu.configure do
interactive false # => Disallow user input.
# ...
end
log
Sets the location of the log file.
Vedeu.configure do
log '/var/log/vedeu.log'
# ...
end
log_only
Only log specific message types. A complete list of message types can be found at Vedeu::Logging::Log.message_types.
Vedeu.configure do
log_only :debug, :event
# or
log_only [:debug, :info]
# ...
end
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 ‘profile.html’ 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!
Sets boolean to run the Vedeu main application loop once. In effect, using ‘run_once!` or setting `run_once` to true will allow Vedeu to initialize, run any client application code, cleanup, then terminate.
Vedeu.configure do
run_once!
# ...
end
standalone / standalone!
Sets boolean to prevent user intervention. This is the same as setting Sets boolean to allow user input. The default behaviour of Vedeu is to be interactive.
Vedeu.configure do
interactive! # => same as `interactive true` or
# `standalone false`
# ...
end
Vedeu.configure do
interactive true # => Allow user input.
# ...
end
Vedeu.configure do
interactive false # => Disallow user input.
# ...
end
to false.
Vedeu.configure do
standalone! # => same as `standalone true` or
# `interactive false`
# ...
end
Vedeu.configure do
standalone true # => Disallow user input.
# ...
end
Vedeu.configure do
standalone false # => Allow user input.
# ...
end
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
# ... some code
end