Parent

Included Modules

Mongrel::Command::Registry

A Singleton class that manages all of the available commands and handles running them.

Public Instance Methods

commands() click to toggle source

Builds a list of possible commands from the Command derivates list

     # File lib/mongrel/command.rb, line 150
150:       def commands
151:                                 return [] # Neutered
152:         pmgr = GemPlugin::Manager.instance
153:         list = pmgr.plugins["/commands"].keys
154:         return list.sort
155:       end
run(args) click to toggle source

Runs the args against the first argument as the command name. If it has any errors it returns a false, otherwise it return true.

     # File lib/mongrel/command.rb, line 176
176:       def run(args)
177:         # find the command
178:         cmd_name = args.shift
179: 
180:         if !cmd_name or cmd_name == "?" or cmd_name == "help"
181:           print_command_list
182:           return true
183:         elsif cmd_name == "--version"
184:           puts "Mongrel Web Server #{Mongrel::Const::MONGREL_VERSION}"
185:           return true
186:         end
187: 
188:         begin
189:           # quick hack so that existing commands will keep working but the Mongrel:: ones can be moved
190:           if ["start", "stop", "restart"].include? cmd_name
191:             cmd_name = "mongrel::" + cmd_name
192:           end
193: 
194:                                         # Neutered
195:           # command = GemPlugin::Manager.instance.create("/commands/#{cmd_name}", :argv => args)
196:         rescue OptionParser::InvalidOption
197:           STDERR.puts "#$! for command '#{cmd_name}'"
198:           STDERR.puts "Try #{cmd_name} -h to get help."
199:           return false
200:         rescue
201:           STDERR.puts "ERROR RUNNING '#{cmd_name}': #$!"
202:           STDERR.puts "Use help command to get help"
203:           return false
204:         end
205: 
206:         # Normally the command is NOT valid right after being created
207:         # but sometimes (like with -h or -v) there's no further processing
208:         # needed so the command is already valid so we can skip it.
209:         if not command.done_validating
210:           if not command.validate
211:             STDERR.puts "#{cmd_name} reported an error. Use mongrel_rails #{cmd_name} -h to get help."
212:             return false
213:           else
214:             command.run
215:           end
216:         end
217: 
218:         return true
219:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.