Class Capcode::Configuration
In: lib/capcode/configuration.rb
Parent: Object

Methods

get   options   print_debug   set  

Public Class methods

[Source]

    # File lib/capcode/configuration.rb, line 67
67:       def get( key = nil )
68:         if key.nil?
69:           config
70:         else
71:           config[key] || nil
72:         end
73:       end

[Source]

    # File lib/capcode/configuration.rb, line 75
75:       def options
76:         @options ||= {}
77:       end

[Source]

    # File lib/capcode/configuration.rb, line 28
28:       def print_debug
29:         Capcode::Configuration.config.each do |k, v|
30:           puts "** [CONFIG] : #{k} = #{v}"
31:         end
32:       end

Set global configuration options

Options :

  • :port = Listen port (default: 3000)
  • :host = Listen host (default: 0.0.0.0)
  • :server = Server type (webrick, mongrel, thin, unicorn, rainbow or control_tower)
  • :log = Output logfile (default: STDOUT)
  • :session = Session parameters. See Rack::Session for more informations
  • :pid = PID file (default: $0.pid)
  • :daemonize = Daemonize application (default: false)
  • :db_config = database configuration file (default: database.yml)
  • :static = Static directory (default: the working directory)
  • :root = Root directory (default: directory of the main.rb) — This is also the working directory !
  • :verbose = run in verbose mode
  • :auth = HTTP Basic Authentication options

It can exist specifics options depending on a renderer, a helper, …

Example :

  module Capcode
    set :erb, "/path/to/erb/files"
    ...
  end

[Source]

    # File lib/capcode/configuration.rb, line 58
58:       def set( key, value, opts = {} )
59:         if Hash === value
60:           opts = value
61:           value = nil
62:         end
63:         config[key] = value
64:         options[key] = opts
65:       end

[Validate]