Skip to content
Browse files

Some TomDoc for conditions.

  • Loading branch information...
1 parent 7778f9c commit 7b01d6dbb21dc5d48c4c5fd9f0e541b92f1cc373 @mojombo mojombo committed Jan 13, 2012
Showing with 29 additions and 31 deletions.
  1. +15 −2 lib/god/conditions/always.rb
  2. +4 −10 lib/god/conditions/process_exits.rb
  3. +10 −19 lib/god/conditions/process_running.rb
View
17 lib/god/conditions/always.rb
@@ -1,7 +1,21 @@
module God
module Conditions
-
+ # Always trigger or never trigger.
+ #
+ # Examples
+ #
+ # # Always trigger.
+ # on.condition(:always) do |c|
+ # c.what = true
+ # end
+ #
+ # # Never trigger.
+ # on.condition(:always) do |c|
+ # c.what = false
+ # end
class Always < PollCondition
+ # The Boolean determining whether this condition will always trigger
+ # (true) or never trigger (false).
attr_accessor :what
def initialize
@@ -18,6 +32,5 @@ def test
@what
end
end
-
end
end
View
14 lib/god/conditions/process_exits.rb
@@ -1,28 +1,22 @@
module God
module Conditions
-
- # Condition Symbol :process_exits
- # Type: Event
- #
# Trigger when a process exits.
#
- # Paramaters
- # Required
# +pid_file+ is the pid file of the process in question. Automatically
# populated for Watches.
#
# Examples
#
- # Trigger if process exits (from a Watch):
- #
+ # # Trigger if process exits (from a Watch).
# on.condition(:process_exits)
#
- # Trigger if process exits:
- #
+ # # Trigger if process exits (non-Watch).
# on.condition(:process_exits) do |c|
# c.pid_file = "/var/run/mongrel.3000.pid"
# end
class ProcessExits < EventCondition
+ # The String PID file location of the process in question. Automatically
+ # populated for Watches.
attr_accessor :pid_file
def initialize
View
29 lib/god/conditions/process_running.rb
@@ -1,40 +1,32 @@
module God
module Conditions
-
- # Condition Symbol :process_running
- # Type: Poll
- #
# Trigger when a process is running or not running depending on attributes.
#
- # Paramaters
- # Required
- # +pid_file+ is the pid file of the process in question. Automatically
- # populated for Watches.
- # +running" specifies whether you want to trigger if the process is
- # running (true) or whether it is not running (false)
- #
# Examples
#
- # Trigger if process IS NOT running (from a Watch):
- #
+ # # Trigger if process IS NOT running.
# on.condition(:process_running) do |c|
# c.running = false
# end
#
- # Trigger if process IS running (from a Watch):
- #
+ # # Trigger if process IS running.
# on.condition(:process_running) do |c|
# c.running = true
# end
#
- # Non-Watch Tasks must specify a PID file:
- #
+ # # Non-Watch Tasks must specify a PID file.
# on.condition(:process_running) do |c|
# c.running = false
# c.pid_file = "/var/run/mongrel.3000.pid"
# end
class ProcessRunning < PollCondition
- attr_accessor :running, :pid_file
+ # Public: The Boolean specifying whether you want to trigger if the
+ # process is running (true) or if it is not running (false).
+ attr_accessor :running
+
+ # Public: The String PID file location of the process in question.
+ # Automatically populated for Watches.
+ attr_accessor :pid_file
def pid
self.pid_file ? File.read(self.pid_file).strip.to_i : self.watch.pid
@@ -69,6 +61,5 @@ def test
end
end
end
-
end
end

0 comments on commit 7b01d6d

Please sign in to comment.
Something went wrong with that request. Please try again.