module Derelict
Main module/entry point for Derelict
Constants
- VERSION
Private Class Methods
debug_options_defaults()
click to toggle source
Retrieves the default values for the options hash for debug!
# File lib/derelict.rb, line 64 def self.debug_options_defaults { :enabled => true, :level => Log4r::INFO, } end
stderr()
click to toggle source
# File lib/derelict.rb, line 71 def self.stderr Log4r::Outputter.stderr end
Public Instance Methods
debug!(options = {})
click to toggle source
Enables (or disables) Derelict's debug mode
When in debug mode, Derelict
will log to stderr. The debug level can be controlled as well (which affects the verbosity of the logging).
Valid (symbol) keys for the options hash include:
* enabled: Whether debug mode should be enabled (defaults to true) * level: Allows setting a custom log level (defaults to INFO)
# File lib/derelict.rb, line 47 def debug!(options = {}) options = debug_options_defaults.merge options logger.level = options[:enabled] ? options[:level] : Log4r::OFF if options[:enabled] logger.add stderr unless logger.outputters.include? stderr logger.info "enabling debug mode" else logger.info "disabling debug mode" logger.remove "stderr" end self end
instance(path = Instance::DEFAULT_PATH)
click to toggle source
Creates a new Derelict
instance for a Vagrant installation
* path: The path to the Vagrant installation (optional, defaults to Instance::DEFAULT_PATH)
# File lib/derelict.rb, line 32 def instance(path = Instance::DEFAULT_PATH) logger.info "Creating and validating new instance for '#{path}'" Instance.new(path).validate! end