Module: ThinIce
- Extended by:
- Rake::DSL
- Defined in:
- lib/thin-ice/core.rb,
lib/thin-ice/version.rb
Overview
Defined Under Namespace
Classes: ThinCommandFailure, ThinManager
Constant Summary collapse
- VERSION =
"1.0.1"
Class Method Summary collapse
-
.create_tasks(options = {}) ⇒ Object
Generates a set of Rake tasks to be used within a specific namespace that handle starting and stoping a Thin server instance.
-
.invoke(args) ⇒ Integer
Forks a process given a list of arguments and options.
Class Method Details
.create_tasks(options = {}) ⇒ Object
Generates a set of Rake tasks to be used within a specific namespace
that handle starting and stoping a Thin server instance
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/thin-ice/core.rb', line 90 def self.create_tasks( = {}) thin_manager = ThinManager.new() 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) ⇒ Integer
Forks a process given a list of arguments and options
16 17 18 19 20 21 22 23 24 |
# 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 |