Module: DeploYML::Servers::Thin

Defined in:
lib/deployml/servers/thin.rb

Overview

Provides methods for configuring, starting, stopping and restarting the Thin web server.

Instance Method Summary collapse

Instance Method Details

#initialize_serverObject

Initializes options used when calling thin.



14
15
16
17
# File 'lib/deployml/servers/thin.rb', line 14

def initialize_server
  @thin = Options::Thin.new(@server_options)
  @thin.environment ||= @name
end

#server_config(shell) ⇒ Object

Configures Thin by calling thin config.

Parameters:

Raises:

  • (MissingOption)

    No config option was listed under the server option in the deploy.yml configuration file.



44
45
46
47
48
49
50
51
52
53
54
55
# 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) ⇒ Object

Restarts Thin by calling thin restart.

Parameters:



91
92
93
94
95
96
97
# 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) ⇒ Object

Starts Thin by calling thin start.

Parameters:



63
64
65
66
67
68
69
# 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) ⇒ Object

Stops Thin by calling thin stop.

Parameters:



77
78
79
80
81
82
83
# 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) ⇒ Object

Runs a command via the thin command.

Parameters:

  • shell (LocalShell, RemoteShell)

    The shell to execute commands in.

  • arguments (Array)

    Additional arguments to call thin with.



28
29
30
31
32
# 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