bundler-stats 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bundler/stats/remover.rb +10 -6
- data/lib/bundler/stats/version.rb +1 -1
- data/spec/lib/bundler/stats/remover_spec.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00521574e50038905fce9c0f58c700220922c38ff91ce987448e2372121333ff
|
4
|
+
data.tar.gz: 76632e66f4e00c8cc0a00e4ae755fddbd29361526067140c3610b5023042008d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88b9b171219491c7590c41758137200a2c07e85456f4d21aaa00ea786b8c6574622ca872e133cf39bfc05603cb2372bd9a6dda67841b114f0c080abb4b471898
|
7
|
+
data.tar.gz: 8fb71219134a7722f93811d61d29aef329a39cfd67a9d52a5a282de1dc708a3eada49321347e087fa8b4df73db16a2396cdf15acc9b34511ad69dde966a2b0f6
|
@@ -1,11 +1,12 @@
|
|
1
1
|
class Bundler::Stats::Remover
|
2
|
-
ERR_MESSAGE = "Trying to check whether
|
2
|
+
ERR_MESSAGE = "Trying to check whether dep can be removed, but was unable " \
|
3
3
|
"to resolve whether it is used by `%s`. It may not be in your Gemfile.lock. " \
|
4
4
|
"This often happens when a dependency isn't installed on your platform."
|
5
5
|
|
6
6
|
def initialize(tree, top_level)
|
7
|
-
@tree
|
8
|
-
@top_level
|
7
|
+
@tree = tree
|
8
|
+
@top_level = top_level
|
9
|
+
@trace_warnings = []
|
9
10
|
end
|
10
11
|
|
11
12
|
def potential_removals(target)
|
@@ -33,7 +34,7 @@ class Bundler::Stats::Remover
|
|
33
34
|
return true if candidate == target
|
34
35
|
|
35
36
|
if modified_tree[candidate].nil?
|
36
|
-
|
37
|
+
warn_of_bad_tracing(candidate)
|
37
38
|
else
|
38
39
|
deps_to_check += modified_tree[candidate].dependencies
|
39
40
|
end
|
@@ -44,7 +45,10 @@ class Bundler::Stats::Remover
|
|
44
45
|
|
45
46
|
private
|
46
47
|
|
47
|
-
def
|
48
|
-
|
48
|
+
def warn_of_bad_tracing(candidate)
|
49
|
+
return if @trace_warnings.include? candidate
|
50
|
+
|
51
|
+
STDERR.puts(ERR_MESSAGE % [candidate])
|
52
|
+
@trace_warnings << candidate
|
49
53
|
end
|
50
54
|
end
|
@@ -106,11 +106,11 @@ describe Bundler::Stats::Remover do
|
|
106
106
|
it "raises an error if the top level dependency isn't in the lockfile" do
|
107
107
|
top_level << dep("tzinfo")
|
108
108
|
remover = subject.new(tree, top_level)
|
109
|
-
allow(remover).to receive(:
|
109
|
+
allow(remover).to receive(:warn_of_bad_tracing)
|
110
110
|
|
111
111
|
remover.still_used?("actionview", deleted: "rails")
|
112
112
|
|
113
|
-
expect(remover).to have_received(:
|
113
|
+
expect(remover).to have_received(:warn_of_bad_tracing)
|
114
114
|
end
|
115
115
|
end
|
116
116
|
end
|