To develop on pFDA locally you need to manually add a new user and organization. Because when you first get started in a new system, there is no existing user. So you can't log in to provision new accounts. This requires manually "bootstrapping" the situation in steps described in pFDA localhost user.
- Install XCode
- Search and install XCode from the App Store.
- Install Apple Command Line Tools
- Open XCode (this just needs to run once to initialize it) and close it.
- Install XCode command line tools by running
xcode-select --install
in the terminal.
- Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Run
brew update
to make sure all your formulas are current
- Install RVM
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
\curl -sSL https://get.rvm.io | bash -s stable
- Install ruby
rvm install 2.2.3
- Install bundler
gem install bundler
- to keep the current bundler version from Gemfile.lock:
gem install bundler -v 1.16.6
- Update the
libv8
gem beforebundle i
:gem install libv8 -v '3.16.14.13' -- --with-system-v8
- Install git
brew install git
- Set up git ssh
ssh-keygen -t rsa -b 4096 -C "your_email@dnanexus.com"
- Use
pbcopy < ~/.ssh/id_rsa.pub
to add SSH key to github here
- Set up git config
git config --global core.editor "vim"
git config --global user.email “your_email@dnanexus.com”
git config --global user.name “FirstName LastName”
git config --global push.default simple
- Install Docker and Docker-Compose. See instructions
- Install gems
docker-compose run web bundle install
- Prepare db
docker-compose run web bundle exec rake db:create
docker-compose run web bundle exec rake db:schema:load
- start rails server
docker-compose up
- start rails console
docker compose exec web bundle exec rails c
- Clone Repo
git clone git@github.com:dnanexus/precision-fda.git
bundle install
bundle exec rake db:schema:load
On your first bundle
, you may have issues installing the libv8 and
therubyracer gems. See here for
potential solutions. Try bundle update libv8
.
Create a User and Org, and other required records by running
The dxuser of the user record must match your DNAnexus username, and the handle of the org record must match the DNAnexus org handle without the pfda.. prefix, i.e. floranteorg.
- start rails server
bundle exec thin --ssl start
- You must use https, ex: https://localhost:3000
- start rails console
bundle exec rails c
-
Run all tests
bundle exec rspec
-
Run tests with Rspec Guard
bundle exec guard
-
To exit from Guard mode:
exit
-
Check current code coverage:
open coverage/index.html