How do I write a generator?

I’d like to take some advice and write a generator to change the
scaffold.css. How do I do that? I looked on the wiki and googled it
but have not found anything yet.

Any help would be much appreciated.

bruce

On Jan 6, 2006, at 1:45 PM, Bruce B. wrote:

http://lists.rubyonrails.org/mailman/listinfo/rails

Bruce-

There isn't a whole lot of documentation on how to write a generator

that I have seen. You are better off dissecting one yourself. Here is
a very simple one for you to play with that I wrote. Its just a
lighttpd.conf file generator for either scgi or fcgi configuration
generation. But it ought to show you how to build a basic generator
so you can look at some more complex oones and see whats going on.

Cheers-

-Ezra Z.
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
[email protected]

bruce balmer wrote:

I’d like to take some advice and write a generator to change the
scaffold.css. How do I do that? I looked on the wiki and googled it
but have not found anything yet.

Any help would be much appreciated.

bruce

I would just reverse engineer the standard scaffold generator, there are
probably big chunks of text in it that you can just replace.

On Jan 6, 2006, at 2:03 PM, Ezra Z. wrote:


wrote. Its just a lighttpd.conf file generator for either scgi or
fcgi configuration generation. But it ought to show you how to
build a basic generator so you can look at some more complex oones
and see whats going on.

Sorry forgot to paste the link:

http://brainspl.at/files/lighttpd.tar.gz

Cheers-
-Ezra Z.
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
[email protected]

Ezra:

thanks for sending that. I took a quick look at it. I would love to
find some good documentation. I think that what may be obvious to you
is not YET obvious to me. Maybe I could start with altering the
template the generator uses and keep a copy somewhere so that I can
put it back each time I upgrade rails.

Where could I find that file. Two people have given me answers on its
location but I can find nothing similar to the paths they give me. I
am on OS X using Locomotive. (which I love, by the way)

bruce

Kevin:

thanks, Happy to do that if I could ever find out where it is so I
could look at the file. Also, I am using Locomotive. Not sure if
that complicates things re finding these files. Do you know where
the file lives? I tried which rails_generator and got nothing back.

tia.

bruce

Bruce-

I am attaching a copy of the scaffolding generator in its entirety

from rails1.0 on osx. You can edit a copy to keep even through rails
version upgrades by putting in a dir called ~/.rails/generators/
myscaffold . So you can take the one I am sending you and edit the
templates and css however you like and then run script/generate
myscaffold Foo B. just like a normal scaffold to get your
personalized version instead.

When you use locomotive it has its own self contained gems and so if

you want to find the rails generators in the locomotive bundle you
will need to open your terminal shell from inside of locomotive
becasue it changes you $PATH in order to keep itself contained. I
don’t know offhand what the path to the generators are in locomotive.

Hope that gets you going.

Cheers-
-Ezra

http://wiki.rubyonrails.com/rails/pages/UnderstandingGenerators

I used that page as a reference when writing my OpenIDLoginGenerator.

Hope that helps,
Brian E.
http://openidenabled.com/openid/libraries/ruby

Ezra:

Thanks, very much.

bruce