Skip to content

Instantly share code, notes, and snippets.

@peterhellberg
Created September 3, 2012 20:49
Show Gist options
  • Save peterhellberg/3613363 to your computer and use it in GitHub Desktop.
Save peterhellberg/3613363 to your computer and use it in GitHub Desktop.
Tiny File System Event kicker
#!/usr/bin/env ruby
require 'rubygems'
require 'rb-fsevent'
cmd, *paths = ARGV
if cmd && paths.any?
system cmd
fsevent = FSEvent.new
fsevent.watch(paths) { system cmd }
fsevent.run
else
puts "How to run: kick 'cmd' path1 [path2]"
end
@peterhellberg
Copy link
Author

I’ve had problems with Kicker (and Listen) on Mountain Lion so I decided to write a tiny replacement to use until they get fixed.

@henrik
Copy link

henrik commented Sep 4, 2012

Is it supposed to run before any event, on line 7?

@peterhellberg
Copy link
Author

Yes (I mainly use it to run my specs, and I want feedback as soon as possible)

@peterhellberg
Copy link
Author

How I use it for the old Rails project I’m working on right now: kick 'clear && rake' app lib spec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment