Parent

Included Modules

Cluster::Configure

Public Instance Methods

configure() click to toggle source
     # File lib/mongrel_cluster/init.rb, line 284
284:     def configure 
285:       options [
286:         ["-e", "--environment ENV", "Rails environment to run as", :@environment, nil],
287:         ['-p', '--port PORT', "Starting port to bind to", :@port, 3000],
288:         ['-a', '--address ADDR', "Address to bind to", :@address, nil],
289:         ['-l', '--log FILE', "Where to write log messages", :@log_file, "log/mongrel.log"],
290:         ['-P', '--pid FILE', "Where to write the PID", :@pid_file, "tmp/pids/mongrel.pid"],
291:         ['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, nil],
292:         ['-o', '--timeout TIME', "Time to wait (in seconds) before killing a stalled thread", :@timeout, nil],
293:         ['-t', '--throttle TIME', "Time to pause (in hundredths of a second) between accepting clients", :@throttle, nil],
294:         ['-m', '--mime PATH', "A YAML file that lists additional MIME types", :@mime_map, nil],
295:         ['-r', '--root PATH', "Set the document root (default 'public')", :@docroot, nil],
296:         ['-n', '--num-procs INT', "Number of processor threads to use", :@num_procs, nil],
297:         ['-B', '--debug', "Enable debugging mode", :@debug, nil],
298:         ['-S', '--script PATH', "Load the given file as an extra config script.", :@config_script, nil],
299:         ['-N', '--num-servers INT', "Number of Mongrel servers", :@servers, 2],
300:         ['-C', '--config PATH', "Path to cluster configuration file", :@config_file, "config/mongrel_cluster.yml"],
301:         ['', '--user USER', "User to run as", :@user, nil],
302:         ['', '--group GROUP', "Group to run as", :@group, nil],
303:         ['', '--prefix PREFIX', "Rails prefix to use", :@prefix, nil]
304:       ]
305:     end
run() click to toggle source
     # File lib/mongrel_cluster/init.rb, line 316
316:     def run
317:       @options = { 
318:         "port" => @port,
319:         "servers" => @servers,
320:         "pid_file" => @pid_file
321:       }
322:       
323:       @options["log_file"] = @log_file if @log_file
324:       @options["debug"] = @debug if @debug
325:       @options["num_procs"] = @num_procs if @num_procs
326:       @options["docroot"] = @docroot if @docroot
327:       @options["address"] = @address if @address
328:       @options["timeout"] = @timeout if @timeout
329:       @options["throttle"] = @throttle if @throttle
330:       @options["environment"] = @environment if @environment
331:       @options["mime_map"] = @mime_map if @mime_map
332:       @options["config_script"] = @config_script if @config_script
333:       @options["cwd"] = @cwd if @cwd
334:       @options["user"] = @user if @user
335:       @options["group"] = @group if @group
336:       @options["prefix"] = @prefix if @prefix
337:       
338:       log "Writing configuration file to #{@config_file}."
339:       File.open(@config_file,"w") {|f| f.write(@options.to_yaml)}
340:     end
validate() click to toggle source
     # File lib/mongrel_cluster/init.rb, line 307
307:     def validate
308:       @servers = @servers.to_i
309:       
310:       valid?(@servers > 0, "Must give a valid number of servers")
311:       valid_dir? File.dirname(@config_file), "Path to config file not valid: #{@config_file}"
312:       
313:       @valid
314:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.