- Install Ruby with your ruby version manager of choice, like rbenv or RVM
- Check the ruby version in
.ruby-version
and ensure you have it installed locally e.g.rbenv install 2.4.5
- Install Postgres. If setting
up Postgres.app, you will also need to add the binary to your path. e.g.
add to your
~/.zshrc
or~/.bashrc
:
export PATH="$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin"
-
Install bundler (the latest Heroku-compatible version):
gem install bundler -v 1.15.2
-
Install other requirements:
bundle install
If you installed Postgres.app, you may need to install the
pg
gem independently with this command:gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/latest/bin/pg_config
-
Create the databases:
rails db:create
- Apply the schema to the databases:
rails db:schema:load RAILS_ENV=development
rails db:schema:load RAILS_ENV=test
- Install the Heroku CLI
- Copy
.env.example
to.env
and fill in the relevant values. - Start the server with
heroku local
. Take note of the port the server is running on, which may be set with thePORT
variable in your.env
file.
In order to send and receive messages when running ClientComm on your computer, you'll need to set up an account and buy a phone number on Twilio. The Twilio API expects your application to have publicly-accessible endpoints for incoming messages, message status updates, and phone calls; we use ngrok to create a secure public URL that Twilio can use to communicate with the ClientComm application running on your computer.
- Buy an SMS-capable phone number on Twilio.
- Install ngrok. Install with Homebrew:
brew cask install ngrok
or download the binary and create a symlink. - Start ngrok by entering
ngrok http 3000
in the terminal to start a tunnel (replace3000
with the port your application is running on if necessary). You should see an ngrok url with a unique ID displayed, e.g.https://e595b046.ngrok.io
. - When your Twilio number receives an sms message or phone call, it needs to know where to route it.
ClientComm has endpoints to receive Twilio webhooks at
/incoming/sms/
and/incoming/voice/
. Click on your phone number in the Twilio web interface and enter thehttps://[NGROK ID].ngrok.io/incoming/sms/
URL in the A MESSAGE COMES IN field, under Messaging, and thehttps://[NGROK ID].ngrok.io/incoming/voice/
URL in the A CALL COMES IN field, under Voice & Fax (see the image below).
- Phantom is required to run some of the feature tests. Download or install with Homebrew:
brew install phantomjs
- ChromeDriver is also required to run some of the feature tests. Download or install with Homebrew:
brew cask install chromedriver
- Run the test suite:
bin/rspec
orbundle exec rspec
. For more detailed logging useLOUD_TESTS=true bin/rspec
.