Forum: Ruby on Rails How do I write a generator?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bruce B. (Guest)
on 2006-01-06 23:49
(Received via mailing list)
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
Ezra Z. (Guest)
on 2006-01-07 00:10
(Received via mailing list)
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
removed_email_address@domain.invalid
Kevin O. (Guest)
on 2006-01-07 00:22
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.
Ezra Z. (Guest)
on 2006-01-07 00:28
(Received via mailing list)
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
removed_email_address@domain.invalid
Bruce B. (Guest)
on 2006-01-07 00:58
(Received via mailing list)
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 B. (Guest)
on 2006-01-07 01:01
(Received via mailing list)
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
Brian E. (Guest)
on 2006-01-07 02:04
(Received via mailing list)
http://wiki.rubyonrails.com/rails/pages/Understand...

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

Hope that helps,
Brian E.
http://openidenabled.com/openid/libraries/ruby
Ezra Z. (Guest)
on 2006-01-07 03:10
(Received via mailing list)
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
Bruce B. (Guest)
on 2006-01-07 07:59
(Received via mailing list)
Ezra:

Thanks, very much.

bruce
This topic is locked and can not be replied to.