Skip to content

Instantly share code, notes, and snippets.

@nfelger
Created December 2, 2010 10:57
Show Gist options
  • Save nfelger/725133 to your computer and use it in GitHub Desktop.
Save nfelger/725133 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'fsevents'
STDOUT.sync = true
project = ARGV[0] || 'skweb'
options = {
:directory_to_watch => "/Users/nfelger/dev/songkick/#{project}",
:remote_host => 'of1-dev-nfelger',
:remote_dir => "dev/songkick/#{project}"
}
stream = FSEvents::Stream.watch(options[:directory_to_watch], :latency => 2.5) do
print "Sünked in "
start = Time.now
puts `rsync -varx --delete -e ssh --exclude '*.yml.201*' --exclude '.idea*' --exclude 'tmp/*' --exclude '*.css' #{options[:directory_to_watch]}/ #{options[:remote_ho
st]}:#{options[:remote_dir]}/`
puts "#{sprintf('%.2f', Time.now - start)}s"
end
stream.run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment