Set-up first the API server of the application. This subproject serves as the back-end of the whole RecipeFilter app.
Install the following dependencies:
- Git
- PostgreSQL
- Node
- Rbenv
- Ruby
- Rails
- Bundle
Install Git, Postgres, Node:
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install libssl-dev
sudo apt-get install postgresql libpq5 libpq-dev
sudo apt-get install git nodejs
Note: If this is your first time on git, it is advisable to configure your credentials first:
git config --global user.name "Neil Calabroso"
git config --global user.email "[email protected]"
Install Rbenv:
See https://github.com/sstephenson/rbenv
and complete the installation instructions including the optional part:ruby-build
.
Upon installing rbenv
, install Ruby 2.2.0:
rbenv install 2.2.0
rbenv global 2.2.0
rbenv local 2.2.0
Install Rails:
gem install rails
Install Bundler:
gem install bundler
Create a Postgres user for the Rails app that we will create in the next step. To do this, switch into the Postgres user:
sudo -u postgres psql postgres
Then create a user (or a "role", as Postgres calls it):
create role "gestures" with createdb login password 'csigestures';
Quit the postgre REPL by typing \q
.
- Clone our repository to your own directory.
- In the terminal, go to
api
directory. - Run
bundle install
. - Run
rake db:create
. - Run
rake db:migrate
. - Run
rake db:seed
. - Run
rails server
.
Note:
Please make sure that your ruby version is 2.2.0 where the project was cloned.
You can check the version using the command ruby -v
. If it is not, try
to use rbenv local 2.2.0
while you are in that directory. Check again.
Update npm.
sudo npm cache clean -f
sudo npm install -g n
Install ember-cli and its dependencies.
sudo npm install ember-cli -g
sudo npm install -g bower # package manager for front-end dependencies
sudo npm install -g phantomjs # for integration tests
Clear the cache and download the plugins.
sudo npm cache clean
sudo npm install
bower install
Please see this document.
After setting everything up, go to the api
directory and start the rails app.
cd path/to/Gestures/api
rails s
Open another terminal tab and go to the front
directory. Start the ember app with a proxy.
cd path/to/Gestures/api
ember serve --proxy http://localhost:3000
You can visit your app at http://localhost:4200. If you get the watch ENOSPC
error while running the server, run this in the terminal:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
For a high quality and readable codebase, please make these conventions as references:
- Ruby Style Guide
https://github.com/bbatsov/ruby-style-guide
- Rails Style Guide
https://github.com/bbatsov/rails-style-guide
For reference, here are the ember docs: