What’s that? RSpec Haml Scaffolds? Yes, it is!

Daniel on March 11th, 2008 3 Comments

Some people use scaffolds, some people don’t. To those who do and happen to have their project taking advantage of Haml, probably understand the pain it is to go through all those lame rhtml files and convert them to Haml. Thus, a quick and dirty solution has arrived. Meet your master: “RSpec Haml Scaffolds”.

It’s hosted at github over here:
http://github.com/dfischer/rspec-haml-scaffold-generator

To install the git way (until Rails’ script/install supports git) do this in your rails_root/vendor/plugins directory:

git clone git://github.com/dfischer/rspec-haml-scaffold-generator.git

Bam, you’re done. You should have a rspec-haml-scaffold folder in your vendor/plugins directory and when you fire up the following command:

script/generate

You should see “rspec_haml_scaffold” in the “installed generators…plugins” section.

Remember this is a quick and dirty version of the plugin. There may be a couple quirks with it, if so feel free to fork the repository on github and submit a patch!

p.s If anyone needs a github invite I have three left. All you need to do is request one in the comments, be sure to leave a way to contact you.

Tags: , , , ,

3 Responses to “What’s that? RSpec Haml Scaffolds? Yes, it is!”

  1. Rob O Says:

    Nice! I’ve been annoyed by the erb scaffolding ever since I switched to get.

    I’ll take an invite. rko618 (the at sign) gmail dot com

    Thanks

  2. Rob O Says:

    I’d like to suggest changing to the README examples to be, for example:

    ./script generate rspechamlscaffold post # no attributes, view will be anemic

    instead of ’scaffold’. This confused me at first because I thought once I installed the plugin I could use the regular scaffold command instead of rspechamlscaffold.

    * Rob

  3. Will Jessup Says:

    Rob,

    Good point, I think that’s why Daniel mentioned this was an early release. Another point to make is that the Model type generator thingy (so you can say generate post title:string body:text) is broken as well.

    To solve the above problems I’m working right now on a new version of the plugin that also takes make_resourceful as a dependency. Should be out this afternoon….

    Will

  4. Daniel Fischer Says:

    Thanks for pointing that out, I updated the readme for a warning and the change of syntax.

    Also to point out, the plugin Will was talking about is also on a public repo now:

    http://github.com/dfischer/sexy_scaffold/tree/master

  5. Rob O Says:

    Do you intend to merge the two plugins in the future? No reason to have two very similar plugins when they are both so young.

  6. Daniel Fischer Says:

    That was the original idea until we moved in the direction of making the “sexy_scaffold” plugin pretty feature intensive, and with a couple dependencies. The majority of people may not want that, so we’ll see what the best route to take is. At the current moment it will be separate libraries. An advanced scaffold generator, and then a simple drop-in replacement for RSpec scaffolds to support Haml templates.

  7. Mitchell Says:

    I’m gonna check this out. I’m currently redoing my website from ground up so this showed up just in time. Also if you have an extra github invite I could use one nu2rails[at]live[dot]com

  8. Will Jessup Says:

    Mitchell,

    Try the sexyscaffolds and use makeresourceful. I’m curious to see how it works for you.

    Will

  9. Zach Inglis Says:

    Would love this as a gem :)

    Well done! Great plugin.

  10. PG Says:

    Any chance I could have one of the github invites please — assuming you still have some available :)

    Thanks

    PG

  11. Yitzhak Bar Geva Says:

    Thanks for the great scaffold. Got me jumpstarted with RSpec, HAML & Rails 2.0

  12. Rev. Dan Says:

    I thought to myself this evening “wouldn’t it be sweet if there was Haml scaffolding” so I did that “using google” thing and found that not only was there Haml scaffolding but RSpec + Haml scaffolding. Badass!

    My hat is off to you! Woot!

  13. Lyqwyd Says:

    Too bad it doesn’t work, seems like multi name models will be created incorrectly, and specs seem to still be broken after manually fixing the model name. oh well…

  14. Chris B Says:

    Small world Rev. Dan, I was just thinking to myself this evening that it would be very cool if there was rspec + haml scaffolding and here I find it two weeks after you did.

Leave a Reply