versions

0 views
Skip to first unread message

Arun Mehta

unread,
May 1, 2009, 11:59:11 PM5/1/09
to rubyonrail...@googlegroups.com
the versions I have:

Rails 2.1.1
ruby 1.8.5

arun

On Sat, May 2, 2009 at 9:24 AM, Anoop Jacob Thomas <ano...@gmail.com> wrote:
> I am using Debian. I dont have it installed. Which Package shall I install?
>
> Please help.
>
> --
> Anoop Jacob Thomas
> Trivandrum
>
> http://anoop.caremedia.org
>
> >
>

james mathew

unread,
May 2, 2009, 12:24:27 AM5/2/09
to rubyonrail...@googlegroups.com
> On Sat, May 2, 2009 at 9:24 AM, Anoop Jacob Thomas <ano...@gmail.com> wrote:
>> I am using Debian. I dont have it installed. Which Package shall I install?
>>

#apt-get install ruby rails

--

HASTA LA VICTORIA SIEMPRE!

Anoop Jacob Thomas

unread,
May 2, 2009, 12:31:20 AM5/2/09
to rubyonrail...@googlegroups.com
Thank you so much(both of you). I am installing it now. And I should be ready with it in no time. :D

Happy Hacking !!!!

Anoop Jacob Thomas

unread,
May 2, 2009, 1:27:18 AM5/2/09
to rubyonrail...@googlegroups.com
I am done with the installation.
I tried a sample ruby program with help from
http://www.ruby-doc.org/docs/ProgrammingRuby/
or you can install rubybook and find it in your file:///usr/share/doc/rubybook/html/index.html

and I tried a sample rails thing from here http://guides.rubyonrails.org/ so it is working.
now ready for the workshop, eager to start with.

Arun Mehta

unread,
May 2, 2009, 11:13:39 PM5/2/09
to rubyonrail...@googlegroups.com
Glad to hear of your progress, Anoop. Do share with the class what
exactly you did. You must document all the steps, so that if you leave
programming for a few months for some reason, you can get back in
quickly.

Anyone set up a database yet?

Arun

Anoop Jacob Thomas

unread,
May 4, 2009, 12:38:20 PM5/4/09
to rubyonrail...@googlegroups.com
Sorry friends,
I was not home for 2 days. So couldn't keep up.

I use Debian. For installation of Ruby and Rails Framework, I used Synaptic Package Manager and selected the packages ruby and rails. Alternatively from your root terminal you can type
apt-get install ruby rails
as James already said.

Now to test if ruby is installed.

I created a File test.rb in my ~/code/ruby/ (~/ - home folder - /home/username)

#!/usr/bin/ruby -w

puts "Hello World"
x = "How are you?"
puts x

First line is the shebang line used to refer to the interpreter to execute the script. -w means with warnings enabled. http://en.wikipedia.org/wiki/Shebang_(Unix)
Second line - puts to print string or to put string.
Third line - store the string "How are you?" into x
Fourth line - print or put contents of string x

Take terminal go to ~/code/ruby
$ruby test.rb               #run the script using ruby interpreter (no need for shebang line)
or
$chmod +x test.rb       #give executable permission for script
$./test.rb                    #execute the script (shebang line is needed)

Now to test if rails is working or if ruby on rails is working.

$rails blog                 #from inside ~/code/ruby - to create a new project named blog, it will create a directory named blog and few files in it. This will create a Rails application that uses a SQLite database for data storage. If you prefer to use MySQL, run this command instead:

$ rails blog -d mysql

And if you’re using PostgreSQL for data storage, run this command:

$ rails blog -d postgresql

TIP. You can see all of the switches that the Rails application builder accepts by running rails -h.

After you create the blog application, switch to its folder to continue work directly in that application:

$ cd blog

In any case, Rails will create a folder in your working directory called blog. Open up that folder and explore its contents.

File/Folder Purpose
README This is a brief instruction manual for your application. Use it to tell others what your application does, how to set it up, and so on.
Rakefile This file contains batch jobs that can be run from the terminal.
app/ Contains the controllers, models, and views for your application. You’ll focus on this folder for the remainder of this guide.
config/ Configure your application’s runtime rules, routes, database, and more.
db/ Shows your current database schema, as well as the database migrations. You’ll learn about migrations shortly.
doc/ In-depth documentation for your application.
lib/ Extended modules for your application (not covered in this guide).
log/ Application log files.
public/ The only folder seen to the world as-is. This is where your images, javascript, stylesheets (CSS), and other static files go.
script/ Scripts provided by Rails to do recurring tasks, such as benchmarking, plugin installation, and starting the console or the web server.
test/ Unit tests, fixtures, and other test apparatus. These are covered in Testing Rails Applications
tmp/ Temporary files
vendor/ A place for third-party code. In a typical Rails application, this includes Ruby Gems, the Rails source code (if you install it into your project) and plugins containing additional prepackaged functionality.

HELLO RAILS! USING RUBY ON RAILS

One of the traditional places to start with a new language is by getting some text up on screen quickly. To do that in Rails, you need to create at minimum a controller and a view. Fortunately, you can do that in a single command. Enter this command in your terminal:

$ script/generate controller home index

TIP. If you’re on Windows, or your Ruby is set up in some non-standard fashion, you may need to explicitly pass Rails script commands to Ruby: ruby script/generate controller home index.

Rails will create several files for you, including app/views/home/index.html.erb. This is the template that will be used to display the results of the index action (method) in the home controller. Open this file in your text editor and edit it to contain a single line of code:

<h1>Hello, Rails!</h1>

Starting up the Web Server

You actually have a functional Rails application already – after running only two commands! To see it, you need to start a web server on your development machine. You can do this by running another command:

$ script/server

This will fire up an instance of the Mongrel web server by default (Rails can also use several other web servers). To see your application in action, open a browser window and navigate to http://localhost:3000. You should see Rails’ default information page

The “Welcome Aboard” page is the smoke test for a new Rails application: it makes sure that you have your software configured correctly enough to serve a page. To view the page you just created, navigate to http://localhost:3000/home/index.


You can run Ruby on Rails on your Apache webserver. Those who already use LAMP.
Check this site http://www.howtoforge.com/ruby_on_rails_debian_etch

--
Anoop Jacob Thomas
http://anoop.caremedia.org

james mathew

unread,
May 4, 2009, 12:48:29 PM5/4/09
to rubyonrail...@googlegroups.com
On Mon, May 4, 2009 at 10:08 PM, Anoop Jacob Thomas <ano...@gmail.com> wrote:
> Sorry friends,
> I was not home for 2 days. So couldn't keep up.
>

Great effort Anoop. I'm guessing that others in our group are also
trying it out even if they are not mailing to the list.
If any of you think that a pre-workshop session is required, we can
arrange for that.

James

Reply all
Reply to author
Forward
0 new messages