Skip to content

Developer Setup on Mac OS X

Derek Edwards edited this page Oct 10, 2016 · 16 revisions

Prerequisites

  • git
  • postgres
  • postgis
  • nodejs (optional)

Install all of your prequisites using homebrew

brew install git postgres postgis redis phantomjs imagemagick

You can optionally download and install nodejs

Install Ruby

Install rbenv

brew install rbenv ruby-build

Add rbenv to bash so that it loads every time you open a terminal

echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
source ~/.bash_profile

Install Ruby

rbenv install 2.1.7
rbenv global 2.1.7
ruby -v

Install Postgres

Log into Postgres

psql postgres

Once you're logged in, create the one click databases

create database oneclick;
create database oneclick_test;

Finally exit Postgres

\q

Setup Ruby Project

Create a directory to store the Oneclick project

sudo mkdir /var/1-click

Give your account ownership of the directory

chown <your_user_name> /var/1-click

Navigate to the directory

cd /var/1-click

Clone the oneclick git project into the directory

git clone https://github.com/camsys/oneclick.git

Install Project Gems

Navigate to the oneclick project folder

cd /var/1-click/oneclick

Install the project gems

gem install bundler
bundle install

If the above fails with a puma compilation issue:

gem install puma -v '2.8.2' -- --with-opt-dir=/usr/local/opt/openssl
bundle install

Setup Project Database

Make a copy of the database.yml file

cp /var/1-click/oneclick/config/database.yml.travis /var/1-click/oneclick/config/database.yml

Open the database.yml file with your favorite text editor and confirm it has a “development” profile. Also make sure the profile contains the appropriate connection information. Please note that if you install Postgres using homebrew, your database username is likely your current account username.

nano /var/1-click/oneclick/config/database.yml

Populate the database with seed data

rake db:setup

Start the Project

Start oneclick

rails s

For map functionality, you will need to also start Redis and Sidekiq:

brew services start redis
bundle exec sidekiq

Go to http://localhost:3000

Troubleshooting

If the bundle install process displays an openssl error when attempting to install the eventmachine gem, try installing it manually using the command below and then re-running bundle install

cd /var/1-click/oneclick
bundle config build.eventmachine --with-cppflags=-I$(brew --prefix openssl)/include
bundle install

If the bundle install process displays an openssl error when attempting to install the puma gem, try installing it manually using the command below and then re-running bundle install

cd /var/1-click/oneclick
bundle config build.puma --with-cppflags=-I$(brew --prefix openssl)/include
bundle install

Optional Configuration

Get uberX Estimates in Trip Request

Turn on the Ride Hailing Mode

 run rake oneclick:enable_ride_hailing_mode

Set the following environment variables:

 UBER_SERVER_TOKEN:
 UBER_CLIENT_ID:
 UBER_CLIENT_SECRET: 

Create an uberX service.

 rake oneclick:create_uberx_service