module ThinIce

@author Alex Bezobchuk

Constants

VERSION

Public Class Methods

create_tasks(options = {}) click to toggle source

Generates a set of Rake tasks to be used within a specific namespace

that handle starting and stoping a Thin server instance

@param options [Hash] Hash containing various configuration

options
# File lib/thin-ice/core.rb, line 90
def self.create_tasks(options = {})

  thin_manager = ThinManager.new(options)

  desc 'Start the Thin server'
  task :start do
    invoke thin_manager.start_cmd
  end

  desc 'Stop the Thin server'
  task :stop do
    invoke thin_manager.stop_cmd
  end

  desc 'Restart the Thin server'
  task :restart do
    invoke thin_manager.stop_cmd
    invoke thin_manager.start_cmd
  end
end
invoke(args) click to toggle source

Forks a process given a list of arguments and options @param args [String] list of command arguments and options @return [Integer] the resulting exit status @raise [ThinCommandFailure] if the exit status of the process

is non-zero
# File lib/thin-ice/core.rb, line 16
def self.invoke(args)
  pid = Process.spawn(*args)
  _, result = Process.wait2(pid)

  s = result.exitstatus
  if s != 0
    raise ThinCommandFailure, "thin command exited with status #{s}"
  end
end