RubyOnRails on slackware-12.1

On a bit of a break from school (the month of May), i figured to keep the spirit going and learn a language, so i have been reading up on Ruby and Rails. The Pragmatic Programmer’s Guide

to have a sandbox for my exploration, i had to get certain aspects of this working on my machine. while ruby-1.8.6 is in the Slackware-12.1 base, the fcgi, mod_fcgi, rubygems and rails was not. so i tasked myself to contribute what I found.

first

:: fcgi

i have made available a SlackBuild to use for fastCGI and mod_fcgi, on http://hashbangbash.com/pub/src/SlackBuilds/fcgi/, so for this from your command line do

$> svn co http://hashbangbash.com/pub/src/SlackBuilds/fcgi/ $> cd fcgi/ $> . fcgi.info && wget $DOWNLOAD $> export $(grep DOWNLOAD README) $> sudo sh fcgi.SlackBuild $> sudo installpkg /tmp/fgci-2.4.0-i486-1_SBo.tgz

and include in your /etc/httpd/httpd.conf

Listen 8080

second

:: rubygems

rubygems is the Official package manager for Ruby. Their Website

their current stable is 1.1.1, so

$> wget http://rubyforge.org/frs/download.php/35283/rubygems-1.1.1.tgz $> tar xzvf rubygems-1.1.1.tgz $> cd rubygems-1.1.1 $> sudo ruby setup.rb $> sudo gem update --system

i have not cleanly gotten a rubygems SlackBuild going, because the ‘setup.rb’ builds and installs to the directory of the ruby excutable used to call it, so if ruby is in $PATH at /usr/bin, thats where it will install. so the –prefix= and DESTDIR are not as easily utilized. :/

third

:: rails

pretty straight foward, this will install these gems in a ruby sub-directory,

$> gem install rails --include dependencies

fourth

:: httpd stuff

add to the /etc/httpd/httpd.conf of /etc/httpd/extra/httpd-vhosts.conf the section for your website, substitute for you own paths.

<VirtualHost *:8080> DocumentRoot /var/www/htdocs/rails/new_project/public ServerName rails.batts.lan ErrorLog /var/log/httpd/new_project-error_log CustomLog /var/log/httpd/new_project-access_log common Options Indexes ExecCGI FollowSymLinks RewriteEngine On <Directory /var/www/htdocs/rails/new_project/public> AllowOverride all Options Indexes ExecCGI FollowSymLinks Order allow,deny Allow from all </Directory> </VirtualHost>

and then make your website directory `On a bit of a break from school (the month of May), i figured to keep the spirit going and learn a language, so i have been reading up on Ruby and Rails. The Pragmatic Programmer’s Guide

to have a sandbox for my exploration, i had to get certain aspects of this working on my machine. while ruby-1.8.6 is in the Slackware-12.1 base, the fcgi, mod_fcgi, rubygems and rails was not. so i tasked myself to contribute what I found.

first

:: fcgi

i have made available a SlackBuild to use for fastCGI and mod_fcgi, on http://hashbangbash.com/pub/src/SlackBuilds/fcgi/, so for this from your command line do

$> svn co http://hashbangbash.com/pub/src/SlackBuilds/fcgi/ $> cd fcgi/ $> . fcgi.info && wget $DOWNLOAD $> export $(grep DOWNLOAD README) $> sudo sh fcgi.SlackBuild $> sudo installpkg /tmp/fgci-2.4.0-i486-1_SBo.tgz

and include in your /etc/httpd/httpd.conf

Listen 8080

second

:: rubygems

rubygems is the Official package manager for Ruby. Their Website

their current stable is 1.1.1, so

$> wget http://rubyforge.org/frs/download.php/35283/rubygems-1.1.1.tgz $> tar xzvf rubygems-1.1.1.tgz $> cd rubygems-1.1.1 $> sudo ruby setup.rb $> sudo gem update --system

i have not cleanly gotten a rubygems SlackBuild going, because the ‘setup.rb’ builds and installs to the directory of the ruby excutable used to call it, so if ruby is in $PATH at /usr/bin, thats where it will install. so the –prefix= and DESTDIR are not as easily utilized. :/

third

:: rails

pretty straight foward, this will install these gems in a ruby sub-directory,

$> gem install rails --include dependencies

fourth

:: httpd stuff

add to the /etc/httpd/httpd.conf of /etc/httpd/extra/httpd-vhosts.conf the section for your website, substitute for you own paths.

<VirtualHost *:8080> DocumentRoot /var/www/htdocs/rails/new_project/public ServerName rails.batts.lan ErrorLog /var/log/httpd/new_project-error_log CustomLog /var/log/httpd/new_project-access_log common Options Indexes ExecCGI FollowSymLinks RewriteEngine On <Directory /var/www/htdocs/rails/new_project/public> AllowOverride all Options Indexes ExecCGI FollowSymLinks Order allow,deny Allow from all </Directory> </VirtualHost>

and then make your website directory`

fifth

:: rails’ing it up

from here you are kind of own your own,

with ‘pwd’ as your rails base directory, you can scaffold up a rough framework, in my case i am using a mysql database, so

$> pwd /var/www/htdocs/rails/ $> rails -d mysql new_project $> cd new_project $> vi config/database.yml

and change the database information to your database host, name, user, and pass.

and read the README in that directory, and read the ‘./script/generate –help’

also, a gotcha, ensure the space you are usind (test, production, development), matches the RAILS_ENV in the httpd opts.

cheers,

vb