lib/god.rb in eric-god-0.7.12 vs lib/god.rb in eric-god-0.7.14
- old
+ new
@@ -146,12 +146,10 @@
end
end
end
module God
- VERSION = '0.7.12'
-
LOG_BUFFER_SIZE_DEFAULT = 100
PID_FILE_DIRECTORY_DEFAULTS = ['/var/run/god', '~/.god/pids']
DRB_PORT_DEFAULT = 17165
DRB_ALLOW_DEFAULT = ['127.0.0.1']
LOG_LEVEL_DEFAULT = :info
@@ -418,11 +416,11 @@
when "start", "monitor"
items.each { |w| jobs << Thread.new { w.monitor if w.state != :up } }
when "restart"
items.each { |w| jobs << Thread.new { w.move(:restart) } }
when "stop"
- items.each { |w| jobs << Thread.new { w.unmonitor.action(:stop) if w.state != :unmonitored } }
+ items.each { |w| jobs << Thread.new { w.action(:stop); w.unmonitor if w.state != :unmonitored } }
when "unmonitor"
items.each { |w| jobs << Thread.new { w.unmonitor if w.state != :unmonitored } }
when "remove"
items.each { |w| self.unwatch(w) }
else
@@ -624,10 +622,15 @@
end
self.main.join
end
+ def self.version
+ yml = YAML.load(File.read(File.join(File.dirname(__FILE__), *%w[.. VERSION.yml])))
+ "#{yml[:major]}.#{yml[:minor]}.#{yml[:patch]}"
+ end
+
# To be called on program exit to start god
#
# Returns nothing
def self.at_exit
self.start
@@ -652,10 +655,10 @@
def self.pattern_match(pattern, list)
regex = pattern.split('').join('.*')
list.select do |item|
item =~ Regexp.new(regex)
- end
+ end.sort_by { |x| x.size }
end
end
# Runs immediately before the program exits. If $run is true,
# start god, if $run is false, exit normally.