Class: Surak::FileWatcherWrapper

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFileWatcherWrapper

Returns a new instance of FileWatcherWrapper.



40
41
42
43
44
45
46
# File 'lib/surak.rb', line 40

def initialize
  self.files_to_monitor = [
    'src',
    'surak.json'
  ]
  self.grunt
end

Instance Attribute Details

#files_to_monitorObject

Returns the value of attribute files_to_monitor.



39
40
41
# File 'lib/surak.rb', line 39

def files_to_monitor
  @files_to_monitor
end

Instance Method Details

#gruntObject



48
49
50
51
# File 'lib/surak.rb', line 48

def grunt
  grunt_output = `grunt`
  puts "\n#{grunt_output}\n"
end

#startObject



53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/surak.rb', line 53

def start
  FileWatcher.new(self.files_to_monitor).watch() do |filename, event|
    if(event == :changed)
      puts "File updated: " + filename
    end
    if(event == :delete)
      puts "File deleted: " + filename
    end
    if(event == :new)
      puts "Added file: " + filename
    end
    self.grunt
  end
end