User Tools

Site Tools


Sidebar


guides:programming:ruby_basics

Ruby Basics

Walk through steps of getting a ruby app working from git

Clone the app repo from github

git clone git@github.com:<repoOwner>/<repoName>.git

Check gems installed and requirements

Show gem env:

gem env

Show gems installed:

gem list

Try and run the server

Install the gems and plugins that the application needs if error showup when trying to run server

Runs local server:

./script/server

Run ruby on different port

ruby script/server -p <portnumber>

Auto install gems required application gems

In directory 'config' the file 'environment.rb' lists required gems that needs to be installed for the application:

To install the gems required for an application:

rake gems:install

Manually install gems required by application Examples:

gem install RedCloth
gem install haml 
gem install sqlite3-ruby

Manually install gems by specific version Examples:

gem install sunspot -v 0.10.6

Add gems source if needed Example:

gem source -a http://gems.github.com
gem sources -a http://gemcutter.org

Setup DB

Builds the dbs

rake db:setup
rake db:load
rake db:seed SEED=all

Build Test DB

Clones current db to test db:

rake db:test:clone

Ruby TESTING

Run all test:

rake test

Model tests:

rake test:units

Controller tests:

rake test:functionals

Logs value to the log

logger.info <string>
logger.error <string>
logger.warning <string>

Deploy Ruby App using Capistrano

cap production deploy
guides/programming/ruby_basics.txt · Last modified: 2010/03/01 11:13 by michaelc