Skip to content

Latest commit

 

History

History
163 lines (131 loc) · 9.13 KB

CMUSV_Students.md

File metadata and controls

163 lines (131 loc) · 9.13 KB

CMU-SV Students

Getting Started for Students

  1. install rails using railsinstaller.org
  2. rvm install ruby-1.9.3-p448
  3. rvm --default use ruby-1.9.3-p448 ()
  4. fork the project on github,
  5. $ git clone http://github.com/URL/cmusv # to get the code
  6. read {file:doc/Git_Directions.rdoc Git Directions}
  7. $ cp config/database.default.yml config/database.yml -- (The default has fake username and password, replace database.yml this information with the real username and password)
  8. set your environment variables (optional step, only needed if you plan to work on these features)
    1. (Nitrous.io) modify .bashrc
    2. (Mac OS X) read http://david-martinez.tumblr.com/post/28083831730/environment-variables-and-mountain-lion (if you set them in bash, then RubyMine doesn't pick them up.)
    3. Note: This requires a restart.
    4. Set these environment variables
      1. see http://whiteboard.sv.cmu.edu/pages/environment_variables for values
      2. LDAP_HOST
      3. LDAP_PORT
      4. LDAP_USERNAME
      5. LDAP_PASSWORD
      6. LDAP_ENCRYPTED
      7. WHITEBOARD_SEARCHIFY_API_URL
      8. WHITEBOARD_SEARCHIFY_INDEX
      9. WHITEBOARD_SEARCHIFY_STAFF_INDEX
      10. WHITEBOARD_SALT
      11. WHITEBOARD_GOOGLE_USERNAME
      12. WHITEBOARD_GOOGLE_PASSWORD
      13. WHITEBOARD_GOOGLE_DOMAIN
      14. WHITEBOARD_S3_BUCKET
      15. WHITEBOARD_S3_KEY
      16. WHITEBOARD_S3_SECRET
      17. WHITEBOARD_TWIKI_USERNAME
      18. WHITEBOARD_TWIKI_PASSWORD
      19. WHITEBOARD_TWIKI_URL
  9. modify the db/seeds.rb and modify the example :your_name_here with yourself
    • Note: When you're prompted to login from the rails site with your email and password, you'll be redirected to google for authentication. After google approves of your credentials and sends you back to the rails site, the email used at time of login will be checked against the local db. This file populates the local db with your email/login data (see :your_name_here).
  10. install postgres
    1. (Nitrous.io) parts install postgresql
    2. (Nitrous.io) parts start postgresql
    3. (Nitrous.io) createdb action-test
    4. (Nitrous.io) defaults to action and action-test
    5. (Local machine) install postgres see http://whiteboard.sv.cmu.edu/pages/postgres_rails
  11. modify config/database.yml
  12. (skip on nitrous.io) install postgres database viewer (ie Navicat Lite http://www.navicat.com/en/download/download.html)
  13. (skip on nitrous.io) install imagemagick
    1. (Directions for a mac)
    2. install brew see http://mxcl.github.com/homebrew/
    3. brew install imagemagick
  14. (onlyon nitrous.io) parts install nodejs (To resolve error: Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtime)
  15. bundle install
    1. If this doesn't work see note below
  16. bundle exec rake db:schema:load
  17. bundle exec rake db:seed (to load the seeds.rb data)
  18. bundle exec rake RAILS_ENV="test" db:schema:load
  19. (Is this necessary for foreman?) echo "RACK_ENV=development" >>.env
  20. verify your configuration
    1. foreman start or rails s thin
    2. bundle exec rake spec (Verify that all the tests pass)
    3. run the server in debug mode in an IDE.
  21. Tip: you can pretend to be any user in your development environment by modifying the current_user method of the application_controller
  22. bundle exec rake doc:app (Generates API documentation for your models, controllers, helpers, and libraries.)
  23. modify RubyMine to use unicorn instead of webbrick. On the tool bar, Run -> Edit Configurations. Instead of default server, pick unicorn.

Installing Git

If you installed rails using railsinstaller.org, you should have git installed.

  • Mac users, Mountain Lion ships with 1.7.5.4 which is good enough.
  • PC users,
    • Download "Full installer for official Git 1.7.6" here: http://code.google.com/p/msysgit/downloads/list (filename is Git-1.7.6-preview20110708.exe ) Run installer, accept license agreement, accept default installation directory, accept default shortcut options, keep all checkboxes checked
    • "Use Git Bash Only" radio button should be selected (per this article, avoids path conflicts)
    • "Use OpenSSH"
    • "Use Unix-style line endings"
    • (Note, these directions are from http://www.wiki.devchix.com)
  • All users, from the terminal window or the command line, execute these commands but put in your own name and email address

Nokogiri issues

When i ran the bundle install, i got a strange error:

Installing nokogiri (1.5.0) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/usr/local/rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... no

libiconv is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.

Followed steps on  http://nokogiri.org/tutorials/installing_nokogiri.html, but had to make sure the version of nokogiri gem being installed was '1.5.0'. So instead of the last command in the instructions page, I had to run this:

gem install nokogiri -v '1.5.0' -- --with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26 --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib

PGSQL PG::Error

On running through the steps, sometimes you might encounter this error:

PGSQL PG::Error (could not connect to server: No such file or directory
  Is the server running locally and accepting
  connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
):

This is happening because OSX (Mountain Lion) comes up with a version of Postgres pre-installed. This is getting picked up instead of the one you manually installed. Doing one of the below should resolve the issue:

  1. Add /usr/local/bin to the $PATH directory

If you used Homebrew for installation, then a symbolic link to the postgres executable is placed in the directory /usr/local/bin. Ensure it's there and then add that directory your PATH environment variable.

  1. add a specific host to your database.yml

Your database.yml should look similar to the below:

development:
    host:     localhost
    adapter:  postgresql
    encoding: utf8
    database: cmu_education
    ...

Rubymine debugger doesn't work

Ensure you have the right debugger gems installed. Follow this thread on StackOverflow that clearly points out the steps.

Failed to build gem native extension/No source for ruby-1.9.2 found

This only applies if you use rbenv instead of rvm.

Building native extensions.  This could take a while...
ERROR:  Error installing debugger:
        ERROR: Failed to build gem native extension.

        /Users/trongducdong/.rvm/rubies/ruby-1.9.3-rc1/bin/ruby extconf.rb --with-ruby-include=PATH_TO_HEADERS
checking for vm_core.h... no
checking for vm_core.h... no
Makefile creation failed
**************************************************************************
No source for ruby-1.9.3-rc1 provided with debugger-ruby_core_source gem.
**************************************************************************

While installing new ruby versions, the source libraries are not added by default. You can choose to keep the source libs by issuing this command:

rbenv install 1.9.2-p180 --keep

The following links might also be useful in your quest to understanding this issue:

  1. Stackoverflow - error failed to build gem native extension
  2. github issue - debugger
  3. Keeping build directory after installation with rbenv.

Compiling and deploying assets to Heroku:

(The following commands and rakes assume that you are already using asset_sync gem and that it is configured correctly):

  1. Delete any assets found under the public folder: bundle exec rake assets:clean
  2. Compile new assets to generate/update the manifest.yml: bundle exec rake assets:precompile:all RAILS_ENV=production , heroku needs the production environment. You can change this to development if you want to make a quick test. But be ware that you can not predict the full assets behaviour until you test it on the production. This command might take some time, so be patient.