If you don't have Xcode installed (for OS X), install from the Mac App store. Once installed, add command line tools by going to Preferences > Downloads > Components.
Next, you will need Ruby. You may consider using a Ruby version manager such as rbenv or rvm to help ensure that Ruby version upgrades don't mean all your gems will need to be rebuilt.
Most development systems will already have the requirements installed
including bundler
and npm
. If that describes you, just run
$ rake install
If the requirements are missing, do the following.
On OS X, you can use Homebrew to install Ruby in
/usr/local/bin
, which may require you to update your $PATH
environment
variable. Once you have brew installed, here are the commands to follow to install via homebrew in terminal:
$ brew update
$ brew install ruby
Next run this rake task to ensure bundler
and npm
are installed.
$ rake bootstrap
Node Package Manager is used by Karma, the test runner for javascript. Karma is written in Node.js.
- Open terminal
- 'cd' to directory (leave a space after 'cd', then drag and drop your site folder into the terminal window)
cd <path to vets-website directory>
- Run site by using:
rake serve
- View the site in your browser by going to http://localhost:4000
Any changes made locally will cause the site to rebuild automagically.
Deployment is done by pushing changes to the production
branch on github.
The most common paradigm is to promote master
to produciton
by doing a
fast-forward merge into the branch. This can be accomplished via
rake deploy
If someone has had to push emergency changes to the production branch that have yet to be merged into master, then you will need "merge down" from production into master before doing a deploy. This will ensure that master has all the changes pushed to production. THIS SHOULD NOT HAPPEN NORMALLY. If this has occurred, run
rake mergedown
After this, ensure the CI on master
goes green. Double-check staging as
you've just introduced a new change to the code. If everything looks good,
perform a deploy as described earlier to push all changes into production.
When developing, you will want one terminal open window running the Jekyll server (see Running the website).
For testing, the following commands are useful:
rake tests:ci # Rebuilds the website. Runs all tests that the CI system runs.
rake tests:ci_nobuild # Same as above but w/o rebuilding for faster iteraion.
rake tests:all # Rebuilds the website. Runs all tests, including slow ones. Superset of tests:ci
rake tests:all_nobuild # Same as above but w/o rebuilding for faster iteration.
rake tests:htmlproof # Runs HTML validation as a single-shot.
rake tests:htmlproof_external_only # Runs HTML validation of external links only as a single-shot.
rake tests:javascript # Runs all javascript tests as a single-shot.
rake tests:javascript_watch # Runs all javascript tests continually watching for changes..
There is currently now way to automatically run htmlproof
automatically on
a change to a source file. Patches welcome!
If updating Karma, make sure to remember to rerun npm shrinkwrap
to update npm-shrinkwrap.json
(the npm
equivalent of Gemfile.lock
for Bundler
).