Skip to content

Instantly share code, notes, and snippets.

Created January 14, 2013 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/4532756 to your computer and use it in GitHub Desktop.
Save anonymous/4532756 to your computer and use it in GitHub Desktop.
script/bootstrap to setup a ruby on rails project alternately for a developer or for a continuous integration (ci) server
#!/usr/bin/env ruby
# a la zachholman http://zachholman.com/talk/ruby-patterns/
* dependency checks
** is mysql installed? (here's how to install it)
** is redis running? (here's how to run it)
* bundler
** bundle install --binstubs --local --path=vendor/gems --without=production
* db creation
** rake db:create
* db migration
** rake db:migrate
* db seeding
** script/replicate-repo see [rtomayko/replicate](https://github.com/rtomayko/replicate)
** e.g. script/replicate-repo holman/spark (clones issues, pull requests, users, git data, etc)
* asset / static page compilation
** 404, 500
* language compilation
** python, c, erlang...
* cache bootstrap results
** Check if we need to bundle install Gemfile and assets
md5 << File.read('Gemfile')
checksum = md5.hexdigest
installed = File.read('.bundle/checksum').strip
* We add script/cibuild to most projects. Lets us keep test config in the repository.
# set env vars
export RACK_ROOT=["..."]
export RACK_ENV="test"
# load gc ocnfig
# clean work dir
script/bootstrap
bin/rake
# gh-setup <project>
* apps: dropbox + homebrew + chrome + 1password + etc.
* dependencies: mysql + node + redis + riak + postgres + rbenv + etc.
* config: disk encryption + vpn + screen locks + etc.
* puppet
# deploy locking (hubon + heaven)
* you push a branch
* ci starts a build
* build passes
* you deploy branch
* 'heaven' prevents deploy conflicts
* you merge branch
* 'heaven' unlocks deploys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment