Please read for an updated status on RailsCasts:
Learn more or hide this
I'm stuck using Windoze for development and so I tried unzipping your app_layout into C:\documents and settings\myusername\.rails\generators\app_layout and it doesn't find it :(
Any ideas on how to do this in Windoze?
Figured it out. For some reason ruby isn't using \ but is using / and so as soon as I changed USERPROFILE to use / it worked :)
So how would one go about adding their own commands to Manifest so that they would rewind properly and available in the record block so I could do m.mycmd?
Another champion episode.
I've written generators before but I don't think I'd ever thought to use them for simple tasks like this.
So now, I have a database.yml generator to include my dev mysql.sock details, local password etc. So thanks for the inspiration.
@Brent, good question. I recommend checking out the Rails source code to see how this is done. Go through the different ruby scripts at the URL below (particularly base.rb and commands.rb):
Great episode. That was needed :).
For learning I tried to improve it. Added --no-css option and default file name.
Actually i want to add <title><% yield :title %></title> too. It was on one episode by Ryan before. Maybe someone can throw a link, how to modify some other file..
@InMan, great job! I like what you've done there! It's an excellent example of how to add options to a generator.
You may want to override the "banner" method to provide a short usage description.
Actually attr_accessor isn't needed for views :).
Banner removes just first line actually. (atleast in edge).
But maybe I'm wrong. Haven't tested it yet .
Hi Ryan, I've recently discovered your site and can I just say what a great asset it is. Keep up the good work and apologies in advance for systematically downloading episode after episode!
Note: in edge rails you can now store generators within RubyGems' /generators or /rails_generators folder. Similarly, plugins you can now store generators within /rails_generators as well as the existing /generators folder support.
I'm having a bit of trouble. I'm storing my generator in the plugins dir. C:\projects\cap\vendor\plugins\app_layout\generators\app_layout
I'm getting the following when I try and run ruby script/generate app_layout.
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/rails_generator/base.rb:122:in `manifest': No manifest for 'app_layout' generator. (NotImplementedError)
@rudy, does your app layout generator have a "manifest" method?
This generator cast was great. I'd been waiting for something to be broadcast so clearly regarding generators. Thanks a lot Ryan. For everyone else, I am trying something a little different and ran into some trouble. Would people mind taking a look at my post at http://railsforum.com/viewtopic.php?id=7711 and helping a brother out?
manifest not mainfest, derrr. Creating this generator is the sickest thing I've done yet with rails. Thanks Ryan. Railscasts.com is the bomb!!!!!!!
Ryan, thanks so much - I'm glad you're doing 1 a week now (though I'd happily still watch and absorb 3), but it's a helluvalotof work.. If you ever decide to make full length screencasts, I'm sure people would be interested.
great stuff, thanks as always.
My group are working on rails IDE and we're in the wizard part now and we're trying to generate the Rails skeleton and we looked in the rubygems and found in
what does it do, does it generates rails skeleton? are there any other scripts we need to execute as well?
plz email me at firstname.lastname@example.org
@hhifnawi, this won't generate the full rails skeleton, just a couple files. You should use the "rails" command to generate a full new Rails app. If you still have problems I recommend posting on railsforum.com.
For anyone interested in Generators for other development areas outside of Rails, check out http://rubigen.rubyforge.org
Great screencast! I was wondering how you would package this generator for use by other developers? Would you create a gem out of it, or a plugin somehow?
How can I delete a file in the generator? I'd like to delete the public/index.html if it exists.
And how can I remove all the files which are created with the generator?
This example was clear !
But how can I pack a generator in order to make it a dist and publish it. I want some way to make distributable, like gems or plugins. How can I do this?
The Rails Generators Source Link doesn't work anymore...
Shouldn't this episode be marked as revise? Check out episode 218:
First sign in through GitHub to post a comment.