Skip to content

Instantly share code, notes, and snippets.

@darrinholst
Created March 2, 2012 13:58
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 darrinholst/1958537 to your computer and use it in GitHub Desktop.
Save darrinholst/1958537 to your computer and use it in GitHub Desktop.
bin/server
#!/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