module DeploYML::Servers::Thin

Provides methods for configuring, starting, stopping and restarting the [Thin](code.macournoyer.com/thin/) web server.

Public Instance Methods

initialize_server() click to toggle source

Initializes options used when calling `thin`.

# File lib/deployml/servers/thin.rb, line 14
def initialize_server
  @thin = Options::Thin.new(@server_options)
  @thin.environment ||= @name
end
server_config(shell) click to toggle source

Configures Thin by calling `thin config`.

@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/thin.rb, line 44
def server_config(shell)
  unless @thin.config
    raise(MissingOption,"No 'config' option specified under the server options",caller)
  end

  shell.status "Configuring Thin ..."

  options = ['-c', shell.uri.path] + @thin.arguments
  shell.ruby 'thin', 'config', *options

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

Restarts Thin by calling `thin restart`.

@param [LocalShell, RemoteShell] shell

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

  thin shell, 'restart'

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

Starts Thin by calling `thin start`.

@param [LocalShell, RemoteShell] shell

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

  thin shell, 'start'

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

Stops Thin by calling `thin stop`.

@param [LocalShell, RemoteShell] shell

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

  thin shell, 'stop'

  shell.status "Thin stopped."
end
thin(shell,*arguments) click to toggle source

Runs a command via the `thin` command.

@param [LocalShell, RemoteShell] shell

The shell to execute commands in.

@param [Array] arguments

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

  shell.ruby 'thin', *options
end