Archive for Uncategorized

Upate Ruby Gems on Mac OS X 10.5 Article

This nice article describes how to update Ruby Gems on Mac OS X Leopard 10.5:

Updating_to_RubyGems_1.3.0_on_Mac_OS_X_Leopard_10.5.4

Comments (4)

Git Cloning and Git Forking Differences

Git Cloning and Git Forking differences are described in this article

Git Cloning

Cloning is to make a copy of a remote repository into your local development environment.

Git Forking

Forking is to clone an entire remote repository into another remote repository.

Comments (3)

Create A Rails App With Passenger Phusion On Mac OS X Leopard

This article guides you through the process of creating a Ruby on Rails application using Passenger Phusion (mod_rails) on a Mac OS X Leopard. The article assumes that both Rails and MySQL have already been installed.

Here are the 11 steps to get a Passenger Phusion based Rails app going:

Step 1 - Stop Apache

System Preferences >> Sharing

Uncheck Web Sharing

Step 2 - Install Passenger Gem

$ gem install passenger

Step 3 - Install Apache Module

$ passenger-install-apache2-module

Step 4 - Apache Config Edits

edit /etc/apache2/httpd-conf and add the following three lines:

LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-2.0.6/ext/apache2/mod_passenger.so
PassengerRoot /Library/Ruby/Gems/1.8/gems/passenger-2.0.6
PassengerRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby

Step 5 - Create Virtual Host

This step allows us to access a local Wordpress blog from http://wp.local

Edit /etc/hosts and add the following line:
127.0.0.1 railstestapp.local

Edit /etc/apache2/extra/httpd-vhosts.conf

<VirtualHost *:80>
ServerAdmin webmaster@railstestapp.local
DocumentRoot "/Users/user/Sites/railstestapp/public"
RailsEnv development
ServerName railstestapp.local
ServerAlias *.railstestapp.local
ErrorLog "/private/var/log/apache2/railstestapp.local-error_log"
CustomLog "/private/var/log/apache2/railstestapp.local-access_log" common
</VirtualHost>

The RailsEnv development line is required to run the Rails app in development mode. Also, note that the document root is the public directory.

Step 6- Start Apache

System Preferences >> Sharing

Uncheck Web Sharing

Step 7 - Create a Rails App


$cd /Users/user/Sites
$rails railstestapp

Step 8 - Connect Rails With MySQL Database

Edit your database.yml file in your Rails app so it looks like this:


development:
adapter: mysql
database: railstestapp_development
username: root
password: password
socket: /tmp/mysql.sock

test:
adapter: mysql
database: railstestapp_test
username: root
password: password
socket: /tmp/mysql.sock

production:
adapter: mysql
encoding: utf8
database: railstestapp_production
username: root
password: password
socket: /var/run/mysqld/mysqld.sock

Step 9 - Create the Database


rake db:create

Step 10 - Create Model/Controller/View


ruby script/generate scaffold Post title:string body:string

Step 11 - Try It


http://railstestapp.local/posts

References

The following article gave me the clue on how to set the Rails app in development mode:
http://benr75.com/2008/04/12/setup-mod_rails-phusion-mac-os-x-leopard

Installing Passenger Phusion instructions at: http://www.modrails.com/install.html

Comments (1)

Hello World (from Todd Dewell)

This is my first post from a hosted Word Press blog.

Leave a Comment

Hello world!

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!

Comments (9)