I don’t think I’ve enjoyed writing a Hello World this much since my first (I think it was Qbasic)
:D
Hello World will never get old for me. What more could you need to get yourself oriented in a new technology? I remember the first time I managed to string the whole J2EE stack together. All that technology – JNDI, RMI, EJB… All just to get “Hello World” on the screen. Hmmm. Can’t say I miss that too much.
Where was I?
Oh yes. One of the main features of Hobo is DRYML - an new template engine that extends ERB with user-defined tags. Thats right: extends. DRYML templates can use erb scriptlets just like regular RHTML templates.
We’re going to create a custom tag <hello> which will render - you
guessed it - “Hello World” on the page. Obviously, the real goal here is to get
Hobo installed and verify that it’s running.
To run Hobo you need Rails 1.2, which at the time of writing is available as release-candidate 1. Install it like this:
gem install rails --source http://gems.rubyonrails.org -y
To install Hobo into a new Rails app, simply:
$ rails hobo_hello_world
$ cd hobo_hello_world
$ ./script/plugin install svn://hobocentral.net/hobo/trunk
Next, there are one or two directories and files that Hobo expects to find. Create these with the handy generator:
$ ./script/generate hobo
create app/views/hobolib
create app/views/hobolib/themes
create app/views/hobolib/application.dryml
OK, Hobo is now at your service! Before we can have a Hello World view, of course, we’ll need a controller:
$ ./script/generate controller hello
No need to edit that. We’ll just go straight for the view.
<def tag="hello">Hello World!</def>
<p>Here it comes... Can you stand it??!</p>
<p style="font-size: 500%"> <hello/> </p>
That’s it. Start your engines:
$ ./script/server
And browse yourself over to localhost:3000/hello/hello_world
Outstanding work people. If that has whet your appetite and you want more, I suggest you haul your digital assets over to either Why DRYML? or A Quick Guide to DRYML.
I don’t think I’ve enjoyed writing a Hello World this much since my first (I think it was Qbasic)
:D
Nice
i’m thinking about using hobo for a project at work. is there any example showing how to output xml with DRYML?
I was not able to install the hobo-stuff with ‘ruby script/plugin install …’.
After typing and confirming with enter, the system works for a while and then i see the cursor again (no failure message, or anything else).
Is there any special HINT i am not aware of?
Michael,
to make it through the tutorial,
I’d suggest you use the gem instead of the plugin.
1st download the gem
http://hobocentral.net/gems/hobo-0.5.3.gem
then...
7 simple shell commands:
gem install hobo-0.5.3.gem
cd /tmp/
hobo myhoboapp
cd myhoboapp
script/generate controller hello
vi app/views/hello/hello_world.dryml
script/server
Then browse URL:
http://localhost:3000/hello/hello_world.dryml
-Dan
Hi Dan,
thank you very much for your suggestion.
With gem it works fine. Now I can enter the Hobo.
With kind regards,
Michael
Michael, check if You have SVN command line tool for windows installed. I had the same problem so I’ve downloaded app from http://svn1clicksetup.tigris.org/, installed it, rebooted system and voila - it works :)
Awesome. Love it when a tutorial works as expected.
Hopefully I can wrap my head around all this soon.
Dave