/project-m

Something secret but not really.

Primary LanguageJavaScript

Project-M

Build Status

Dev setup

  1. Install vagrant

  2. Install ansible

  3. Clone the project

     git clone https://github.com/ppau/project-m.git
    
  4. Start the vagrant vm

     vagrant up && vagrant provision
    
  5. Log onto the vm

     vagrant ssh
    
  6. Find the project files

     cd /vagrant
    
  7. Install dependencies

     npm install
    
  8. Add stripe keys [Optional]

     1. First option is to add stripe config file:
             1. Make a file called stripe-config.json in /config file (see /config/strip-config.json.example for format)
             2. Visit [stripe](https://dashboard.stripe.com/test/dashboard)
             3. Click your account -> account settings
             4. Click API keys
             5. Add the ones you wish to use into /config/stripe-config.json (for test and dev)
    
     2. Second option is to declare them at run time:
             1. Add STRIPE_SECRET_KEY="somekey" to environment vars
             2. Add STRIPE_PUBLIC_KEY="anotherkey" to environment vars
             3. Alternatively, define them at runtime before npm start, see below
    
             eg: STRIPE_SECRET_KEY="sk_test_randomNumbersAndLetters" STRIPE_PUBLIC_KEY="anotherkey" npm start
    
     If you do both options, the run time declaration is used instead of the config file.
    
  9. Email configuration [Optional]

     1. Run `which sendmail` in a terminal
     2. Add EMAIL_SERVER="Path to sendmail" to environment vars
     3. Turn on the toggles for the emails that will be activated in each specific environment (config/default.json, config/staging.json, config/production.json)
         - For the verification email set "sendEmails" to true
    
  10. Run the tests

     npm test
    
  11. Run the acceptance tests

     1. First set up a admin email and admin password:
             export ACCEPTANCE_EMAIL=some email here
             export ACCEPTANCE_PASSWORD=some password here
     2. Start the server:
             npm start
     3. Then run:
             npm run acceptanceTests
    
  12. Start the server

     npm start
    

webpack

  1. npm install webpack -g

  2. webpack --progress --colors --watch

Tests

  1. Run server side tests

     npm run serverTests
    
  2. Run client side tests

     npm run componentTests
    
  3. Run a specific server side test

     NODE_ENV=test node --harmony node_modules/jasmine/bin/jasmine.js spec/integration/membersSpec.js
    
  4. Run smoke tests against an external target

     NODE_ENV=test INSTANCE_URL=http://myinstance.mydomain.com node --harmony node_modules/jasmine/bin/jasmine.js spec/integration
    

Utility scripts

  1. Migrate the database (run automatically as part and npm start or npm test)

     ./node_modules/sequelize-cli/bin/sequelize db:migrate
    
  2. Create an admin user to access the treasurer/secretary views

     npm run createAdmin
    

Pull a copy of the staging db from heroku

  1. heroku pg:backups capture --app <app_name>

  2. curl -o db/dumps/latest.dump heroku pg:backups public-url

  3. (in the vm) pg_restore --verbose --clean --no-acl --no-owner -h localhost -U project-m -d project-m db/dumps/latest.dump

Happy hacking!

Optional setup

JShint

  1. Install plugin

WebStorm

  1. Install webstorm

  2. Open preferences -> Languages and frameworks

  3. Change javascript to ECMAScript 6

  4. Setup run configuration to node and "javascript/file" to be bin/www

  5. Optionally install vagrant plugin