Skip to content

TheDesignExchange/app

Repository files navigation

TheDesignExchange/app

TheDesignExchange:master build status: build status

new devs read this!!!!! See our wiki to learn about our workflow

Installing

A few manual steps are required. See troublshooting section of readme is you run into issues.

  1. Install postgres. Mac: brew install postgresql Ubuntu: sudo apt-get install postgresql

  2. Install rvm, then follow instructions to install correct Ruby version. As of Aug 2015, this would be: rvm install ruby-2.1.3 (If you have a nonstandard security setup, install rvm without autolibs.)

  3. cd into the repo and then cd app to get to the root of the project directory

  4. Bundler. gem install bundler, then bundle install Ubuntu: You might have to sudo apt-get install openjdk-6-jdk for Sunspot.

  5. That's it! Read the next section to see how to start up the server. The recommended usad is the current usage listed below the legacy.

(optional 6th step based on legacy code... not sure if it is necessary since we believe it is executed the first time you run make rails)

  1. After starting your server, run bundle exec rake db:seed to seed your database with starter data.

Legacy Usage (based on inherited code)

The Makefile helps simplify starting and stopping the dev server.

make [rails-]fg       # start rails in the foreground normally
make halt             # shut down rails and its dependencies

Rails can also be run in the background using screen(1) as follows:

make [up]             # start rails (in the background) and its dependencies
make [rails-]restart  # restart rails (in the background)
make [rails-]attach   # start rails in the foreground in a screen(1) session

Current Usage (Fall 2018)

# When developing
make rails            # starts rails, pg, and solr, and seeds pg

# IMPORTANT! When finished developing, do this
make halt             # shuts everything down and frees the port

Precompile changes in the assets file

rake assets:precompile

Debugging

Ruby

We use pry and pry-byebug for debugging ruby code. See their respective github repositories for further documentation. In short, you need to have a visible rails server (run make attach in a console) and add a line that reads binding.pry in the file you want to debug, at the line where you want the debugger to begin.

Troubleshooting

In general, we should eventually update ruby and all gems to the most recent version. This will help with old dependencies and any possible security issues.

nokogiri issue

If you run into problems with nokogiri, it may have to do with your ruby version. Make sure you're using ruby version 2.1.3 since we have yet to update. If this does not resolve the problem, trying re-cloning the repo and make sure you set up the environment with rvm ruby version 2.1.3