Thanks to visit codestin.com
Credit goes to github.com

Skip to content

veganaut/veganaut

Repository files navigation

Veganaut Frontend Build Status Code Climate

This is the frontend of Veganaut, a community-driven vegan guide.

Getting Started

To run Veganaut, you'll need to install nodejs and PostgreSQL.

After that, checkout veganaut and veganaut-backend. Make sure they live in the same parent folder:

git clone https://github.com/veganaut/veganaut.git
git clone https://github.com/veganaut/veganaut-backend.git

e.g. your folder structure should look like this:

.
├── veganaut
|   └── ...
└── veganaut-backend
    └── ...

Install the dependencies using npm and let the post install script create a config file for the backend in veganaut-backend/app/config.js (keep the parentheses to be able to copy paste the whole code block):

(cd veganaut; npm install)
(cd veganaut-backend; npm install)

Start all the things (you have to start your PostgreSQL server before):

cd veganaut; npm run start:all

Load the fixtures:

cd veganaut-backend; node ./test/fixtures/basic.js

The start:all script does the following:

  • Run gulp dev which creates the index.html file from index.ejs and compiles the less files
    • To watch the less files, you can either run npm run watch:less or use browsersync with npm run serve.
  • 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 [email protected] with password foobar.

Code Quality Tools

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 .)

Running Tests

To run all the tests execute:

cd veganaut; ./scripts/test-all.sh

Full End-to-End Tests

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 Tests

Backend integration (end-to-end) tests:

cd veganaut-backend; NODE_ENV=test ./node_modules/.bin/jasmine JASMINE_CONFIG_PATH=test/jasmine.json test/e2e/**

Backend unit tests:

cd veganaut-backend; NODE_ENV=test ./node_modules/.bin/jasmine JASMINE_CONFIG_PATH=test/jasmine.json test/models/**

Frontend Tests

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.

App architecture decisions

Here's more information about the app architecture decisions.

About

A community-driven vegan guide (frontend)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 14