#82 √ resolved
David Lee

merb-gen should generate .haml views instead of .erb if haml gem is detected

Reported by David Lee | March 21st, 2008 @ 01:01 AM | in 1.0

Or at least have a way to specify that you want to generate view templates in a certain format in init.rb.

Comments and changes to this ticket

  • Ezra Zygmuntowicz

    Ezra Zygmuntowicz March 24th, 2008 @ 07:46 PM

    • → Assigned user changed from “” to “Daniel Neighman (hassox)”
    • → State changed from “new” to “open”

    this one is all you Daniel, if you can come up with a good way of doing it.

  • Michael Klishin (antares)

    Michael Klishin (antares) May 11th, 2008 @ 07:50 AM

    • → Milestone changed from “” to “1.0”
  • jonuts

    jonuts May 12th, 2008 @ 03:47 AM

    I have this working (mostly).

    You can check it out at http://github.com/jonuts/merb-mo....

    $merb-gen app myapp --haml adds a merb-haml dependency as well as generating application.html.haml. If "merb-haml" is listed as a dependency then when you generate a controller or resource it hamlizes all of the views.

  • jack dempsey (jackdempsey)

    jack dempsey (jackdempsey) June 11th, 2008 @ 11:32 PM

    jonuts,

    is this still valid? i tried to follow the link above but it appears invalid?

  • jonuts

    jonuts June 12th, 2008 @ 06:17 AM

    Yeah, I suck at git and messed up the repo pretty horrendously.

    New repo: http://github.com/jonuts/merb-more

  • jonuts

    jonuts August 3rd, 2008 @ 06:56 PM

    • → Tag changed from “” to “generators merb-haml”

    I have this updated for templater now.

    Please check it out and let me know what you think.

  • jack dempsey (jackdempsey)

    jack dempsey (jackdempsey) August 3rd, 2008 @ 07:34 PM

    I'll look at this tonight, thanks jonuts

  • jack dempsey (jackdempsey)

    jack dempsey (jackdempsey) August 3rd, 2008 @ 10:50 PM

    • → Assigned user changed from “Daniel Neighman (hassox)” to “jack dempsey (jackdempsey)”

    jonuts,

    I could generate the application.html.haml file ok, but when i try to generate a controller i get this error:

    ~/testbed/foox $ merb-gen controller bar

    /Users/jackdempsey/testbed/foox/app/views/layout/application.html.haml:3: Illegal Nesting: Nesting within plain text is illegal. (Haml::SyntaxError)

    from /usr/local/lib/ruby/gems/1.8/gems/haml-1.8.2/lib/haml/precompiler.rb:296:in `push_plain'

    Looking at application.html.haml and seeing the <% %> tags in it, it doesn't seem right....any thoughts?

  • jonuts

    jonuts August 4th, 2008 @ 12:38 AM

    • → Assigned user changed from “jack dempsey (jackdempsey)” to “Daniel Neighman (hassox)”

    Ah sorry. Update your templater gem. I made an adjustment to templater before I submitted this.

  • jonuts

    jonuts August 4th, 2008 @ 12:39 AM

    • → Assigned user changed from “Daniel Neighman (hassox)” to “jack dempsey (jackdempsey)”

    oops didn't mean to change that

  • jack dempsey (jackdempsey)

    jack dempsey (jackdempsey) August 4th, 2008 @ 01:02 AM

    hey jonuts,

    Thanks, i updated things and it looks like it works nicely. I was talking with wycats and others about this functionality and we agreed that given the specificity of this being a haml related feature, it should really belong in merb-haml.

    At this point I'm not sure we have a clear way of hooking things into from merb-haml, but given the desire to use haml, and the value this patch provides, I'm sure we'll figure out a way. I'll update this again when we're there.

    thx again!

  • jonuts

    jonuts August 4th, 2008 @ 01:41 AM

    Cool.

    I disagree about this being a haml specific feature though. It's a template feature that defaults to erb and supports haml. It is trivial to add support for other template languages as well. The way I set it up does happen to be haml specific but that is also easily changed.

    I see it as the same way you are able to set your orm from the command line, you should be able to set your template language of choice as well.

  • Jonas Nicklas

    Jonas Nicklas August 4th, 2008 @ 02:10 PM

    The ORM:s are being moved out to their respective plugins, where they were before. Moving those templates into merb-gen was only a temporary measure to smooth the transition.

    I've spoken with wycats about this and we agreed that this belongs in merb-haml and not in merb-gen itself. Merb-gen should stay as small as possible. I'll check out the changes and we should be able to figure out a way of making this work.

  • Jonas Nicklas

    Jonas Nicklas August 4th, 2008 @ 02:12 PM

    BTW... if we are serious about this, maybe we should add a hook into merb-core to specify a default templating language (like we do for ORM and testing framework) that way, we won't have to specify --haml all the time when generating things. I'm not sure if this is overkill?

  • Michael Klishin (antares)

    Michael Klishin (antares) August 4th, 2008 @ 02:27 PM

    @Jonas: it's not, sounds reasonable.

  • jack dempsey (jackdempsey)

    jack dempsey (jackdempsey) August 4th, 2008 @ 02:33 PM

    I agree, --haml was one piece I wanted to look at changing.

    Something like "use_templater :haml" or "use_views :haml"? I'm sure we can come up with a good name for it.

  • Michael Klishin (antares)

    Michael Klishin (antares) August 4th, 2008 @ 02:36 PM

    Kernel#use_template_engine maybe?

  • jonuts

    jonuts August 4th, 2008 @ 02:40 PM

    +1 for use_template_engine

    or just use_template

  • Jonas Nicklas

    Jonas Nicklas August 17th, 2008 @ 05:20 PM

    • → State changed from “open” to “resolved”

    This is now merged and you can all merrily use your fancy haml views. Have fun.

    use_template_engine :haml
    

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins