Created
March 3, 2010 10:43
-
-
Save dgoodlad/320516 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'fsevents' | |
require 'json' | |
ignores = JSON.parse(File.read(".couchappignore")).map { |s| Regexp.new(s) } | |
ignores.push /(^.git|.DS_Store|\.swp$|\.couchappignore)/ | |
appdir = File.expand_path(File.dirname(__FILE__)) | |
def build_css | |
puts "------ #{Time.now.strftime("%k:%M")} Building CSS" | |
puts `compass -c compass-config.rb --update` | |
end | |
def push_app | |
puts "------ #{Time.now.strftime("%k:%M")} Pushing" | |
`couchapp push` | |
end | |
stream = FSEvents::Stream.watch(File.dirname(__FILE__)) do |events| | |
appfiles = events.modified_files.delete_if { |f| | |
stripped = f.gsub(appdir + "/", "") | |
ignores.any? { |regex| regex.match stripped } | |
} | |
build_css if appfiles.any? { |path| /\.sass$/ =~ path } | |
push_app if appfiles.size > 0 | |
end | |
stream.run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment