lib/happy-commit.rb in happy-commit-0.0.1 vs lib/happy-commit.rb in happy-commit-0.0.2
- old
+ new
@@ -13,10 +13,11 @@
end
File.open(self.post_commit_path, "w") do |f|
f << %@#!/usr/bin/env ruby
sounds = Dir.glob(".git/sounds/*.wav")
-system("aplay #\{sounds.at(rand(sounds.size))} 2>/dev/null &")
+command = %w[aplay afplay play].find { |w| `#\{w} --version 2>/dev/null`; $?.success? }
+system("#\{command} #\{sounds.at(rand(sounds.size))} 2>/dev/null &")
@
end
FileUtils.chmod(0755, self.post_commit_path)
end
end