2009-09-03 05:42:59 +00:00
|
|
|
dir = File.dirname(__FILE__)
|
|
|
|
$LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir)
|
|
|
|
|
2009-08-30 18:37:24 +00:00
|
|
|
module FSSM
|
|
|
|
FileNotFoundError = Class.new(StandardError)
|
|
|
|
CallbackError = Class.new(StandardError)
|
2009-12-16 16:57:16 +00:00
|
|
|
|
2009-08-30 18:37:24 +00:00
|
|
|
class << self
|
2009-09-06 05:59:30 +00:00
|
|
|
def dbg(msg=nil)
|
|
|
|
STDERR.puts(msg)
|
|
|
|
end
|
|
|
|
|
2009-12-16 16:57:16 +00:00
|
|
|
def monitor(*args, &block)
|
2009-08-30 18:37:24 +00:00
|
|
|
monitor = FSSM::Monitor.new
|
|
|
|
context = args.empty? ? monitor : monitor.path(*args)
|
2009-09-03 05:42:59 +00:00
|
|
|
|
|
|
|
if block_given?
|
|
|
|
if block.arity == 1
|
|
|
|
block.call(context)
|
|
|
|
else
|
|
|
|
context.instance_eval(&block)
|
|
|
|
end
|
2009-08-30 18:37:24 +00:00
|
|
|
end
|
2009-09-03 05:42:59 +00:00
|
|
|
|
2009-08-30 18:37:24 +00:00
|
|
|
monitor.run
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2009-09-03 05:42:59 +00:00
|
|
|
require 'thread'
|
|
|
|
|
2009-12-16 16:57:16 +00:00
|
|
|
require 'fssm/pathname'
|
2009-08-30 18:37:24 +00:00
|
|
|
require 'fssm/support'
|
2009-09-06 05:59:30 +00:00
|
|
|
require 'fssm/tree'
|
2009-08-30 18:37:24 +00:00
|
|
|
require 'fssm/path'
|
|
|
|
require 'fssm/state'
|
|
|
|
require 'fssm/monitor'
|
|
|
|
|
|
|
|
require "fssm/backends/#{FSSM::Support.backend.downcase}"
|
|
|
|
FSSM::Backends::Default = FSSM::Backends.const_get(FSSM::Support.backend)
|