Ruby on Rails app that finds viable routes for the CHIditarod, based on customizable criteria like leg length, overall race length, etc.
Your Google Cloud Platform account and associated API key must have access to the following APIs:
Variable Name | Purpose |
---|---|
GOOGLE_API_KEY |
Google Cloud Platform API key with access to the APIs listed above. |
MOCK_MAP |
When true load a fake route map instead of querying the Google Static API. |
bundle exec rake db:seed
GOOGLE_API_KEY=... bundle exec rails c
BulkLegCreator.perform_now(Location.pluck(:id))
RouteGenerator.call(Race.first)
winners = Route.complete
puts winners.map(&:to_csv)
puts winners.map(&:to_s)
selected = winners.select{|r| r.name != nil}
selected.map(&:to_csv)
GeocodeLocationJob.perform_now(Location.pluck(:id))
Race.destroy_all; Route.destroy_all; Leg.destroy_all; Location.destroy_all; Leg.destroy_all; nil
Tested using OSX Mojave 10.14.2.
Prerequisites
Install rbenv & Ruby
brew install rbenv
rbenv install $(cat .ruby-version)
gem install bundler
Install Gems
brew install libffi libpq
bundle config --local build.ffi --with-ldflags="-L/usr/local/opt/libffi/lib"
bundle config --local build.pg --with-opt-dir="/usr/local/opt/libpq"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/libffi/lib/pkgconfig"
bundle install