bundle-diff 1.1.0 → 1.2.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/CHANGES.md +5 -0
- data/bundle-diff.gemspec +1 -1
- data/lib/bundler/diff/cli.rb +24 -25
- data/lib/bundler/diff/tool.rb +9 -0
- 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: 16627d483f7b0f3db714bd4d6f208c696d6e9cb36570a3e85d5b117af804ab5a
|
4
|
+
data.tar.gz: 0a7fe5601932249c75c5fe01b40bdcf1520fed756e5f88714cc0ed3a64fd429b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76744117e51c10b3b6dcd17f6d6e82a167cca4633e30753a2d27883a955b4b0388b66f353a65027333411104eea9e3cd56e1d6e6bde24c5d83d75431e1500415
|
7
|
+
data.tar.gz: 5c4c47d148e2eaaed21a6986d3662e5087ff5851bf51cc6dcc0dca4736577ffff94d139c3749137dec08a4556554d330d1898531569a7b1976d0723c685cfd50
|
data/CHANGES.md
CHANGED
data/bundle-diff.gemspec
CHANGED
data/lib/bundler/diff/cli.rb
CHANGED
@@ -17,21 +17,34 @@ module Bundler::Diff::CLI
|
|
17
17
|
|
18
18
|
error('gem name required') unless gem_name
|
19
19
|
|
20
|
-
|
20
|
+
bundled_spec = bundled_specs[gem_name]
|
21
21
|
|
22
|
-
error('gem spec not found') unless
|
22
|
+
error('gem spec not found') unless bundled_spec
|
23
|
+
|
24
|
+
gem_dependency = Gem::Dependency.new(gem_name, options[:version])
|
25
|
+
|
26
|
+
specs_and_sources, errors = Gem::SpecFetcher.fetcher.spec_for_dependency(gem_dependency)
|
27
|
+
|
28
|
+
gem_spec, source = specs_and_sources.max_by { |s,| s.version }
|
29
|
+
|
30
|
+
error('gem spec not found') if gem_spec.nil?
|
31
|
+
|
32
|
+
installed_spec = Gem::Specification.find { |s| s.name == gem_spec.name && s.version == gem_spec.version }
|
33
|
+
|
34
|
+
if installed_spec
|
35
|
+
Bundler::Diff::Tool.diff(bundled_spec, installed_spec)
|
36
|
+
|
37
|
+
return
|
38
|
+
end
|
23
39
|
|
24
40
|
Dir.mktmpdir do |tmp_dir|
|
25
|
-
|
41
|
+
Dir.chdir(tmp_dir) { source.download(gem_spec) }
|
26
42
|
|
27
43
|
unpack(gem_spec, tmp_dir)
|
28
44
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
tool.b_dir = Pathname(tmp_dir).join(gem_spec.full_name)
|
33
|
-
tool.b_output_dir = Pathname(gem_spec.full_name)
|
34
|
-
tool.diff_entries
|
45
|
+
def gem_spec.gem_dir; Pathname(tmp_dir).join(gem_spec.full_name); end
|
46
|
+
|
47
|
+
Bundler::Diff::Tool.diff(bundled_spec, gem_spec)
|
35
48
|
end
|
36
49
|
end
|
37
50
|
|
@@ -59,8 +72,8 @@ module Bundler::Diff::CLI
|
|
59
72
|
end
|
60
73
|
end
|
61
74
|
|
62
|
-
def
|
63
|
-
@
|
75
|
+
def bundled_specs
|
76
|
+
@bundled_specs ||= Bundler.load.specs.each_with_object({}) do |spec, hash|
|
64
77
|
next if ignore?(spec)
|
65
78
|
|
66
79
|
hash[spec.name] = spec
|
@@ -76,20 +89,6 @@ module Bundler::Diff::CLI
|
|
76
89
|
end
|
77
90
|
end
|
78
91
|
|
79
|
-
def fetch(name, target_dir)
|
80
|
-
dependency = Gem::Dependency.new(name, options[:version])
|
81
|
-
|
82
|
-
specs_and_sources, errors = Gem::SpecFetcher.fetcher.spec_for_dependency(dependency)
|
83
|
-
|
84
|
-
spec, source = specs_and_sources.max_by { |s,| s.version }
|
85
|
-
|
86
|
-
error('gem spec not found') if spec.nil?
|
87
|
-
|
88
|
-
Dir.chdir(target_dir) { source.download(spec) }
|
89
|
-
|
90
|
-
spec
|
91
|
-
end
|
92
|
-
|
93
92
|
def unpack(spec, tmp_dir)
|
94
93
|
gem_file = File.join(tmp_dir, spec.full_name + '.gem')
|
95
94
|
|
data/lib/bundler/diff/tool.rb
CHANGED
@@ -9,6 +9,15 @@ class Bundler::Diff::Tool
|
|
9
9
|
attr_accessor :b_dir
|
10
10
|
attr_accessor :b_output_dir
|
11
11
|
|
12
|
+
def self.diff(a_spec, b_spec)
|
13
|
+
tool = new
|
14
|
+
tool.a_dir = Pathname(a_spec.gem_dir)
|
15
|
+
tool.a_output_dir = Pathname(a_spec.full_name)
|
16
|
+
tool.b_dir = Pathname(b_spec.gem_dir)
|
17
|
+
tool.b_output_dir = Pathname(b_spec.full_name)
|
18
|
+
tool.diff_entries
|
19
|
+
end
|
20
|
+
|
12
21
|
def diff_entries
|
13
22
|
a_files = file_list(a_dir)
|
14
23
|
b_files = file_list(b_dir)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bundle-diff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Craft
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|