Tuesday, December 26, 2006

Install a RubyOnRails app on a Site5 account

1) Open SSH client PUTTY and and go at the root of your personal directory (place where you can see the directory public_html).

2) Using FTP, upload the following directories:
* app
* public
* config
They should contain all the files created (but upload also the other directories if you have created files in other dir than the ones listed)

3) Now let's create symbolic link,
ln -s /home/{username}/apps/site/curent/public public_html

4) We have to declare the symlinks by creating the .htaccess file:
vi public_html/.htaccess

and following lines of code,

Options +FollowSymLinks +ExecCGI
RewriteEngine On


5) Next step is to modify the permissions (make the files executable)
Code:
chmod -R 755 your_app/*

6) Edit your public/dispatch.cgi, public/dispatch.fcgi file and replace the first line like this:
replace #!/usr/bin/ruby18 with #!/usr/bin/ruby

Restarting dispatch.fcgi,
pkill -9 -u thezixo -f dispatch.fcgi


At this stage you may want to test the installation by visiting the address:
http://www.your_domain.com/your_other_app_name/
or http://www.your_domain.com:3000/your_other_app_name/
You should obtain the congratulations page of the server running perfectly well.

7) Once you're done testing this, we're gonna create a simple route to display a page as the index page (like an index.html or index.php page)
First delete the index.html in the public dir unless you want to use it.
rm your_app/public/index.html
then,
vi your_app/config/routes.rb
then,
map.connect '', :controller => 'your_controller', :action => 'action_to_be_seen_as_index'

8) Finally, edit the environment.rb file to put the app into production mode:
vi your_app/config/environment.rb
then add the following line before the RAILS_ENV declaration, like this:
ENV['RAILS_ENV'] = "production"
RAILS_ENV = ENV['RAILS_ENV']


Now, you should be allright and ready to show your work to the rest of the world !
You will be able to access the index page by typing:
http://www.your_domain.com/your_another_app_name/

Friday, December 22, 2006

Intermediate::Rails

Rails is the M-V-C ( Model - View - Controller ) open-source framework written in Ruby, it is also called as Ruby on Rails(RoR). It is for developing database web applications.







Rails Installation



  • Ruby must be installed for rails installation.


  • Check for gem installation by typing gem --version in a command window.


  • Now we will use RubyGems to install Rails.



      Check whether your internet connection is active.

    In a command window, type gem install rails --include-dependencies


  • Now you are ready to run rails(RoR).


  • To update your rails application, simply type gem update rails in command window. This will automatically update your rails installation.




  • Getting Started with a New Rails Application




    1. Create new Rails application by the command rails , like c:\>rails demo

    2. This will automatically create rails application name ‘demo’ with standard directory structure.

    3. Change directory to c:\>cd demo, then Start WEBrick server by the command c:\demo>ruby script/server . Then access http://localhost:3000/ in the browser, you should see a screen that looks like this.



    4. This confirms that the installation was successful and Rails is running.

    Sunday, December 17, 2006

    Beginner::Ruby

    Welcome to learn Ruby.
    This will help to beginner's of ruby.

    Ruby Installation
    Download Ruby one click installer for windows, also there are ruby versions for Linux and OS X. Also you can download Ruby here.

    Tuesday, December 12, 2006

    My First Post

    Hello Guys

    I just started sharing my knowledge and inviting others to do the same

    Thanks