This is the frontend of Veganaut: a gamified platform (website and phonegap app) helping the international vegan/vegetarian movement to grow faster, be more effective and include a more diverse range of people.
To run Veganaut, you'll need to install nodejs and
mongodb. On a Mac, the easiest way to do so is brew install node mongdb
.
After that checkout veganaut and veganaut-backend:
git clone https://github.com/veganaut/veganaut.git
git clone https://github.com/veganaut/veganaut-backend.git
Install the dependencies using npm and let the post install script create a config
file for the backend in veganaut-backend/app/config.js
:
(cd veganaut; npm install)
(cd veganaut-backend; npm install)
Load the fixtures:
cd veganaut-backend; node ./test/fixtures/basic.js
Start all the things:
cd veganaut; ./scripts/run-all.sh
This will do the following:
- Start MongoDB if it isn't already started
- Run
gulp dev
which creates the index.html file from index.ejs and compiles the less files- Note that at the moment there is no gulp watch task, so if you change index.ejs or any of the less files,
you have to run
./node_modules/.bin/gulp dev
manually. If you use PHP/WebStorm, there is also a file watcher that recompiles the less files.
- Note that at the moment there is no gulp watch task, so if you change index.ejs or any of the less files,
you have to run
- Start the frontend web server: http://localhost:8000/
- Start the backend. Supervisor will automatically restart the backend when the code is edited.
- Start the backend e2e bridge (needed for the e2e tests)
- Start Karma: http://localhost:9876/
Finally, go to http://localhost:8000/ and login as foo@bar.baz with password foobar.
This repo comes with a git-commit hook to run jshint prior to commits. To enable it, use the following commands after cloning.
(cd veganaut-backend/.git/ && rm -r hooks/ && ln -s ../git_hooks hooks)
(cd veganaut/.git/ && rm -r hooks/ && ln -s ../git_hooks hooks)
You can also run JSHint like this:
(cd veganaut; ./node_modules/.bin/jshint .)
(cd veganaut-backend; ./node_modules/.bin/jshint .)
To run all the tests execute:
cd veganaut; ./scripts/test-all.sh
The backend has a secondary server running so that the frontend can tell it which fixtures to load.
By default the tests use Chromium (or Chrome). You can change this in config/protractor.conf.js
The tests use protractor which uses Selenium.
All of these dependencies are installed when you run npm install
.
Protractor is run like this:
cd veganaut; ./node_modules/.bin/protractor config/protractor.conf.js
Backend integration (end-to-end) tests:
cd veganaut-backend; ./node_modules/.bin/jasmine-node --captureExceptions --verbose test/e2e/
Backend unit tests:
cd veganaut-backend; ./node_modules/.bin/jasmine-node --captureExceptions --verbose test/models/
The frontend unit tests use Karma which is automatically
started by the ./scripts/run-all.sh
script. Run the tests by accessing
http://localhost:9876/ with a browser.
Karma will automatically rerun all your tests if you change the code.