Tuesday, July 04, 2006

Verifying Rails Installation

When you install the Rails framework, you also get a new command-line tool, rails, which is used to construct each new Rails application that you write. The rails command creates the right directory structure for you and populates it with some standard Rails code.

We shall create a very small web application to verify our Rails installation.

Open a command window and navigate to a place in your filesystem where you would want to create your application's directory structure. I am creating it in a folder called work and the path on my machine is c:/rails/work Switch to the work folder and use the rails command to create an application called demo, as follows.
c:/rails/work>rails demo

The command has created a directory named demo. Within the demo folder there are many other folders and files created for you. Amongst all of this, you will find a folder called script, that contains some utility scripts that we will be using as we develop our application. For now, we will use the server script that starts a stand-alone web server that can run our newly created Rail application under WEBrick (this is a pure-Ruby web server that comes along with Ruby). So type the command:
c:/rails/work/demo>ruby script/server

We have just started a web server at port 3000. We can now access the application by pointing a browser at http://localhost:3000
You can press control-C to stop WEBrick.

First Post | Previous | Next


Technorati Tags:
Blogs linking to this article

6 Comments:

Blogger Ashish Kulkarni said...

Raj,

That is where a WebServer like Apache comes into play. It resolves incoming domain requests to individual applications.

Other option is to run ROR on port 80 instead of 3000.

And then, to test, add the following entry into your Windows Hosts file:

xyzdomain.com localhost

This will redirect any requests for xyzdomain.com to localhost.

Satish,

I have got the welcome page.

I am aware of how Apache can be configured to run with Tomcat. Is there any documentation around how this can be done for ROR?

Regards,

Ashish.

3:25 PM  
Blogger Unknown said...

For Apache, refer page 455 of the book 'Agile Web Development with Rails'

3:56 PM  
Blogger Unknown said...

Sandip this link is already there in our List of Resources. However, if you read thro' the FAQ, it does not answer many questions being asked by our participants.

11:16 AM  
Blogger Unknown said...

Sandip, the quick reference link seems to be good. Will have a look.

11:48 AM  
Blogger Gaurav V Bagga said...

hi,

i have been hearing a lot of book "Agile Web Development With Rails" ,how to get this book for free as buying it in $$$ does not seems viable

any suggestions!

what can be done......

5:49 PM  
Blogger Aspirations said...

Done with the verification.

12:22 PM  

Post a Comment

<< Home