Class: Katte::Plugins::Node::File

Inherits:
Object
  • Object
show all
Includes:
Node::Base, Katte::Plugins::Node
Defined in:
lib/katte/plugins/node/file.rb

Instance Method Summary collapse

Methods included from Base

#define_keyword, #find, #included, #index, #plugins, #register

Methods included from Node::Base

#_descendants, #add_parent, #children, #descendants, #name, #parents, #requires, #run?

Instance Method Details

#add_child(node, *params) ⇒ Object



9
10
11
12
13
# File 'lib/katte/plugins/node/file.rb', line 9

def add_child(node, *params)
  file = params.first
  return unless file
  add_watch_list(file, node)
end

#durationObject



7
# File 'lib/katte/plugins/node/file.rb', line 7

def duration; 30; end

#run(driver) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/katte/plugins/node/file.rb', line 15

def run(driver)
  until watching_files.empty?
    update_watch_list do |file, nodes|
      if FileTest.exist? file
        nodes.each {|n| driver.next(self, n.name) }
        true
      else
        false
      end
    end

    watching_files.each {|f| Katte.app.logger.info("wating: #{f}") }
    sleep duration * 60 unless watching_files.empty?
  end
  
  driver.done(self)
end