module DeploYML::Servers::Mongrel

Provides methods for configuring, starting, stopping and restarting the [Mongrel](github.com/fauna/mongrel) web server.

Public Instance Methods

initialize_server() click to toggle source

Initializes options used when calling `mongrel`.

# File lib/deployml/servers/mongrel.rb, line 14
def initialize_server
  @mongrel = Options::Mongrel.new(@server_options)
  @mongrel.environment ||= @name
end
mongrel_cluster(shell,*arguments) click to toggle source

Executes a command via the `mongrel_rails` command.

@param [LocalShell, RemoteShell] shell

The shell to execute commands in.

@param [Array] arguments

Additional arguments to call `mongrel_rails` with.
# File lib/deployml/servers/mongrel.rb, line 28
def mongrel_cluster(shell,*arguments)
  options = arguments + ['-c', @mongrel.config]

  shell.ruby 'mongrel_rails', *options
end
server_config(shell) click to toggle source

Configures Mongrel by calling `mongrel_rails cluster::configure`.

@param [LocalShell, RemoteShell] shell

The shell to execute commands in.

@raise [MissingOption]

No `config` option was listed under the `server` option in the
`deploy.yml` configuration file.
# File lib/deployml/servers/mongrel.rb, line 44
def server_config(shell)
  unless @mongrel.config
    raise(MissingOption,"No 'config' option specified under server options",caller)
  end

  shell.status "Configuring Mongrel ..."

  options = ['-c', shell.uri.path] + @mongrel.arguments
  shell.ruby 'mongrel_rails', 'cluster::configure', *options

  shell.status "Mongrel configured."
end
server_restart(shell) click to toggle source

Restarts Mongrel by calling `mongrel_rails cluster::restart`.

@param [LocalShell, RemoteShell] shell

The shell to execute commands in.
# File lib/deployml/servers/mongrel.rb, line 91
def server_restart(shell)
  shell.status "Restarting Mongrel(s) ..."

  mongrel_cluster 'cluster::restart'

  shell.status "Mongrel(s) restarted."
end
server_start(shell) click to toggle source

Starts Mongrel by calling `mongrel_rails cluster::start`.

@param [LocalShell, RemoteShell] shell

The shell to execute commands in.
# File lib/deployml/servers/mongrel.rb, line 63
def server_start(shell)
  shell.status "Starting Mongrel(s) ..."

  mongrel_cluster 'cluster::start'

  shell.status "Mongrel(s) started."
end
server_stop(shell) click to toggle source

Stops Mongrel by calling `mongrel_rails cluster::stop`.

@param [LocalShell, RemoteShell] shell

The shell to execute commands in.
# File lib/deployml/servers/mongrel.rb, line 77
def server_stop(shell)
  shell.status "Stopping Mongrel(s) ..."

  mongrel_cluster 'cluster::stop'

  shell.status "Mongrel(s) stopped."
end