This document explains how to add a new feature to the project "the Right Way."
git checkout -b new_feature
In the dashboard/dash/features/
folder, add a feature file
(e.g., new_feature.feature
). Describe the feature in plain English
according to the format specified by lettuce.
This step can be done automatically by simply running the lettuce tests:
python manage.py harvest
This will provide the boilerplate code for you, which should be copied
and pasted into a new_feature.py
file, also in the features/
folder.
Run the tests. You can specify a particular test (so you can avoid running the whole test suite) as follows:
python manage.py harvest dash/features/new_feature.feature
and ensure the tests do not pass. If they pass, your tests suck.
Add client-side code to the dash/static/
folder or the
dash/templates/
folder. Server-side code usually falls under the
dash/views.py
file.
See code layout for more details.
Make individual tests pass until all the tests you have written pass.
Run all tests, for all features. Just in case you broke something.
This is the part where you open the browser and do some sanity checking. Design can't really be automatically tested.
Cool, now we're ready to merge it in. Or if you're working in a team, send a pull request.
To send a pull request, push the branch:
git push origin new_feature
And then go to the Github page and create a pull request.
Alternatively, merge the branch into master:
git checkout master
git merge new_feature
You can now push master and delete the old branch:
git push origin master
git branch -d new_feature