Closed dipth closed 1 year ago
Hey @dipth -- I actually went down this path because I wanted this exact same thing in the early days of creating this gem. However, we are very tied to Packwerk and how packwerk works is based on the assumption that you're using Zeitwerks' directory structure out of the box. Since we can't customize this at the moment, changing this in Stimpack would mean that our Packwerk integrations would fail. I'm going to leave this issue open because I would love to see Stimpack headed in this direction. Just a matter of working with Packwerk to allow us to customize the parser/scanner logic.
There's a gem that looks like it is trying to solve this, but I haven't tried it yet https://github.com/gap777/automatic_namespaces
@dipth Can you let me know if the automatic_namespaces
gem covers what you need for now? If so (or if I don't hear back from ya), I'll go ahead and close this issue for now and perhaps add the gem as a reference to the README.
It's ok to close this :)
We've recently started using Packwerk and Stimpack in our organisation and we had a bit of a hard time coming to terms with the expected directory structure needed for everything to work and wondered if you can offer any guidance or input on how you consider the following:
We're running a big Rails monolith that has the classic rails file structure with
/app
,/spec
/lib
etc.When developing new features, we generally take care to namespace these under a unique and descriptive name. For instance a feature for profile pages could be namespaced as
ProfilePages
resulting in the following directory structure:This redundant directory structure is necessary for the autoloading to work since
profile_page.rb
definesProfilePages::ProfilePage
andlist_profile_pages
definesProfilePages::ListProfilePages
. However, working with the codebase, this structure feels extremely verbose and redundant since all the code is already nested under thepacks/profile_pages
folder.Optimally this directory structure would have been more clean and easier to navigate and reason about:
Is this a problem you have dealt with in your daily use of Packwerk and if so what are your thoughts and opinions about it? Do you know if support for something like this structure would be possible to add to
Stimpack
perhaps by using some ofZeitwerks
existing functionality likeloader.collapse
?