On Thu, Apr 28, 2011 at 10:17 PM, Didin Ibnu Sarnan
[email protected]wrote:
Thank you
I think that some PHP ideas don’t translate directly to Ruby (I don’t
know
PHP, so this is just my impression). Ruby is a general purpose language,
so
it is used for all sorts of things and isn’t hooked up to the internet
by
default (for example, most of the things I use Ruby for don’t have
anything
to do with web applications), and it isn’t embedded in a template by
default
either (PHP might not be, but that’s just how I’ve always seen it).
I think the easiest solution will be this:
$ gem install sinatra shotgun --no-ri --no-rdoc
(that will install the libraries locally, if that doesn’t work, you will
need to either edit your path or use sudo)
Then create a file hw.rb that looks like this:
require ‘sinatra’
get ‘/’ do
“hello, world!”
end
That uses the sinatra web micro-framework to create a web application.
Then, run that application with $ shotgun hw.rb
Sinatra will know how to serve itself up, and shotgun will know how to
reload the file every time you make a request, this allows you to save
your
document and reload your page without having to stop and start your
server.
Finally, go to (http://localhost:9393/) in your browser. If everything
is
working correctly, it will say “hello world”
From there, check out (Sinatra: README) which will
help
you make Sinatra do interesting things for you. I also recommend this
great
screencast (http://peepcode.com/products/sinatra), where they’ll walk
through a lot of the features and write an application with a database
back
end.
You’ll need to learn the Ruby language as well, though. I’m not sure
what
people consider good resources for that, you’ll have to ask around. If
you’re comfortable with programming, you could take a look at Ruby
Kickstart, a curriculum I wrote to teach my friends Ruby (
GitHub - JoshCheek/ruby-kickstart: An interactive guide to learning the Ruby programming language.).
Once you are comfortable with all of that, you should be primed for Ruby
on
Rails, If that is where you’re wanting to head, then I recommend
http://guides.rubyonrails.org/ as the best resource I’ve seen for
learning
Rails.
Anyway, welcome to Ruby