Skip to content

Quick Reference

Glen Horton edited this page Oct 30, 2015 · 39 revisions

###Scholar@UC

#####Run entire test suite on Curate Gem

  1. cd curate_fork
  2. bundle exec rake jetty:start
  3. bundle exec rake spec or if the test app doesn't exist yet bundle exec rake clean generate spec
  4. bundle exec rake spec

#####Run some tests on Curate Gem

  1. cd curate_fork
  2. bundle exec rake jetty:start
  3. BUNDLE_GEMFILE=./spec/internal/Gemfile bundle exec rspec path/to/spec.rb:LINE

#####Run entire test suite on Scholar application

  1. cd scholar_uc
  2. bundle exec rake jetty:start
  3. bundle exec rake spec

#####Run some tests on Scholar application

  1. cd scholar_uc
  2. bundle exec rake jetty:start
  3. rspec path/to/spec.rb:LINE

###Hydra

#####solr

  • Reindex: bundle exec rake solr:reindex (background workers need to be running)

###Ruby on Rails

#####Rails Console

  • Find a user: User.find_by_email('user@exmaple.com')
  • Find a user by a column: User.where(email: 'user@example.com')
  • Display certain fields: User.select('first_name,last_name,email').all
  • Display results in yaml format: y User.all
  • Mass update a column for multiple users: User.update_all(department: 'IT')
  • Grep methods for a class: User.methods.grep(/email/)

#####Comment out an entire block of code

  • Put =begin above first line and =end below last line.

#####Wipe the rails database

  • `bundle exec rake db:reset

#####Debugging with byebug

  • Add the byebug gem to your app: gem 'byebug'
  • Add byebug to spot you want a breakpoint in your code
  • Start rails server and watch the logging output
  • Byebug commands:
    • help OR help
    • n - next line
    • c - continue
    • eval - change data
    • finish
    • step - run one executable unit
    • q - quit
    • p OR display - display value of a variable
    • break <step #> - adds a breakpoint at <step #>

###Miscellaneous

#####Sync a copy of your local development files to Larry

  1. rsync -avz -e ssh --delete /path/to/files username@larry.libraries.uc.edu:~/path/to/files
Clone this wiki locally