Difference between revisions of "Ruby-rails"

From Bashlinux
Jump to: navigation, search
Line 2: Line 2:
 
= Installation =
 
= Installation =
 
=== Debian ===
 
=== Debian ===
  +
As root issue the following command:
'''Installation from tarball sources'''
 
# Install Ruby
 
 
<pre><nowiki>
 
apt-get install ruby-full build-essential
 
</nowiki></pre>
 
 
# Install Gems
 
 
<pre><nowiki>
 
wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
 
tar zxvf rubygems-1.3.5.tgz
 
cd rubygems-1.3.5
 
ruby setup.rb
 
ln -s /usr/bin/gem1.8 /usr/bin/gem
 
</nowiki></pre>
 
 
# Install Rails
 
 
 
 
<pre><nowiki>
 
<pre><nowiki>
Line 25: Line 8:
 
</nowiki></pre>
 
</nowiki></pre>
   
 
'''Installation from Debian repositories'''
 
# Install Ruby and Development tools
 
 
 
<pre><nowiki>
+
<pre><nowiki>#!wiki note
apt-get install ruby ruby-dev rubygems build-essential
 
</nowiki></pre>
 
 
# Install Ruby extras
 
 
<pre><nowiki>
 
apt-get install libzlib-ruby rdoc irb ri
 
</nowiki></pre>
 
   
# Install Rails
 
 
<pre><nowiki>
 
apt-get install rails
 
</nowiki></pre>
 
 
 
Other packages:
 
* If MySQL support is needed, then the proper package to be installed is `libmysql-ruby`
 
* If Oniguruma is needed, ensure `libonig-dev` package is present on system
 
 
 
<pre><nowiki>#!wiki note
 
 
'''Binary gems directory is not added automatically on `$PATH`'''
 
'''Binary gems directory is not added automatically on `$PATH`'''
   

Revision as of 06:27, 26 January 2010

Installation

Debian

As root issue the following command:

 gem install rails
 


#!wiki note

 '''Binary gems directory is not added automatically on `$PATH`'''

 In order to run gem binaries available on `bin` folder, the location `/var/lib/gems/1.8/bin` must be added as described in `/usr/share/docs/rubygems1.8/README.Debian`.
 


Fedora

Its very easy, `rubygem-rails` must provide all the needed packages and dependencies

 yum install rubygem-rails
 


Create a Rails Application

  1. Set a location to deploy rails applications (eg. `/var/rails`)
  2. Create Rails application
 mkdir -p /var/rails
 cd /var/rails
 rails newrail
 


Publish a Rail Application

Assuming the name of the Rail Application is `newrail` and the location for all new Rail Applications is `/var/rails`, thus a Rail Application can be published in 2 ways:

  1. Via Builtin Webserver, called WEBrick by running `/script/server` located in the folder where it was created.
 cd /var/rails/newrail/script
 ./server &
 
  1. Via Apache Web Server by setting the proper `DocumentRoot` varible with the location of the `public` folder in the Rail Application
 DocumentRoot /var/rails/newrails/public

 <Directory /var/rails/newrails/public>
     Options ExecCGI FollowSymLinks
     AddHandler cgi-script .cgi
     AllowOverride all
     Order allow,deny
     Allow from all
 </Directory>
  ...