-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: packs-rails support #99
Comments
Hi Wilson, I'm doing alright, hope you're doing good as well. I haven't used pack-rails gem before so let me take a look into it. I think there's demand for supporting alternative structures as also seen in #82. I'm hoping to dedicate some time soon to get a good understanding of the different use cases and a path forward. |
To unblock us we updated our rake task to look like this: # This rake task was added by annotate_rb gem.
# Can set `ANNOTATERB_SKIP_ON_DB_TASKS` to be anything to skip this
if Rails.env.development? && ENV["ANNOTATERB_SKIP_ON_DB_TASKS"].nil?
require "annotate_rb"
require "yaml"
config_file = ".annotaterb.yml"
config = YAML.load_file(config_file)
model_dirs = `find packs -type d -name 'app/models' -prune -o -path '*/app/models' -type d`.split("\n").sort
config[:model_dir] = ["app/models"] + model_dirs
File.open(config_file, "w") { |f| YAML.dump(config, f) }
AnnotateRb::Core.load_rake_tasks
end It would be nice to have support for this in |
Having the config file be a ruby script had the advantage that we could more easily customize things like this. With "model_dir" => Dir.glob("**/app/models").join(","), An approach to get something similar in a yaml file could be to allow ERB syntax to be used in the file. So we could do:
|
We often want to specify multiple directories in `root_dir` and `model_dir`. For example, when using engines, packs-rails, etc. * https://github.com/rubyatscale/packs-rails * https://guides.rubyonrails.org/engines.html This commit supports the glob pattern with these options, making it easy to specify multiple directories. fixes drwl#99
We often want to specify multiple directories in `root_dir` and `model_dir`. For example, when using engines, packs-rails, etc. * https://github.com/rubyatscale/packs-rails * https://guides.rubyonrails.org/engines.html This commit supports the glob pattern with these options, making it easy to specify multiple directories. fixes drwl#99
I'm trying out annotaterb on a Rails project which has packs-rails setup. The
packs/
directory doesn't get automatically picked up, understandably.:root_dir: ['.', 'packs/*']
and onlyapp/
directory in the root gets picked up, none of the packs were recognized.packs/*
by expanding it topacks/packone
packs/packtwo
etc, still doesn't work.While the title is specifically on packs-rails, I wouldn't mind having a compromise via
:root_dir:
or:model_dir:
if it supports globs 😄P.S. 👋🏻 hey Andrew, hope you've been well!
Versions
The text was updated successfully, but these errors were encountered: