summaryrefslogtreecommitdiff
path: root/swatchmaker/watcher.rb
blob: a418aef63be8f134724be3ec55fbb663cae24428 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env ruby

require 'rubygems'
require 'directory_watcher'

dw = DirectoryWatcher.new 'swatch'
dw.interval = 1.0
dw.add_observer do |*args|
  args.each do |event|
    if /less/ =~ event.path
     `make bootswatch`
      puts "#{Time.now.strftime("%I:%M:%S")} make bootswatch (since #{event.path} #{event.type})"
    end
  end
end

dw.start
gets      # when the user hits "enter" the script will terminate
dw.stop