repo_dependency_graph 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/repo_dependency_graph/version.rb +1 -1
- data/lib/repo_dependency_graph.rb +13 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eff75d756f350cecdf306ebbf2ef30b6c3a8325b
|
4
|
+
data.tar.gz: 668595d52235c97176c882a087c5fcbd34714653
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e1ee33ae811cd7c2bc785d76e04505ac45f12d86ba0b25b80b081f4b3d66546c6b3fd2c0faa684a4960b338f497f54c7c3c11cca64972380c60d5dfa92242a7
|
7
|
+
data.tar.gz: 7a6c5e1580fdcb724d79283ece1db6a7d84e802f7dc3372ddc63714e7969e2ab1d53e289a326c309534937a0ee6c36ae6afafdced24588d6586c74e36d549904
|
@@ -34,21 +34,21 @@ module RepoDependencyGraph
|
|
34
34
|
|
35
35
|
if !options[:only] || options[:only] == "chef"
|
36
36
|
if content = repo.content("metadata.rb")
|
37
|
-
repos.concat scan_chef_metadata(content)
|
37
|
+
repos.concat scan_chef_metadata(repo.name, content)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
if !options[:only] || options[:only] == "gem"
|
42
|
-
gems = if repo.gem? && spec =
|
42
|
+
gems = if repo.gem? && spec = load_gemspec(repo.name, repo.gemspec_content)
|
43
43
|
spec.runtime_dependencies.map do |d|
|
44
44
|
r = d.requirement.to_s
|
45
45
|
r = nil if r == ">= 0"
|
46
46
|
[d.name, r].compact
|
47
47
|
end
|
48
48
|
elsif content = repo.content("Gemfile.lock")
|
49
|
-
scan_gemfile_lock(content)
|
49
|
+
scan_gemfile_lock(repo.name, content)
|
50
50
|
elsif content = repo.content("Gemfile")
|
51
|
-
scan_gemfile(content)
|
51
|
+
scan_gemfile(repo.name, content)
|
52
52
|
end
|
53
53
|
repos.concat gems if gems
|
54
54
|
end
|
@@ -56,27 +56,30 @@ module RepoDependencyGraph
|
|
56
56
|
repos
|
57
57
|
end
|
58
58
|
|
59
|
-
def scan_chef_metadata(content)
|
59
|
+
def scan_chef_metadata(_, content)
|
60
60
|
content.scan(/^\s*depends ['"](.*?)['"](?:,\s?['"](.*?)['"])?/).map(&:compact)
|
61
61
|
end
|
62
62
|
|
63
|
-
def scan_gemfile(content)
|
63
|
+
def scan_gemfile(_, content)
|
64
64
|
content.scan(/^\s*gem ['"](.*?)['"](?:,\s?['"](.*?)['"]|.*\bref(?::|\s*=>)\s*['"](.*)['"])?/).map(&:compact)
|
65
65
|
end
|
66
66
|
|
67
|
-
def scan_gemfile_lock(content)
|
67
|
+
def scan_gemfile_lock(repo_name, content)
|
68
68
|
Bundler::LockfileParser.new(content).specs.map { |d| [d.name, d.version.to_s] }
|
69
|
+
rescue
|
70
|
+
$stderr.puts "Error parsing #{repo_name} Gemfile.lock:\n#{content}\n\n#{$!}"
|
71
|
+
nil
|
69
72
|
end
|
70
73
|
|
71
|
-
def
|
74
|
+
def load_gemspec(repo_name, content)
|
72
75
|
eval content.
|
73
76
|
gsub(/^\s*(require|require_relative) .*$/, "").
|
74
77
|
gsub(/([a-z\d]+::)+version(::[a-z]+)?/i){|x| x =~ /^Gem::Version$/i ? x : '"1.2.3"' }.
|
75
78
|
gsub(/^\s*\$(:|LOAD_PATH).*/, "").
|
76
79
|
gsub(/(File|IO)\.read\(['"]VERSION.*?\)/, '"1.2.3"').
|
77
80
|
gsub(/(File|IO)\.read\(.*?\)/, '\' VERSION = "1.2.3"\'')
|
78
|
-
rescue
|
79
|
-
$stderr.puts "Error
|
81
|
+
rescue
|
82
|
+
$stderr.puts "Error parsing #{repo_name} gemspec:\n#{content}\n\n#{$!}"
|
80
83
|
nil
|
81
84
|
end
|
82
85
|
end
|