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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 867c9f81c167ac07086975203edbcd565d171dd4
4
- data.tar.gz: 18144c302d675e4a98b7dcb1327dbbef569dd7d7
3
+ metadata.gz: eff75d756f350cecdf306ebbf2ef30b6c3a8325b
4
+ data.tar.gz: 668595d52235c97176c882a087c5fcbd34714653
5
5
  SHA512:
6
- metadata.gz: bb28d18d516a6b009239733a757074995b530bd9a60713a8c4535220c372d412a294e49f35fbfddbcc02c0a1bb8127e14d4cba4a554807a3bb115b6be3d78153
7
- data.tar.gz: 15f93ad1f1cdbdf72e1705f0e062c5ce282ffcd3973cdb38ce1447b7ef468fd1e077766f2d1b97c33fab1c8d36dda7f8108a07ac56e9410b850c0f157cf646d5
6
+ metadata.gz: 8e1ee33ae811cd7c2bc785d76e04505ac45f12d86ba0b25b80b081f4b3d66546c6b3fd2c0faa684a4960b338f497f54c7c3c11cca64972380c60d5dfa92242a7
7
+ data.tar.gz: 7a6c5e1580fdcb724d79283ece1db6a7d84e802f7dc3372ddc63714e7969e2ab1d53e289a326c309534937a0ee6c36ae6afafdced24588d6586c74e36d549904
@@ -1,3 +1,3 @@
1
1
  module RepoDependencyGraph
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -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 = load_spec(repo.gemspec_content)
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 load_spec(content)
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 Exception
79
- $stderr.puts "Error when parsing content:\n#{content}\n\n#{$!}"
81
+ rescue
82
+ $stderr.puts "Error parsing #{repo_name} gemspec:\n#{content}\n\n#{$!}"
80
83
  nil
81
84
  end
82
85
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: repo_dependency_graph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser