annotaterb 4.6.0 → 4.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +29 -0
- data/VERSION +1 -1
- data/lib/annotate_rb/model_annotator/column_annotation/attributes_builder.rb +1 -1
- data/lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb +3 -2
- data/lib/annotate_rb/model_annotator/column_annotation/default_value_builder.rb +4 -1
- data/lib/annotate_rb/model_annotator/column_annotation/type_builder.rb +1 -1
- data/lib/annotate_rb/options.rb +4 -2
- data/lib/annotate_rb/parser.rb +10 -1
- 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: f31e6cf08a5d57a35274e5964a5da9e4a01d006e0ddf3d4ac4467932901709ac
|
4
|
+
data.tar.gz: 020ad6bab20eb3c029173d5764050d7c62855785c2fa357750bc2fbff27cd02b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a52c81202a634161721175021e8ee8742cad49f0eab0aab2e89319d856a8f81fe0e1e2ea3de1e78e3695f261a6d2ee5bd5b41ea1ac8c9b2d072a62bcec4b1cd
|
7
|
+
data.tar.gz: b01f86669748d083e52a0f3fef891632cff7fcf1c476ae1ce71e5e654cc028105435c4ceadcc73b23443dba28f3dd9c082ebbadeae541ad053a3cd93005d59cb
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,34 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v4.6.0](https://github.com/drwl/annotaterb/tree/v4.6.0) (2024-02-27)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/drwl/annotaterb/compare/v4.5.0...v4.6.0)
|
6
|
+
|
7
|
+
Adds two big changes: Fix annotations swallowing comments [\#72](https://github.com/drwl/annotaterb/pull/72) and
|
8
|
+
Add Zeitwerk support [\#85](https://github.com/drwl/annotaterb/pull/85).
|
9
|
+
Please report any issues you encounter.
|
10
|
+
|
11
|
+
**Closed issues:**
|
12
|
+
|
13
|
+
- Add support for `data_migrate` gem [\#89](https://github.com/drwl/annotaterb/issues/89)
|
14
|
+
|
15
|
+
**Merged pull requests:**
|
16
|
+
|
17
|
+
- Bump version to v4.6.0 [\#95](https://github.com/drwl/annotaterb/pull/95) ([drwl](https://github.com/drwl))
|
18
|
+
- Add support for parsing RSpec files [\#94](https://github.com/drwl/annotaterb/pull/94) ([drwl](https://github.com/drwl))
|
19
|
+
- Add support for model name without namespace in resolver [\#93](https://github.com/drwl/annotaterb/pull/93) ([drwl](https://github.com/drwl))
|
20
|
+
- Fixes for `RelatedFilesListBuilder` [\#92](https://github.com/drwl/annotaterb/pull/92) ([drwl](https://github.com/drwl))
|
21
|
+
- Refactor `AnnotatedFile` classes [\#91](https://github.com/drwl/annotaterb/pull/91) ([drwl](https://github.com/drwl))
|
22
|
+
- Add support for data\_migrate gem [\#90](https://github.com/drwl/annotaterb/pull/90) ([cmer](https://github.com/cmer))
|
23
|
+
- Support non-model files in `CustomParser` [\#88](https://github.com/drwl/annotaterb/pull/88) ([drwl](https://github.com/drwl))
|
24
|
+
- Fix flakey integration test [\#87](https://github.com/drwl/annotaterb/pull/87) ([drwl](https://github.com/drwl))
|
25
|
+
- Improve integration tests [\#86](https://github.com/drwl/annotaterb/pull/86) ([drwl](https://github.com/drwl))
|
26
|
+
- Add Zeitwerk support [\#85](https://github.com/drwl/annotaterb/pull/85) ([drwl](https://github.com/drwl))
|
27
|
+
- Improve annotate after adding new migration integration test [\#84](https://github.com/drwl/annotaterb/pull/84) ([drwl](https://github.com/drwl))
|
28
|
+
- Add integration test using force [\#81](https://github.com/drwl/annotaterb/pull/81) ([drwl](https://github.com/drwl))
|
29
|
+
- Generate changelog for v4.5.0 [\#80](https://github.com/drwl/annotaterb/pull/80) ([drwl](https://github.com/drwl))
|
30
|
+
- Fix annotations swallowing comments [\#72](https://github.com/drwl/annotaterb/pull/72) ([drwl](https://github.com/drwl))
|
31
|
+
|
3
32
|
## [v4.5.0](https://github.com/drwl/annotaterb/tree/v4.5.0) (2024-02-08)
|
4
33
|
|
5
34
|
[Full Changelog](https://github.com/drwl/annotaterb/compare/v4.4.1...v4.5.0)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.
|
1
|
+
4.7.0
|
@@ -8,7 +8,7 @@ module AnnotateRb
|
|
8
8
|
NO_DEFAULT_COL_TYPES = %w[json jsonb hstore].freeze
|
9
9
|
|
10
10
|
def initialize(column, options, is_primary_key, column_indices, column_defaults)
|
11
|
-
@column = ColumnWrapper.new(column, column_defaults)
|
11
|
+
@column = ColumnWrapper.new(column, column_defaults, options)
|
12
12
|
@options = options
|
13
13
|
@is_primary_key = is_primary_key
|
14
14
|
@column_indices = column_indices
|
@@ -4,9 +4,10 @@ module AnnotateRb
|
|
4
4
|
module ModelAnnotator
|
5
5
|
module ColumnAnnotation
|
6
6
|
class ColumnWrapper
|
7
|
-
def initialize(column, column_defaults)
|
7
|
+
def initialize(column, column_defaults, options)
|
8
8
|
@column = column
|
9
9
|
@column_defaults = column_defaults
|
10
|
+
@options = options
|
10
11
|
end
|
11
12
|
|
12
13
|
def raw_default
|
@@ -88,7 +89,7 @@ module AnnotateRb
|
|
88
89
|
|
89
90
|
# Simple quoting for the default column value
|
90
91
|
def quote(value)
|
91
|
-
DefaultValueBuilder.new(value).build
|
92
|
+
DefaultValueBuilder.new(value, @options).build
|
92
93
|
end
|
93
94
|
end
|
94
95
|
end
|
@@ -4,8 +4,9 @@ module AnnotateRb
|
|
4
4
|
module ModelAnnotator
|
5
5
|
module ColumnAnnotation
|
6
6
|
class DefaultValueBuilder
|
7
|
-
def initialize(value)
|
7
|
+
def initialize(value, options)
|
8
8
|
@value = value
|
9
|
+
@options = options
|
9
10
|
end
|
10
11
|
|
11
12
|
# @return [String]
|
@@ -27,6 +28,8 @@ module AnnotateRb
|
|
27
28
|
private
|
28
29
|
|
29
30
|
def quote(value)
|
31
|
+
return value.to_s.inspect if @options[:classes_default_to_s]&.include?(value.class.name)
|
32
|
+
|
30
33
|
case value
|
31
34
|
when NilClass then "NULL"
|
32
35
|
when TrueClass then "TRUE"
|
@@ -10,7 +10,7 @@ module AnnotateRb
|
|
10
10
|
|
11
11
|
def initialize(column, options, column_defaults)
|
12
12
|
# Passing `column_defaults` for posterity, don't actually need it here since it's not used
|
13
|
-
@column = ColumnWrapper.new(column, column_defaults)
|
13
|
+
@column = ColumnWrapper.new(column, column_defaults, options)
|
14
14
|
@options = options
|
15
15
|
end
|
16
16
|
|
data/lib/annotate_rb/options.rb
CHANGED
@@ -76,7 +76,8 @@ module AnnotateRb
|
|
76
76
|
target_action: :do_annotations, # Core; Possible values: :do_annotations, :remove_annotations
|
77
77
|
wrapper: nil, # ModelAnnotator, RouteAnnotator
|
78
78
|
wrapper_close: nil, # ModelAnnotator, RouteAnnotator
|
79
|
-
wrapper_open: nil # ModelAnnotator, RouteAnnotator
|
79
|
+
wrapper_open: nil, # ModelAnnotator, RouteAnnotator,
|
80
|
+
classes_default_to_s: [] # ModelAnnotator
|
80
81
|
}.freeze
|
81
82
|
|
82
83
|
PATH_OPTIONS = {
|
@@ -135,7 +136,8 @@ module AnnotateRb
|
|
135
136
|
:target_action,
|
136
137
|
:wrapper,
|
137
138
|
:wrapper_close,
|
138
|
-
:wrapper_open
|
139
|
+
:wrapper_open,
|
140
|
+
:classes_default_to_s
|
139
141
|
].freeze
|
140
142
|
|
141
143
|
PATH_OPTION_KEYS = [
|
data/lib/annotate_rb/parser.rb
CHANGED
@@ -9,7 +9,7 @@ module AnnotateRb
|
|
9
9
|
|
10
10
|
BANNER_STRING = <<~BANNER.freeze
|
11
11
|
Usage: annotaterb [command] [options]
|
12
|
-
|
12
|
+
|
13
13
|
Commands:
|
14
14
|
models [options]
|
15
15
|
routes [options]
|
@@ -248,6 +248,15 @@ module AnnotateRb
|
|
248
248
|
"exclude table comments in model annotations") do
|
249
249
|
@options[:with_table_comments] = false
|
250
250
|
end
|
251
|
+
|
252
|
+
option_parser.on("--classes-default-to-s class",
|
253
|
+
"Custom classes to be represented with `to_s`, may be used multiple times") do |klass|
|
254
|
+
@options[:classes_default_to_s] = if @options[:classes_default_to_s].present?
|
255
|
+
[*@options[:classes_default_to_s], klass]
|
256
|
+
else
|
257
|
+
[klass]
|
258
|
+
end
|
259
|
+
end
|
251
260
|
end
|
252
261
|
|
253
262
|
def add_route_options_to_parser(option_parser)
|
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.7.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: 2024-
|
11
|
+
date: 2024-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Annotates Rails/ActiveRecord Models, routes, fixtures, and others based
|
14
14
|
on the database schema.
|