Skip to content

Commit 47990ac

Browse files
authored
Fix for: Misleading pattern examples in documentation for additional_file_patterns (#222)
When trying to follow examples in documentation for `additional_file_patterns` to annotate [Blueprinter's](https://github.com/procore-oss/blueprinter) blueprints (serializers), which are located in `app/blueprints` directory - nothing happens. Blueprints are not picked up as additional files for annotating with `additional_file_patterns` set as `app/blueprints/%model_name%_blueprint.rb`. ### Documentation example in question ``` Additional file paths or globs to annotate, separated by commas (e.g. `/foo/bar/%model_name%/*.rb,/baz/%model_name%.rb`) ``` which does not work, because `model_name` is expected to be upper case `MODEL_NAME`. ### What does work ``` :additional_file_patterns: - app/blueprints/%MODEL_NAME%_blueprint.rb ``` ### Solution Examples in documentation should reflect that `MODEL_NAME` in `additional_file_patterns` is expected to be upper case.
1 parent a3d66e2 commit 47990ac

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

MIGRATION_GUIDE.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Command options:
5656
Additional options that work for annotating models and routes
5757
5858
--additional-file-patterns path1,path2,path3
59-
Additional file paths or globs to annotate, separated by commas (e.g. `/foo/bar/%model_name%/*.rb,/baz/%model_name%.rb`)
59+
Additional file paths or globs to annotate, separated by commas (e.g. `/foo/bar/%MODEL_NAME%/*.rb,/baz/%MODEL_NAME%.rb`)
6060
-d, --delete Remove annotations from all model files or the routes.rb file
6161
--model-dir dir Annotate model files stored in dir rather than app/models, separate multiple dirs with commas
6262
--root-dir dir Annotate files stored within root dir projects, separate multiple dirs with commas
@@ -122,4 +122,3 @@ When running the install generator command, `bin/rails g annotate_rb:install`, a
122122
It _should_ match the old Annotate defaults however there may be differences.
123123

124124
**Note: there were bugs in Annotate that may have led to options not actually being used for some of the `exclude_*` options. If you experience different behavior despite using the same defaults then this may be why.**
125-

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ Command options:
149149
Additional options that work for annotating models and routes
150150
151151
--additional-file-patterns path1,path2,path3
152-
Additional file paths or globs to annotate, separated by commas (e.g. `/foo/bar/%model_name%/*.rb,/baz/%model_name%.rb`)
152+
Additional file paths or globs to annotate, separated by commas (e.g. `/foo/bar/%MODEL_NAME%/*.rb,/baz/%MODEL_NAME%.rb`)
153153
-d, --delete Remove annotations from all model files or the routes.rb file
154154
--model-dir dir Annotate model files stored in dir rather than app/models, separate multiple dirs with commas
155155
--root-dir dir Annotate files stored within root dir projects, separate multiple dirs with commas

lib/annotate_rb/parser.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ def add_options_to_parser(option_parser) # rubocop:disable Metrics/MethodLength
362362

363363
option_parser.on("--additional-file-patterns path1,path2,path3",
364364
Array,
365-
"Additional file paths or globs to annotate, separated by commas (e.g. `/foo/bar/%model_name%/*.rb,/baz/%model_name%.rb`)") do |additional_file_patterns|
365+
"Additional file paths or globs to annotate, separated by commas (e.g. `/foo/bar/%MODEL_NAME%/*.rb,/baz/%MODEL_NAME%.rb`)") do |additional_file_patterns|
366366
@options[:additional_file_patterns] = additional_file_patterns
367367
end
368368

0 commit comments

Comments
 (0)