Class: Slippery::WatchTask

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

Instance Method Summary collapse

Constructor Details

#initialize(name, files, &block) ⇒ WatchTask

Returns a new instance of WatchTask.



96
97
98
99
100
101
102
103
104
105
106
# File 'lib/slippery/rake_tasks.rb', line 96

def initialize(name, files, &block)
  Rake::Task.define_task name do
    Array(files).each do |pattern|
      notifier.watch(pattern, :modify, &block)
    end
    at_exit do
      block.call
      notifier.run
    end
  end
end

Instance Method Details

#notifierObject



108
109
110
# File 'lib/slippery/rake_tasks.rb', line 108

def notifier
  @notifier ||= INotify::Notifier.new
end