Bootstrapping: Making your app newbie-proof
Companies have lots of applications with lots of different setups. There should be a QUICK AND EASY way to step into an unfamiliar app.
Put a file called
bootstrap in the
script/ directory. The purpose of this
file will be to allow anyone to easily jump into a project and start
script/bootstrap takes care of:
- dependency checks
- db creation
- db migration
- db seeding
- static page compilation
- language compilation
Is your database engine installed? (here's how to install it) Is some_required_application running? (here's how to run it)
bundle install \ --binstubs \ --local \ --path=vendor/gems \ --without=production
- pull database from production app
static page compilation
python, c, erlang...
But running script/bootstrap takes forever...
cache bootstrap results
md5 << File.read('Gemfile') checksum = md5.hexdigest installed = File.read('.bundle/checksum').strip
script/bootstrap should be fast, straightforward, and require no
knowledge of the underlying language or app setup.
What else can I use script/bootstrap for?
You can also run script/bootstrap during any process that loads the environment,
You can even use
script/bootstrap in your testing environment.
script/cibuild to your projects. This will allow you to keep test config
in the repository.
Your CI server only needs to ever run
cibuild? What's this noise?
export RACK_ROOT=["..."] export RACK_ENV=["test"] script/bootstrap bin/rake
Copyright (C) 2012 Caleb Thompson
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.