Parent

Included Modules

ConfigTool

Public Instance Methods

configure() click to toggle source
    # File lib/mongrel_config/init.rb, line 9
 9:   def configure 
10:     if RUBY_PLATFORM =~ /mswin/
11:       options [
12:         ['-h', '--host ADDR', "Host to bind to for server", :@host, "0.0.0.0"],
13:         ['-p', '--port NUMBER', "Port to bind to", :@port, "3001"],
14:         ['-u', '--uri URI', "Where to put your config tool", :@uri, "/config"],
15:         ['-R', '--mongrel PATH', "Path to mongrel_rails_service", :@mongrel_script, "c:\\ruby\\bin\\mongrel_rails_service"]
16:       ]
17:     else
18:       options [ 
19:         ['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, Dir.pwd],
20:         ['-P', '--pid FILE', "Where to write the PID", :@pid_file, "log/mongrel.pid"],
21:         ['-h', '--host ADDR', "Host to bind to for server", :@host, "0.0.0.0"],
22:         ['-p', '--port NUMBER', "Port to bind to", :@port, "3001"],
23:         ['-u', '--uri URI', "Where to put your config tool", :@uri, "/config"]
24:       ]
25:     end
26:   end
run() click to toggle source
    # File lib/mongrel_config/init.rb, line 43
43:   def run
44:     # must require this here since rails and camping don't like eachother
45:     if RUBY_PLATFORM =~ /mswin/
46:       require 'mongrel_config/win32_app'
47:       $mongrel_rails_service = @mongrel_script
48:     else
49:       require 'mongrel_config/app'
50:     end
51: 
52:     resources = GemPlugin::Manager.instance.resource "mongrel_config", "/"
53:     $PID_FILE = @pid_file
54: 
55:     $server = Mongrel::Camping::start(@host,@port,@uri,Configure)
56: 
57:     puts "** Configure is running at http://#{@host}:#{@port}#{@uri}"
58:     if RUBY_PLATFORM !~ /mswin/
59:       trap("INT") { 
60:         $server.stop 
61:       }
62:       puts "Use CTRL-C to quit."
63:     else
64:       puts "Use CTRL-Pause/Break to quit."
65:     end
66: 
67:     # add our log directory
68:     $server.register("/log", Mongrel::DirHandler.new("log"))
69:     $server.register("/config/resources", Mongrel::DirHandler.new(resources))
70: 
71:     $server.acceptor.join
72:   end
validate() click to toggle source
    # File lib/mongrel_config/init.rb, line 28
28:   def validate
29:       valid?(@uri, "Must give a uri")
30:       valid?(@port && @port.to_i > 0, "Must give a valid port")
31:       valid?(@host, "Host IP to bind must be given")
32:       
33:     if RUBY_PLATFORM !~ /mswin/    
34:       valid_dir? @cwd, "Cannot change to a directory that doesn't exist"
35:       Dir.chdir @cwd
36:       valid_dir? "log", "Log directory does not exist"
37:     end
38: 
39:     return @valid
40:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.