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.
2dd904ec5981c31e7bb7a5743a53caf8?d=identicon&s=25 Bruce Balmer (brucebalmer)
on 2006-01-06 22: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
132a94ca65959bda6c74fae54bff2425?d=identicon&s=25 Ezra Zygmuntowicz (Guest)
on 2006-01-06 23:10
(Received via mailing list)
On Jan 6, 2006, at 1:45 PM, Bruce Balmer 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 Zygmuntowicz
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
ezra@yakima-herald.com
C8a634a01a2c4508360874bff7fb1a7f?d=identicon&s=25 Kevin Olbrich (Guest)
on 2006-01-06 23: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.
132a94ca65959bda6c74fae54bff2425?d=identicon&s=25 Ezra Zygmuntowicz (Guest)
on 2006-01-06 23:28
(Received via mailing list)
On Jan 6, 2006, at 2:03 PM, Ezra Zygmuntowicz 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 Zygmuntowicz
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
ezra@yakima-herald.com
2dd904ec5981c31e7bb7a5743a53caf8?d=identicon&s=25 Bruce Balmer (brucebalmer)
on 2006-01-06 23: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
2dd904ec5981c31e7bb7a5743a53caf8?d=identicon&s=25 Bruce Balmer (brucebalmer)
on 2006-01-07 00: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
2b5b1bac34d7d1bd326d51fae39464a4?d=identicon&s=25 Brian Ellin (Guest)
on 2006-01-07 01: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 Ellin
http://openidenabled.com/openid/libraries/ruby
8e44c65ac5b896da534ef2440121c953?d=identicon&s=25 Ezra Zygmuntowicz (Guest)
on 2006-01-07 02: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 Bar 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
2dd904ec5981c31e7bb7a5743a53caf8?d=identicon&s=25 Bruce Balmer (brucebalmer)
on 2006-01-07 06:59
(Received via mailing list)
Ezra:

Thanks, very much.

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