annotaterb 4.8.0 → 4.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 255fdc09fbc3848ba6d9306ec84d07c2471491ffbfde2440dc502bc35432a702
4
- data.tar.gz: 004c6df59a13ec89bca83190fcb4de77c88435b0a091cd0385e1bc2a1c3f9ae8
3
+ metadata.gz: ab40ea1034e6f377865be3de919a8df7f32cd6b655def53590b4061389ce518a
4
+ data.tar.gz: 1cc47f8f90e22930b7267727de068bacda45f0596df6bd15459c9d935e86f1f0
5
5
  SHA512:
6
- metadata.gz: ff01eaa95eda26cd5a14d30fb93bd2da5cabde3dc2da12cac718c40349a4228963e162162db017461942aa01cffba5ef59ca7c43344c01549a11ee2d6ba189b1
7
- data.tar.gz: 4ee46c7c044938e98a883f72daa023ed89f3c2d13548d1986d2353b0f5f034a8eccab3cd8ea4032c80c3d7e3b3f8f093deccc92ef494c81f1c5631be5261d720
6
+ metadata.gz: fed4abbcf53babf0b3854eacfb85078eb36716e2ddaaefa112e174c28f8a9694137f4fbe5b3e4ac73fc30f7b9786308a6770f62e692e101c676fee7ff3af6801
7
+ data.tar.gz: b41107dd5b24a83f3c50e890eb24491665aa07253be3bf6e79caec4ab1ee898888ef84192ba691064a158cc4672ccfb7db18416970f61ce0add026a81e9116b9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # Changelog
2
2
 
3
+ ## [v4.9.0](https://github.com/drwl/annotaterb/tree/v4.9.0) (2024-05-29)
4
+
5
+ [Full Changelog](https://github.com/drwl/annotaterb/compare/v4.8.0...v4.9.0)
6
+
7
+ **Closed issues:**
8
+
9
+ - Duplicate content in fixtures when annotating models [\#108](https://github.com/drwl/annotaterb/issues/108)
10
+ - Cannot exclude annotations from serializer specs [\#103](https://github.com/drwl/annotaterb/issues/103)
11
+
12
+ **Merged pull requests:**
13
+
14
+ - Bump version to v4.9.0 [\#119](https://github.com/drwl/annotaterb/pull/119) ([drwl](https://github.com/drwl))
15
+ - Add support for `NOT VALID` constraints [\#118](https://github.com/drwl/annotaterb/pull/118) ([gmcabrita](https://github.com/gmcabrita))
16
+ - Generate changelog for v4.8.0 [\#116](https://github.com/drwl/annotaterb/pull/116) ([drwl](https://github.com/drwl))
17
+
18
+ ## [v4.8.0](https://github.com/drwl/annotaterb/tree/v4.8.0) (2024-05-14)
19
+
20
+ [Full Changelog](https://github.com/drwl/annotaterb/compare/v4.7.1...v4.8.0)
21
+
22
+ **Closed issues:**
23
+
24
+ - Nested module models and unexpected annotations [\#106](https://github.com/drwl/annotaterb/issues/106)
25
+
26
+ **Merged pull requests:**
27
+
28
+ - Bump version to v4.8.0 [\#115](https://github.com/drwl/annotaterb/pull/115) ([drwl](https://github.com/drwl))
29
+ - Generate changelog for v4.7.1 [\#114](https://github.com/drwl/annotaterb/pull/114) ([drwl](https://github.com/drwl))
30
+ - Support annotating model fixture files [\#110](https://github.com/drwl/annotaterb/pull/110) ([drwl](https://github.com/drwl))
31
+ - Make `exclude_tests` option able to override other exclude options [\#107](https://github.com/drwl/annotaterb/pull/107) ([drwl](https://github.com/drwl))
32
+
3
33
  ## [v4.7.1](https://github.com/drwl/annotaterb/tree/v4.7.1) (2024-05-09)
4
34
 
5
35
  [Full Changelog](https://github.com/drwl/annotaterb/compare/v4.7.0...v4.7.1)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.8.0
1
+ 4.10.0
@@ -24,7 +24,13 @@ module AnnotateRb
24
24
 
25
25
  max_size = check_constraints.map { |check_constraint| check_constraint.name.size }.max + 1
26
26
  check_constraints.sort_by(&:name).each do |check_constraint|
27
- expression = check_constraint.expression ? "(#{check_constraint.expression.squish})" : nil
27
+ expression = if check_constraint.expression
28
+ not_validated = if !check_constraint.validated?
29
+ "NOT VALID"
30
+ end
31
+
32
+ "(#{check_constraint.expression.squish}) #{not_validated}".squish
33
+ end
28
34
 
29
35
  constraint_info += if @options[:format_markdown]
30
36
  cc_info_in_markdown(check_constraint.name, expression)
@@ -23,14 +23,19 @@ module AnnotateRb
23
23
  return "" if foreign_keys.empty?
24
24
 
25
25
  format_name = lambda do |fk|
26
- return fk.options[:column] if fk.name.blank?
26
+ return fk.column if fk.name.blank?
27
27
 
28
28
  @options[:show_complete_foreign_keys] ? fk.name : fk.name.gsub(/(?<=^fk_rails_)[0-9a-f]{10}$/, "...")
29
29
  end
30
30
 
31
31
  max_size = foreign_keys.map(&format_name).map(&:size).max + 1
32
- foreign_keys.sort_by { |fk| [format_name.call(fk), fk.column] }.each do |fk|
33
- ref_info = "#{fk.column} => #{fk.to_table}.#{fk.primary_key}"
32
+ foreign_keys.sort_by { |fk| [format_name.call(fk), stringify_columns(fk.column)] }.each do |fk|
33
+ ref_info = if fk.column.is_a?(Array) # Composite foreign key using multiple columns
34
+ "#{stringify_columns(fk.column)} => #{fk.to_table}#{stringify_columns(fk.primary_key)}"
35
+ else
36
+ "#{fk.column} => #{fk.to_table}.#{fk.primary_key}"
37
+ end
38
+
34
39
  constraints_info = ""
35
40
  constraints_info += "ON DELETE => #{fk.on_delete} " if fk.on_delete
36
41
  constraints_info += "ON UPDATE => #{fk.on_update} " if fk.on_update
@@ -51,6 +56,13 @@ module AnnotateRb
51
56
 
52
57
  fk_info
53
58
  end
59
+
60
+ private
61
+
62
+ # The fk columns might be composite keys, so format them into a string for the annotation
63
+ def stringify_columns(columns)
64
+ columns.is_a?(Array) ? "[#{columns.join(", ")}]" : columns
65
+ end
54
66
  end
55
67
  end
56
68
  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.8.0
4
+ version: 4.10.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-05-14 00:00:00.000000000 Z
11
+ date: 2024-06-28 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.