Class: Uatu

Inherits:
Object
  • Object
show all
Defined in:
lib/uatu.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Uatu

Returns a new instance of Uatu.



9
10
11
# File 'lib/uatu.rb', line 9

def initialize(options)
	@options = options
end

Class Method Details

.run(options) ⇒ Object



5
6
7
# File 'lib/uatu.rb', line 5

def self.run(options)
	new(options).run!
end

Instance Method Details

#run!Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/uatu.rb', line 13

def run!
	unless @options[:cmd] or @options[:script]
		puts "'-s SCRIPT' or '-c CMD' arguments required !"
		exit 1
	end

	puts "Watcher started"
	@last_update = Time.now
   Listen.to(@options[:path]) do |mod, add, del|
     trigger(mod + add + del)
   end
end