trains 0.0.17 → 0.0.18
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/lib/trains/scanner.rb +3 -2
- data/lib/trains/version.rb +1 -1
- data/lib/trains/visitor/model.rb +6 -2
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7a1893b50977fd1adda92c2268df81b65f47fa4218961835c11c5534274774db
|
|
4
|
+
data.tar.gz: aa0c28905214fa2d776d144e3e58bfa952ad154b91a4f007e0f9d506e6fe723d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 87bf0d7266a6347d452434b83f19f3798ed68f97b0be036baed26390442894ccf725a0e54bb233cbb25523b9864e9bbc3d246bae5341c489121e1ef80b7195b4
|
|
7
|
+
data.tar.gz: 377afeb54297eca4feb98a5c482a348250319f7d61b84650fb33910c91faa86d1c9eade41c34b82cf217c9833ebc5e238af7cc04c86c53255e29480fa4e0d605
|
data/lib/trains/scanner.rb
CHANGED
|
@@ -66,9 +66,10 @@ module Trains
|
|
|
66
66
|
|
|
67
67
|
def parse_schema
|
|
68
68
|
result_hash = {}
|
|
69
|
-
schema_file =
|
|
70
|
-
|
|
69
|
+
schema_file = File.join(@dir, 'db', 'schema.rb')
|
|
70
|
+
return result_hash unless File.exist? schema_file
|
|
71
71
|
|
|
72
|
+
models_results = parse_util([schema_file], Visitor::Schema)
|
|
72
73
|
models_results
|
|
73
74
|
.select { |result| result.error.nil? }
|
|
74
75
|
.map(&:data)
|
data/lib/trains/version.rb
CHANGED
data/lib/trains/visitor/model.rb
CHANGED
|
@@ -9,7 +9,11 @@ module Trains
|
|
|
9
9
|
belongs_to
|
|
10
10
|
has_one
|
|
11
11
|
has_and_belongs_to_many
|
|
12
|
-
]
|
|
12
|
+
].freeze
|
|
13
|
+
MODEL_PARENT_CLASSES = %w[
|
|
14
|
+
ApplicationRecord
|
|
15
|
+
ActiveRecord::Base
|
|
16
|
+
].freeze
|
|
13
17
|
attr_reader :result
|
|
14
18
|
|
|
15
19
|
# skipcq: RB-LI1087
|
|
@@ -19,7 +23,7 @@ module Trains
|
|
|
19
23
|
|
|
20
24
|
def on_class(node)
|
|
21
25
|
return unless node.parent_class
|
|
22
|
-
return unless node.parent_class.source
|
|
26
|
+
return unless MODEL_PARENT_CLASSES.include? node.parent_class.source
|
|
23
27
|
|
|
24
28
|
@model_class = node.identifier.source
|
|
25
29
|
node.each_descendant(:send) { |send_node| parse_model(send_node) }
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: trains
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.18
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Syed Faraaz Ahmad
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-07-
|
|
11
|
+
date: 2023-07-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
130
130
|
- !ruby/object:Gem::Version
|
|
131
131
|
version: '0'
|
|
132
132
|
requirements: []
|
|
133
|
-
rubygems_version: 3.4.
|
|
133
|
+
rubygems_version: 3.4.16
|
|
134
134
|
signing_key:
|
|
135
135
|
specification_version: 4
|
|
136
136
|
summary: Collect metadata about your Rails app by statically analyzing it
|