summaryrefslogtreecommitdiff
path: root/2/swatchmaker/watcher.rb
diff options
context:
space:
mode:
Diffstat (limited to '2/swatchmaker/watcher.rb')
-rw-r--r--2/swatchmaker/watcher.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/2/swatchmaker/watcher.rb b/2/swatchmaker/watcher.rb
new file mode 100644
index 00000000..a418aef6
--- /dev/null
+++ b/2/swatchmaker/watcher.rb
@@ -0,0 +1,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 \ No newline at end of file