-
-
Notifications
You must be signed in to change notification settings - Fork 25
Dev: Setup on Windows
The best approach to development on Windows is either to use Docker or a virtualized Linux environment with Docker installed.
If your CPU supports the VT-x extensions (most CPUs since 2010 do), then you can create a virtual Linux environment using, for instance, VirtualBox, and then follow the instructions in Dev: Setup on Linux and OS X using Docker.
Otherwise, this is just notes for now. Working on getting this set up still. Note if you're using Windows Pro you may be able to use the docker setup instructions instead of this doc.
This is a basic github requirement, but maybe worth mentioning. Check out the docs at https://help.github.com/articles/set-up-git/ to walk through it.
We request everyone (even direct contributors) fork the main repo and submit work via pull requests. See https://help.github.com/articles/about-pull-requests/ for more info on pull requests if you're not already familiar.
Install Postgres from https://www.enterprisedb.com/downloads/postgres-postgresql-downloads, 9.3 should do the trick.
Once the main installation is finished, use the "Stack Builder" tool to install the PostGIS bundle (2.2.3 for PostgreSQL 9.3 should work).
Once that's done you need to add the bin directory to your system path (see https://www.howtogeek.com/118594/how-to-edit-your-system-path-for-easy-command-line-access/ for some info on how to edit it). The path you want to add will be something like C:\Program Files\PostgreSQL\9.3\bin
Install ruby https://rubyinstaller.org/downloads/ make sure the version is at least the same minor (e.g., 2.2.X) version as what https://github.com/Safecast/safecastapi/blob/master/.ruby-version specifies.
Install https://nodejs.org/en/download/ - rails needs this to compile some javascript code
Once you have the pieces, open a terminal and ensure you can run basic commands.
git --version
psql --version
ruby --version
node --version
Then you'll need to create a database user. You should have a tool called pgAdmin
available in your start menu. Use that to add a safecast
role with the password also set to safecast
and specify it as a superuser.
You may need some gemfile tweaks (to be added)
Then try running bundle
. This should set up the gems
First copy the windows config over to the main location. Note, please don't check this in. At some point this file will be ignored but for now we just have to live with the outstanding changes.
copy config\database.yml.windows config\database.yml
Next create the databases and load the schema. If you see errors here, check that PostgreSQL and PostGIS are correctly installed and configured as above.
bundle exec rake db:create
bundle exec rake db:structure:load
bundle exec rake db:structure:load RAILS_ENV=test
bundle exec rake db:bootstrap
bundle exec rspec spec
Expect to see one failure involving a /tmp
path. We'll fix this eventually but unfortunately the test isn't windows-compatible.
bundle exec rails server
And browse to http://localhost:3000