Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

I would like to modify the nifty_scaffold... #132

Open
chewmanfoo opened this issue Sep 30, 2011 · 1 comment
Open

I would like to modify the nifty_scaffold... #132

chewmanfoo opened this issue Sep 30, 2011 · 1 comment

Comments

@chewmanfoo
Copy link

such that

rails g nifty_scaffold attribute1:type attribute2:type

becomes

rails g niftiest_scaffold /path/to/yaml/file/describing/attributes.yml

and the scaffold generator reads the yml file and creates the scaffold with those parameters.

Any tips on doing this?

TIA,
chewmanfoo

@rupert-madden-abbott
Copy link

Yeah I wanted to look into doing something similar for a different generator but came up short.

Generators and the underlying Thor tool are heavily based around the idea of command line input. I felt it would be too much of a hack to try and get them working with some sort of other input.

If you are interested in entering complex data, I suggest you use the ask and yes methods to prompt the user for that information at a later point, even if it is immediately after initializing the generator. I think this makes the generator more usable as well because it gives you an opportunity to be more descriptive with what should be entered, and the format, than a yaml file.

You could also put in sensible defaults for all of these questions and then have a quite argument for the generator that defaults to false. Setting it to true would skip all of the questions and just use the defaults.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants