haml == fun
March 27th, 2007
I just spent the obligatory 20 minutes with haml and it’s css brother sass. I really enjoy both. I created a test project and converted some scaffold_resource generated rhtml into haml in very little time. I’m sure others have pointed out that it’s attention to tabs makes it very python-esque, but I like it. I think forcing proper tabs in HTML is a good thing.
Is the resulting .haml superior to the rhtml it replaces? The definitive answer: depends
The biggest problem I see with haml and sass is the barrier to entry (albeit small…it’s still there). I’m often working with designers that are savvy enough to get into the views and fix things that need fixing. RHTML is perfect for them. Most have used PHP before and have no trouble realizing <%= %> is dynamic content. They just work around that and all is well. In this situation, rhtml wins. You want the designer you’re working with to be as comfortable as possible (read: fast).
All that said, haml was fun. If you’re doing a solo project or on a team that’s willing to spend the 20 minutes per person to learn it, I think it’d be the way to go. I’ll probably be cutting some of the templates in mybizexpenses over to haml for fun.
My First Plugin - uptime_generator
March 9th, 2007
After I posted my last entry I was chatting with Louie about it and he helped me realize it might be a good job for a generator. Having never created a plugin nor a generator before, I had some learnin’ to do. Well, that learnin’ happened. You can reap the benefits via
Then run:
Your app should now respond to /success.txt.
At this point you could deploy and point your favorite uptime svc at that URL, or you could open uptime_controller.rb and make the ‘success’ method more robust.
Enjoy!
Useful resources:
Explanation on creating a generator: http://wiki.rubyonrails.org/rails/pages/UnderstandingGenerators
Example generator: http://topfunky.net/svn/plugins/topfunky_power_tools/
I also peeked at the scaffold_resource generator from rails proper.