Created
February 4, 2013 20:40
-
-
Save sstelfox/4709573 to your computer and use it in GitHub Desktop.
Linux version of the imagesnap post-commit git hooks. To use create the file .git/hooks/post-commit in any repository you commit in often. Requires you have fswebcam installed (most distros have a package for it). Snapshots are stored in ~/.gitshots.
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 'fileutils' | |
fswebcam_path = `which fswebcam`.strip | |
exit 0 if fswebcam_path.empty? | |
print "Snapshotting your pretty mug..." | |
base_path = File.expand_path("~/.gitshots") | |
file = File.join(base_path, "#{Time.now.to_f}.png") | |
FileUtils.mkdir_p(base_path) | |
system("#{fswebcam_path} --png -1 --save #{file} -q") | |
puts "Done" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment