repo_dependency_graph 0.5.0 → 0.6.0
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/repo_dependency_graph.rb +11 -22
- data/lib/repo_dependency_graph/cli.rb +1 -0
- data/lib/repo_dependency_graph/version.rb +1 -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: fcae82e09e603259bf440462660251915622ca5fd5c0c09964b9dc8a32af93a9
|
4
|
+
data.tar.gz: 21b413b03a5d6bda6af03531cf2128560ad80c988f94eb2a499d555c184c28b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea7f863be8ffe68e240e75a1944bcb53a98663486b2cd660bb1086e9f24c33fc594068bd2b93916c78d1e0d21787717948c5b75b27a2b190a047c8bd9adfd58b
|
7
|
+
data.tar.gz: fb63dff1d601c3397d7be6203cd2c0feb25f9060df2e2b29b254bc0ae4949b4f9f2ab0929cdfd68279c6dff0afc82844a309684f0e319e47395917a4da00912f
|
@@ -11,7 +11,7 @@ module RepoDependencyGraph
|
|
11
11
|
raise ArgumentError, "Map only makes sense when searching for internal repos"
|
12
12
|
end
|
13
13
|
|
14
|
-
all = OrganizationAudit::Repo.all(options).sort_by(&:name)
|
14
|
+
all = OrganizationAudit::Repo.all(options.slice(:user, :organization, :token, :max_pages)).sort_by(&:name)
|
15
15
|
all.select!(&:private?) if options[:private]
|
16
16
|
all.select! { |r| r.name =~ options[:select] } if options[:select]
|
17
17
|
all.reject! { |r| r.name =~ options[:reject] } if options[:reject]
|
@@ -41,17 +41,14 @@ module RepoDependencyGraph
|
|
41
41
|
end
|
42
42
|
|
43
43
|
if !options[:only] || options[:only] == "gem"
|
44
|
-
gems =
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
44
|
+
gems =
|
45
|
+
if repo.gem?
|
46
|
+
scan_gemspec(repo.name, repo.gemspec_content)
|
47
|
+
elsif content = content_from_any(repo, ["gems.locked", "Gemfile.lock"])
|
48
|
+
scan_gemfile_lock(repo.name, content)
|
49
|
+
elsif content = content_from_any(repo, ["gems.rb", "Gemfile"])
|
50
|
+
scan_gemfile(repo.name, content)
|
49
51
|
end
|
50
|
-
elsif content = content_from_any(repo, ["gems.locked", "Gemfile.lock"])
|
51
|
-
scan_gemfile_lock(repo.name, content)
|
52
|
-
elsif content = content_from_any(repo, ["gems.rb", "Gemfile"])
|
53
|
-
scan_gemfile(repo.name, content)
|
54
|
-
end
|
55
52
|
repos.concat gems if gems
|
56
53
|
end
|
57
54
|
|
@@ -71,23 +68,15 @@ module RepoDependencyGraph
|
|
71
68
|
end
|
72
69
|
|
73
70
|
def scan_gemfile_lock(repo_name, content)
|
71
|
+
content = content.gsub(/BUNDLED WITH\n.*\n/, "")
|
74
72
|
Bundler::LockfileParser.new(content).specs.map { |d| [d.name, d.version.to_s] }
|
75
73
|
rescue
|
76
74
|
$stderr.puts "Error parsing #{repo_name} Gemfile.lock:\n#{content}\n\n#{$!}"
|
77
75
|
nil
|
78
76
|
end
|
79
77
|
|
80
|
-
def
|
81
|
-
content
|
82
|
-
gsub(/^\s*(require|require_relative) .*$/, "").
|
83
|
-
gsub(/([a-z\d]+::)+version(::[a-z]+)?/i){|x| x =~ /^Gem::Version$/i ? x : '"1.2.3"' }.
|
84
|
-
gsub(/^\s*\$(:|LOAD_PATH).*/, "").
|
85
|
-
gsub(/(File|IO)\.read\(['"]VERSION.*?\)/, '"1.2.3"').
|
86
|
-
gsub(/(File|IO)\.read\(.*?\)/, '\' VERSION = "1.2.3"\'')
|
87
|
-
eval content
|
88
|
-
rescue StandardError, SyntaxError
|
89
|
-
$stderr.puts "Error parsing #{repo_name} gemspec:\n#{content}\n\n#{$!}"
|
90
|
-
nil
|
78
|
+
def scan_gemspec(_, content)
|
79
|
+
content.scan(/add(?:_runtime)?_dependency[\s(]+['"]([^'"]*)['"](?:,\s*['"]([^'"]*)['"])*/).map(&:compact)
|
91
80
|
end
|
92
81
|
end
|
93
82
|
end
|
@@ -39,6 +39,7 @@ module RepoDependencyGraph
|
|
39
39
|
options[:map][1] = options[:map][1].to_s
|
40
40
|
end
|
41
41
|
opts.on("--only TYPE", String, "Only this type (chef,gem), default: all") { |t| options[:only] = t }
|
42
|
+
opts.on("--max-pages PAGES", Integer, "") { |p| options[:max_pages] = p }
|
42
43
|
opts.on("--select REGEX", "Only include repos with matching names") { |regex| options[:select] = Regexp.new(regex) }
|
43
44
|
opts.on("--reject REGEX", "Exclude repos with matching names") { |regex| options[:reject] = Regexp.new(regex) }
|
44
45
|
opts.on("-h", "--help", "Show this.") { puts opts; exit }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: repo_dependency_graph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: organization_audit
|