module Shuttle::Support::Thin

Public Instance Methods

thin_config() click to toggle source
# File lib/shuttle/support/thin.rb, line 3
def thin_config
  config.thin || Hashr.new
end
thin_env() click to toggle source
# File lib/shuttle/support/thin.rb, line 19
def thin_env
  environment
end
thin_host() click to toggle source
# File lib/shuttle/support/thin.rb, line 7
def thin_host
  thin_config.host || "127.0.0.1"
end
thin_options() click to toggle source
# File lib/shuttle/support/thin.rb, line 23
def thin_options
  [
    "-a #{thin_host}",
    "-p #{thin_port}",
    "-e #{thin_env}",
    "-s #{thin_servers}",
    "-l #{shared_path('log/thin.log')}",
    "-P #{shared_path('pids/thin.pid')}",
    "-d"
  ].join(' ')
end
thin_port() click to toggle source
# File lib/shuttle/support/thin.rb, line 11
def thin_port
  thin_config.port || "9000"
end
thin_restart() click to toggle source
# File lib/shuttle/support/thin.rb, line 51
def thin_restart
  if ssh.file_exists?(shared_path("pids/thin.#{thin_port}.pid"))
    thin_stop
  end

  thin_start
end
thin_servers() click to toggle source
# File lib/shuttle/support/thin.rb, line 15
def thin_servers
  thin_config.servers || 1
end
thin_start() click to toggle source
# File lib/shuttle/support/thin.rb, line 35
def thin_start
  log "Starting thin"

  res = ssh.run("cd #{release_path} && ./bin/thin #{thin_options} start")

  unless res.success?
    error "Unable to start thin: #{res.output}"
  end
end
thin_stop() click to toggle source
# File lib/shuttle/support/thin.rb, line 45
def thin_stop
  log "Stopping thin"

  ssh.run("cd #{release_path} && ./bin/thin #{thin_options} stop")
end