add Rails generators#176
Conversation
|
ok, I'll fix for old rubies |
|
Hey, what's the story with this? |
|
@jesster2k10 I've been offline for a couple weeks, and I don't know that there is much of a story to tell but if you are still interested you can always bundle with my fork and play with the generator this would add. It can introspect on the ActiveRecord model you pass it or just take command flags to write a blueprinter for the model. |
There was a problem hiding this comment.
@wlkrw Thank you very much for this PR (and sorry for the slow response), I'm really excited for this feature. I have a number of comments below.
|
|
||
|
|
||
|
|
||
| class_option :identifier, default: nil, desc: "Add an identifer to the generated blueprint, either uses :id or your specified value", aliases: "-i", banner: "id" |
There was a problem hiding this comment.
This --identifier option if specified with an argument does not seem to be working. It generates the blueprint, but without the specified identifier. It does set the default :id if no argument is given.
|
|
||
| end | ||
| end | ||
| end |
There was a problem hiding this comment.
Would you make a separate PR for the initializers generator? Reasoning is that I would like to have a more thorough discussion regarding generating initializers and the default configurations, and I don't want to have that block the rest of this PR. Currently, I think it's not very useful to generate an empty initializer by default.
Blueprinter.configure do |config|
endRather I'd like to have the initializer generator to generate all the defaults configs of blueprinter, with code comments showing potential options.
Something like
Blueprinter.configure do |config|
# The default generator is JSON. You may replace it with OJ or Yajil as well.
config.generator = JSON
# more defaults and code comments below
endThere was a problem hiding this comment.
sounds good. I took that part out. I'll wait for the next pr until this is ready to merge in case I drop off the internet again ;)
|
@philipqnguyen I believe I've addressed all your change requests. Thanks for your patience. |
philipqnguyen
left a comment
There was a problem hiding this comment.
@wlkrw thanks for working on this.
| end | ||
|
|
||
| def indent | ||
| user_intended = {two: " ", four: " ", tab:"\t"}[options["indentation"].intern] |
There was a problem hiding this comment.
Minor: should this be user_indented?
There was a problem hiding this comment.
can be followed up after
Hello and thanks for making Blueprinter.
I made this for #121
Would YARD doc additions be needed or is in this case the
rails g blueprinter:blueprint --helpoutput sufficient?