annotaterb 4.20.0 → 4.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/README.md +10 -1
- data/VERSION +1 -1
- data/lib/annotate_rb/config_finder.rb +12 -3
- data/lib/annotate_rb/model_annotator/annotation/annotation_builder.rb +2 -0
- data/lib/annotate_rb/model_annotator/check_constraint_annotation/annotation.rb +8 -0
- data/lib/annotate_rb/model_annotator/foreign_key_annotation/annotation.rb +8 -0
- data/lib/annotate_rb/model_annotator/index_annotation/annotation.rb +8 -0
- data/lib/annotate_rb/model_annotator/model_wrapper.rb +1 -2
- data/lib/annotate_rb/options.rb +2 -0
- data/lib/annotate_rb/parser.rb +5 -0
- data/lib/annotate_rb/rake_bootstrapper.rb +2 -1
- data/lib/annotate_rb/runner.rb +8 -8
- data/lib/annotate_rb.rb +3 -9
- data/lib/annotaterb.rb +1 -1
- data/lib/generators/annotate_rb/hook/templates/annotate_rb.rake +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d35263cf60a69ceabf708e6da1acb1aa7dbb9994028b36726d813a00ef0ec7f0
|
|
4
|
+
data.tar.gz: f7286ebed8b6b2c2d2c5edb78dbeaa89dc6052619c8631a7d5b299e76c13bd0e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fcd554627a6f477ae5120a98afde43b89f08aa6411ea64e2feba73f752b34499172a8bee267b7cf68f1fcd729a921e90738a6047c7f939239063cc2b935f95f3
|
|
7
|
+
data.tar.gz: 17ac0370bef28e3275368c7a0f93a74e0863042676656878ea94b69416d2a84ec39214f6368f70ff9c2ad2b45f1714488cb57235a8950fdfef3aa5c2ce9f315f
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [v4.20.0](https://github.com/drwl/annotaterb/tree/v4.20.0) (2025-10-20)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/drwl/annotaterb/compare/v4.19.0...v4.20.0)
|
|
6
|
+
|
|
7
|
+
**Merged pull requests:**
|
|
8
|
+
|
|
9
|
+
- Bump version to v4.20.0 [\#278](https://github.com/drwl/annotaterb/pull/278) ([drwl](https://github.com/drwl))
|
|
10
|
+
- Bump github/codeql-action from 3 to 4 [\#277](https://github.com/drwl/annotaterb/pull/277) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
11
|
+
- fix: position-of-column-comment option [\#275](https://github.com/drwl/annotaterb/pull/275) ([JohnnyKei](https://github.com/JohnnyKei))
|
|
12
|
+
- feat: Add database name to annotations in multi-DB environments [\#272](https://github.com/drwl/annotaterb/pull/272) ([OdenTakashi](https://github.com/OdenTakashi))
|
|
13
|
+
- fix: resolve YAML syntax error in update\_config generator [\#269](https://github.com/drwl/annotaterb/pull/269) ([ivy](https://github.com/ivy))
|
|
14
|
+
- Update README.md [\#268](https://github.com/drwl/annotaterb/pull/268) ([torgoton](https://github.com/torgoton))
|
|
15
|
+
- Honor --frozen option in routes [\#265](https://github.com/drwl/annotaterb/pull/265) ([garriguv](https://github.com/garriguv))
|
|
16
|
+
- refactor\(test\): Default to single-DB environment for tests [\#264](https://github.com/drwl/annotaterb/pull/264) ([OdenTakashi](https://github.com/OdenTakashi))
|
|
17
|
+
- Escape column comment newlines when using "rightmost" value for position\_of\_column\_comment option [\#263](https://github.com/drwl/annotaterb/pull/263) ([rowanhogan](https://github.com/rowanhogan))
|
|
18
|
+
- chore: introduce switchable DB environment for specs [\#262](https://github.com/drwl/annotaterb/pull/262) ([OdenTakashi](https://github.com/OdenTakashi))
|
|
19
|
+
- Generate changelog for v4.19.0 [\#260](https://github.com/drwl/annotaterb/pull/260) ([drwl](https://github.com/drwl))
|
|
20
|
+
- Bump actions/checkout from 4 to 5 [\#257](https://github.com/drwl/annotaterb/pull/257) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
21
|
+
|
|
3
22
|
## [v4.19.0](https://github.com/drwl/annotaterb/tree/v4.19.0) (2025-08-28)
|
|
4
23
|
|
|
5
24
|
[Full Changelog](https://github.com/drwl/annotaterb/compare/v4.18.0...v4.19.0)
|
data/README.md
CHANGED
|
@@ -75,7 +75,7 @@ $ ANNOTATERB_SKIP_ON_DB_TASKS=1 bin/rails db:migrate
|
|
|
75
75
|
The following Rails generator commands get added.
|
|
76
76
|
|
|
77
77
|
```sh
|
|
78
|
-
$ bin/rails
|
|
78
|
+
$ bin/rails generate --help
|
|
79
79
|
|
|
80
80
|
...
|
|
81
81
|
|
|
@@ -183,6 +183,7 @@ Additional options that work for annotating models and routes
|
|
|
183
183
|
--exclude Do not annotate fixtures, test files, factories, and/or serializers
|
|
184
184
|
-f [bare|rdoc|yard|markdown], Render Schema Information as plain/RDoc/Yard/Markdown
|
|
185
185
|
--format
|
|
186
|
+
--config_path [path] Path to configuration file (by default, .annotaterb.yml in the root of the project)
|
|
186
187
|
-p [before|top|after|bottom], Place the annotations at the top (before) or the bottom (after) of the model/test/fixture/factory/route/serializer file(s)
|
|
187
188
|
--position
|
|
188
189
|
--pc, --position-in-class [before|top|after|bottom]
|
|
@@ -211,6 +212,14 @@ Additional options that work for annotating models and routes
|
|
|
211
212
|
|
|
212
213
|
Previously in the [Annotate](https://github.com/ctran/annotate_models) you could pass options through the CLI or store them as environment variables. Annotaterb removes dependency on the environment variables and instead can read values from a `.annotaterb.yml` file stored in the Rails project root.
|
|
213
214
|
|
|
215
|
+
### Configuration file location
|
|
216
|
+
|
|
217
|
+
AnnotateRb also supports other configuration file locations, and are searched for in the following locations (in order of precedence):
|
|
218
|
+
- `.annotaterb.yml`
|
|
219
|
+
- `config/annotaterb.yml`
|
|
220
|
+
- `.config/.annotaterb.yml`
|
|
221
|
+
- `.config/annotaterb/config.yml`
|
|
222
|
+
|
|
214
223
|
```yml
|
|
215
224
|
# .annotaterb.yml
|
|
216
225
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
4.
|
|
1
|
+
4.21.0
|
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "pathname"
|
|
4
|
+
|
|
3
5
|
module AnnotateRb
|
|
4
6
|
class ConfigFinder
|
|
5
7
|
DOTFILE = ".annotaterb.yml"
|
|
6
8
|
|
|
7
9
|
class << self
|
|
10
|
+
attr_accessor :config_path
|
|
11
|
+
|
|
8
12
|
def find_project_root
|
|
9
13
|
# We should expect this method to be called from a Rails project root and returning it
|
|
10
14
|
# e.g. "/Users/drwl/personal/annotaterb/dummyapp"
|
|
11
|
-
|
|
15
|
+
Pathname.pwd
|
|
12
16
|
end
|
|
13
17
|
|
|
14
18
|
def find_project_dotfile
|
|
15
|
-
|
|
19
|
+
return @config_path if @config_path && File.exist?(@config_path)
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
[
|
|
22
|
+
find_project_root.join(DOTFILE),
|
|
23
|
+
find_project_root.join("config", DOTFILE.delete_prefix(".")),
|
|
24
|
+
find_project_root.join(".config", DOTFILE),
|
|
25
|
+
find_project_root.join(".config", "annotaterb", "config.yml")
|
|
26
|
+
].find(&:exist?)
|
|
18
27
|
end
|
|
19
28
|
end
|
|
20
29
|
end
|
|
@@ -232,8 +232,7 @@ module AnnotateRb
|
|
|
232
232
|
# Multi-database support: Cache migration versions per database connection to handle
|
|
233
233
|
# different schema versions across primary/secondary databases correctly.
|
|
234
234
|
# Example: primary → "current_version_primary", secondary → "current_version_secondary"
|
|
235
|
-
|
|
236
|
-
cache_key = "current_version_#{connection_pool_name}".to_sym
|
|
235
|
+
cache_key = "current_version_#{database_name}".to_sym
|
|
237
236
|
|
|
238
237
|
if @options.get_state(cache_key).nil?
|
|
239
238
|
migration_version = begin
|
data/lib/annotate_rb/options.rb
CHANGED
|
@@ -76,6 +76,7 @@ module AnnotateRb
|
|
|
76
76
|
timestamp_columns: ModelAnnotator::ModelWrapper::DEFAULT_TIMESTAMP_COLUMNS,
|
|
77
77
|
|
|
78
78
|
ignore_columns: nil, # ModelAnnotator
|
|
79
|
+
ignore_multi_database_name: false, # ModelAnnotator
|
|
79
80
|
ignore_routes: nil, # RouteAnnotator
|
|
80
81
|
ignore_unknown_models: false, # ModelAnnotator
|
|
81
82
|
models: true, # Core
|
|
@@ -143,6 +144,7 @@ module AnnotateRb
|
|
|
143
144
|
:ignore_columns,
|
|
144
145
|
:ignore_routes,
|
|
145
146
|
:ignore_unknown_models,
|
|
147
|
+
:ignore_multi_database_name,
|
|
146
148
|
:models,
|
|
147
149
|
:routes,
|
|
148
150
|
:skip_on_db_migrate,
|
data/lib/annotate_rb/parser.rb
CHANGED
|
@@ -436,6 +436,11 @@ module AnnotateRb
|
|
|
436
436
|
"Render Schema Information as plain/RDoc/Yard/Markdown") do |format_type|
|
|
437
437
|
@options["format_#{format_type}".to_sym] = true
|
|
438
438
|
end
|
|
439
|
+
|
|
440
|
+
option_parser.on("--config-path [path]",
|
|
441
|
+
"Path to configuration file (by default, .annotaterb.yml in the root of the project)") do |path|
|
|
442
|
+
@options[:config_path] = path
|
|
443
|
+
end
|
|
439
444
|
end
|
|
440
445
|
end
|
|
441
446
|
end
|
data/lib/annotate_rb/runner.rb
CHANGED
|
@@ -23,23 +23,23 @@ module AnnotateRb
|
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def run(args)
|
|
26
|
-
config_file_options = ConfigLoader.load_config
|
|
27
26
|
parser = Parser.new(args, {})
|
|
28
27
|
|
|
29
28
|
parsed_options = parser.parse
|
|
30
29
|
remaining_args = parser.remaining_args
|
|
31
30
|
|
|
31
|
+
AnnotateRb::ConfigFinder.config_path = parsed_options[:config_path] if parsed_options[:config_path]
|
|
32
|
+
config_file_options = ConfigLoader.load_config
|
|
32
33
|
options = config_file_options.merge(parsed_options)
|
|
33
34
|
|
|
34
35
|
@options = Options.from(options, {working_args: remaining_args})
|
|
35
|
-
AnnotateRb::RakeBootstrapper.call
|
|
36
|
+
AnnotateRb::RakeBootstrapper.call
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
end
|
|
38
|
+
raise "Didn't specify a command" unless @options[:command]
|
|
39
|
+
|
|
40
|
+
@options[:command].call(@options)
|
|
41
|
+
|
|
42
|
+
# TODO
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
end
|
data/lib/annotate_rb.rb
CHANGED
|
@@ -2,14 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
require "active_record"
|
|
4
4
|
require "active_support"
|
|
5
|
-
|
|
6
|
-
# Helper.fallback depends on this being required because it adds #present? to nil
|
|
7
|
-
require "active_support/core_ext/object/blank"
|
|
8
|
-
require "active_support/core_ext/class/subclasses"
|
|
9
|
-
require "active_support/core_ext/string/inflections"
|
|
10
|
-
|
|
11
5
|
require "rake"
|
|
12
6
|
|
|
7
|
+
module AnnotateRb
|
|
8
|
+
end
|
|
9
|
+
|
|
13
10
|
require_relative "annotate_rb/helper"
|
|
14
11
|
require_relative "annotate_rb/core"
|
|
15
12
|
require_relative "annotate_rb/commands"
|
|
@@ -23,6 +20,3 @@ require_relative "annotate_rb/rake_bootstrapper"
|
|
|
23
20
|
require_relative "annotate_rb/config_finder"
|
|
24
21
|
require_relative "annotate_rb/config_loader"
|
|
25
22
|
require_relative "annotate_rb/config_generator"
|
|
26
|
-
|
|
27
|
-
module AnnotateRb
|
|
28
|
-
end
|
data/lib/annotaterb.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
# Gem names that follow naming convention work seamlessly. However, this gem is "annotaterb" where in code it is
|
|
2
2
|
# AnnotateRb. Because of this, we need this file so that the rest of the library automatically gets required.
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
require_relative "annotate_rb"
|
|
@@ -4,5 +4,7 @@
|
|
|
4
4
|
if Rails.env.development? && ENV["ANNOTATERB_SKIP_ON_DB_TASKS"].nil?
|
|
5
5
|
require "annotate_rb"
|
|
6
6
|
|
|
7
|
+
# Can modify the config path here if needed - by default, it's .annotaterb.yml in the root of the project
|
|
8
|
+
# AnnotateRb::ConfigFinder.config_path = ""
|
|
7
9
|
AnnotateRb::Core.load_rake_tasks
|
|
8
10
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: annotaterb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.21.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew W. Lee
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-01-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|