mj 0.6.0 → 0.6.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f73fffd1a785c75120ffed30d970ffbc9d64f525a5a5729c814a785f7c0868e
|
4
|
+
data.tar.gz: 8a09ecd20bb4bae4e54f07d30f09c9fa534b4d2c6090d87353c3297cb1bb2210
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90f2712ab6a67d83f45ce62f4a4213e0b85404ead8f218263771095ef09121dcaf29732e81a17e459be7d2788bb836f172ec34bb6d90e3e697f49599075378eb
|
7
|
+
data.tar.gz: d05317d65dd3fb88eb5379f3e0e4439a2264c5b40d6a2276fec219058668748f852ea4474468fc7a56f527357ea5b8808d15a541bbb9558203ca6602edaec50e
|
data/Gemfile.lock
CHANGED
@@ -5,23 +5,34 @@ module Mj
|
|
5
5
|
module Resolvers
|
6
6
|
module Ruby
|
7
7
|
class RailsResolver < Resolvers::Base
|
8
|
+
attr_reader :root
|
9
|
+
|
10
|
+
def initialize(root: nil)
|
11
|
+
if root
|
12
|
+
root = "#{root.chomp("/")}/"
|
13
|
+
end
|
14
|
+
|
15
|
+
@root = root
|
16
|
+
end
|
17
|
+
|
8
18
|
private
|
9
19
|
|
10
20
|
def apply_to?(file)
|
11
21
|
file.extension == "rb"
|
12
22
|
end
|
13
23
|
|
14
|
-
def add_candidates(file, candidates)
|
15
|
-
ruby_file = Ruby::RubyFile.new(file)
|
16
|
-
|
17
|
-
add_candidate("
|
18
|
-
add_candidate("
|
24
|
+
def add_candidates(file, candidates) # rubocop:disable Metrics/AbcSize
|
25
|
+
ruby_file = Ruby::RubyFile.new(file).without_prefix(root)
|
26
|
+
|
27
|
+
add_candidate("#{root}app/#{ruby_file.class_path}.rb", :model, to: candidates)
|
28
|
+
add_candidate("#{root}spec/#{ruby_file.class_path}_spec.rb", :spec, to: candidates)
|
29
|
+
add_candidate("#{root}test/#{ruby_file.class_path}_test.rb", :minitest, to: candidates)
|
19
30
|
|
20
31
|
# lib files
|
21
|
-
add_candidate("lib/#{ruby_file.class_path}.rb", "lib", to: candidates)
|
22
|
-
add_candidate("#{ruby_file.class_path}.rb", "lib", to: candidates)
|
23
|
-
add_candidate("spec/lib/#{ruby_file.class_path}_spec.rb", :spec, to: candidates)
|
24
|
-
add_candidate("test/lib/#{ruby_file.class_path}_test.rb", :minitest, to: candidates)
|
32
|
+
add_candidate("#{root}lib/#{ruby_file.class_path}.rb", "lib", to: candidates)
|
33
|
+
add_candidate("#{root}#{ruby_file.class_path}.rb", "lib", to: candidates)
|
34
|
+
add_candidate("#{root}spec/lib/#{ruby_file.class_path}_spec.rb", :spec, to: candidates)
|
35
|
+
add_candidate("#{root}test/lib/#{ruby_file.class_path}_test.rb", :minitest, to: candidates)
|
25
36
|
end
|
26
37
|
end
|
27
38
|
end
|
@@ -5,33 +5,17 @@ module Mj
|
|
5
5
|
module Resolvers
|
6
6
|
module Ruby
|
7
7
|
class VendoredGemsResolver < Resolvers::Base
|
8
|
-
def initialize
|
9
|
-
@rails = RailsResolver.new
|
10
|
-
end
|
11
|
-
|
12
8
|
private
|
13
9
|
|
14
10
|
def apply_to?(file)
|
15
11
|
file.extension == "rb" && find_root(file)
|
16
12
|
end
|
17
13
|
|
18
|
-
def add_candidates(file, candidates)
|
19
|
-
|
14
|
+
def add_candidates(file, candidates)
|
15
|
+
@rails = RailsResolver.new(root: find_root(file))
|
20
16
|
|
21
17
|
@rails.resolve(file).each do |resolved|
|
22
|
-
|
23
|
-
found = found.sub("#{root}/", "")
|
24
|
-
|
25
|
-
unless found.match?("_spec.rb")
|
26
|
-
found = found.sub("spec/", "")
|
27
|
-
end
|
28
|
-
|
29
|
-
unless found.match?("_test.rb")
|
30
|
-
found = found.sub("test/", "")
|
31
|
-
end
|
32
|
-
|
33
|
-
file = [root, found].flatten.join("/")
|
34
|
-
add_candidate(file, resolved.type, to: candidates)
|
18
|
+
add_candidate(resolved, resolved.type, to: candidates)
|
35
19
|
end
|
36
20
|
end
|
37
21
|
|
@@ -59,6 +59,7 @@ module Mj
|
|
59
59
|
resolvers.add(Resolvers::Ruby::RailsControllerResolver.new)
|
60
60
|
resolvers.add(Resolvers::Ruby::ViewComponentResolver.new)
|
61
61
|
resolvers.add(Resolvers::Ruby::PackwerkResolver.new)
|
62
|
+
resolvers.add(Resolvers::Ruby::VendoredGemsResolver.new)
|
62
63
|
end
|
63
64
|
end
|
64
65
|
|
data/lib/mj/version.rb
CHANGED