Created
March 2, 2012 13:58
-
-
Save darrinholst/1958537 to your computer and use it in GitHub Desktop.
bin/server
This file contains hidden or 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 -w | |
require 'digest/md5' | |
def if_changed(filename) | |
last_digest_filename = ".#{filename.gsub('/', '_')}" | |
last_digest = File.read(last_digest_filename) rescue "" | |
current_digest = Digest::MD5.hexdigest(File.read(filename)) | |
unless last_digest.eql? current_digest | |
yield | |
File.write(last_digest_filename, current_digest) | |
end | |
end | |
if_changed("Gemfile.lock") do | |
system "bundle" | |
end | |
if_changed("db/schema.rb") do | |
system "rake db:schema:load db:seed" | |
end | |
system "bundle exec guard -G Guardfile.server" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment