-
-
Save FiXato/232808 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
# 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