- Elixir 1.6.6
- Erlang 21.0.1
- Nodejs 8.11.1
- phantomjs for browser tests
- Postgres with postgis extensions
This guide uses asdf-vm to manage prerequisites when possible. For a great guide on getting started, see Greg Mefford's post here
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.5.1
source ~/.asdf/asdf.sh
asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git
asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git
asdf plugin-add nodejs https://github.com/asdf-vm/asdf-nodejs.git
bash ~/.asdf/plugins/nodejs/bin/import-release-team-keyring
asdf install erlang 21.0.1 # This takes a while sometimes
asdf install elixir 1.6.6
asdf install nodejs 8.11.1
asdf global erlang 21.0.1
asdf global elixir 1.6.6
asdf global nodejs 8.11.1
asdf rehash nodejs
npm install phantomjs-prebuilt
# Install Postgres (on a Mac using Homebrew)
brew install postgresql postgis
-
Copy the apps/importer/config/dev.secret.exs.example to apps/importer/config/dev.secret.exs and replace the schedules data with your local transit authority's GTFS schedule feed (a zip file usually called google_transit.zip or something similar)
-
Copy the apps/realtime/config/dev.secret.exs.example to apps/realtime/config/dev.secret.exs and replace the feeds data with your local transit authority's GTFS trip update feed url and vehicle positions url (the locations usually end in .pb denoting a protobuf file)
- Run
mix deps.get
from the project root - Run
npm install
from the apps/bus_detective_web/assets folder - Run
mix do ecto.create, ecto.migrate
from the project root - Run
mix phx.server
from the project root, and the app will:- download the GTFS schedule data and import it
- poll for the trip updates and vehicle positions data
- Assuming all goes well, the log should get to a point where it says "Projecting stop times"
- Visit
localhost:4000
in a browser and search for a relevant stop. You should get search results very quickly.
- Run
mix test
from the project root for tests
Deployment to heroku should be fairly straight forward. You will want to add the following environment variables which will be picked up by prod.exs in the import and realtime apps:
- FEED_NAME
- FEED_SCHEDULE_URL
- FEED_TRIP_UPDATES_URL
- FEED_VEHICLE_POSITIONS_URL
This project rocks and uses (MIT-LICENSE).
GitHub's guide for Contributing to Open Source offers the best advice.
- Fork it!
- Create your feature branch:
git checkout -b cool-new-feature
- Run the Elixir formatter:
mix format
- Run the Elixir linter:
mix credo --strict
and resolve any problems (or ask for help if you're stuck) - Run the javascript linter:
cd apps/bus_detective_web/assets; ./node_modules/.bin/eslint js/**/*.js
(or ask for help if you're stuck) - Run the tests:
mix test
and make sure they pass - Commit your changes:
git commit -am 'Added a cool feature'
- Push to the branch:
git push origin cool-new-feature
- Create new Pull Request.