Skip to content

Instantly share code, notes, and snippets.

@FiXato
Forked from Jonnotie/gist:225016
Created November 12, 2009 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FiXato/232808 to your computer and use it in GitHub Desktop.
Save FiXato/232808 to your computer and use it in GitHub Desktop.
# Install kicker on osx: sudo gem install kicker --source http://gemcutter.org\
#
# Place a `.kick' file with this code in the root of your project, which contains the file to watch.
# Then start running kicker from the project root: $ kicker
FILE_TO_WATCH = 'mockup-1.psd'
counter = nil
if File.exist?('output')
last = Dir.glob("output/*.png").sort.last
if last =~ /mockup-(\d+)\.png$/
counter = $1.to_i
else
counter = 0
end
else
FileUtils.mkdir_p 'output'
counter = 0
end
process do |files|
if files.delete(FILE_TO_WATCH)
counter += 1
execute "sips #{FILE_TO_WATCH} -s format png --out output/mockup-#{counter}.png"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment