Skip to content

Conversation

nicklandgrebe
Copy link

This adds a path option called --additional-subdir, which according to the description, allows one to "Additionally annotate files in subdir of each scaffold/serializer/controller/helper dir, separate multiple dirs with comas"

The reason I made this feature is because in my app, I have a bunch of models, but each of these models can have multiple serializers, for example: serializers/products_serializer.rb and serializers/api/v1/products_serializer.rb both exist for the Product model. I do not want to namespace the Product model, because we are simply providing two different interfaces for the same model.

To accomplish this, we make the call annotate --additional-subdir api/v1 and it works great!

@coveralls
Copy link

coveralls commented Jul 2, 2016

Coverage Status

Changes Unknown when pulling 78ff4a1 on nicklandgrebe:add_additional_subdir_option into * on ctran:develop*.

@coveralls
Copy link

coveralls commented Jul 2, 2016

Coverage Status

Changes Unknown when pulling 437ed01 on nicklandgrebe:add_additional_subdir_option into * on ctran:develop*.

@ctran
Copy link
Owner

ctran commented Jul 2, 2016

Have you looked at the root_dir option (#292)? It seems to be very similar to what you're proposing here.

@nicklandgrebe
Copy link
Author

nicklandgrebe commented Jul 5, 2016

It's really close, but even if I were to switch my repo to root_dir's intended use case by taking all my subdirs and moving them to another root folder using a Rails Engine:

/app/controllers/api/v1/*.rb
->
/api/v1/app/controllers/api/v1/*.rb`

You'll note the engine still requires that I put all my controllers in module API::V1 that corresponds to a folder subdirectory controllers/api/v1/, so I still need this feature even though root_dir outside a Rails application would work here.

Is there a way we can add a -rf --recurse-folders method instead? I think that is much more applicable to most use cases

@ctran ctran added the reviewed label Oct 24, 2016
@pelletencate
Copy link

I need this one. Is this going to be merged soon?

@khataev
Copy link

khataev commented Sep 28, 2018

please, merge it )
i need to annotate files in subdirectories of serializers directory...

@ctran
Copy link
Owner

ctran commented Feb 14, 2019

Please rebase if you still want me to merge this.

@drwl
Copy link
Collaborator

drwl commented Sep 29, 2019

@nicklandgrebe gonna close this as this PR is quite old. Feel free to reopen if you would like to update it and get it merged in.

@drwl drwl closed this Sep 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants