Speaking of DRYness,

  I figured out how to reuse rails's scaffold generator in the HAML
generator, to avoid copying all the code.  Basically, instead of
subclassing Rails::Generator::NamedBased,  you subclass
ScaffoldGenerator.   Then you can actually "run"  the original
generator from the haml generator using the m.dependency method, and
copy over the HAML template afterwards.  This can keep the generator
always up to date with the rails generator, instead of being stuck to
the 1.2.2 code.   I'll upload a copy after tweaking,  but if you want
to email me larry, I can send you the file to look at.

-Sidney

On Feb 18, 7:16 am, "Larry Kelly" <[EMAIL PROTECTED]> wrote:
> I've upload another haml generator.  It is called haml_dry_scaffold.
>
>     This is based on the haml_scaffold modifications of the 1.2.2
> scaffold generater code by Sidney. When I played with his genererator,
> and realized home much better my code looked in haml, and home much
> time could by saved by a few more tweaks, I couldn't resist
> tinkering.   I wrote this to save me some time on a current project.
> Feel free to use it, or play with it as the mode strikes you.  It
> differs from the default generator in the following ways:
>
>     1.  It outputs .haml views instead of .rhtml
>
>     2.  The form uses CSS and <fieldset> instead of paragraph
> formatting.
>
>     3.  The style sheet is based on the Dry Scaffold style. The
> stylesheet is named 'haml_dry_scaffold.css'. The stylesheet has not
> been converted to SASS, yet.
>
>     4. Since, I always use a common 'layout/application.rhtml' file,
> this generator doesn't output a 'layout/<model_name>.rhtml' file. If
> you want it to generate a layout, simple uncomment the approproiate
> lines in the haml_dry_scaffold.rb file. ( hint:  commented them out
> with '=begin ..... =end'.)
>     5.  It has no 'haml_resource' generator component.
>
> -Enjoy.
> -Larry Kelly
> Larry's Computer Works
>             ...Does Yours?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to