rubygems-update 3.5.0 → 3.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/Manifest.txt +12 -1
- data/bundler/CHANGELOG.md +22 -0
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/checksum.rb +42 -33
- data/bundler/lib/bundler/definition.rb +19 -11
- data/bundler/lib/bundler/dsl.rb +3 -5
- data/bundler/lib/bundler/lazy_specification.rb +2 -0
- data/bundler/lib/bundler/remote_specification.rb +4 -0
- data/bundler/lib/bundler/self_manager.rb +1 -1
- data/bundler/lib/bundler/spec_set.rb +35 -7
- data/bundler/lib/bundler/vendor/connection_pool/.document +1 -0
- data/bundler/lib/bundler/vendor/fileutils/.document +1 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/.document +1 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +1 -1
- data/bundler/lib/bundler/vendor/pub_grub/.document +1 -0
- data/bundler/lib/bundler/vendor/thor/.document +1 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +0 -3
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +0 -3
- data/bundler/lib/bundler/vendor/tsort/.document +1 -0
- data/bundler/lib/bundler/vendor/uri/.document +1 -0
- data/bundler/lib/bundler/version.rb +1 -1
- data/bundler/lib/bundler.rb +3 -5
- data/lib/rubygems/basic_specification.rb +7 -1
- data/lib/rubygems/net-http/.document +1 -0
- data/lib/rubygems/net-protocol/.document +1 -0
- data/lib/rubygems/package.rb +12 -2
- data/lib/rubygems/request.rb +4 -4
- data/lib/rubygems/resolv/.document +1 -0
- data/lib/rubygems/resolver/molinillo/.document +1 -0
- data/lib/rubygems/timeout/.document +1 -0
- data/lib/rubygems.rb +8 -1
- data/rubygems-update.gemspec +1 -1
- metadata +15 -4
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/lcs_diff.rb +0 -49
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 516ff3035710aec51c55a79b9d0634c6900796ff1a0ed176db0eed96ea9fdc83
|
4
|
+
data.tar.gz: 3a7c9ba6ba6c93e8c78ece390b1d14c7b9aa5876c7580fa53a85b0eb18e83311
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14bde13965cae368e5b5c812fb6e4e45cdec3bd7fe116b1eff897e3a2b7131ca555fbe3dff6da0d847854c81cc886bfb5f8835d13e7e60fa4a569432149f4684
|
7
|
+
data.tar.gz: d50b039fa4f0b3ed8a66019f522a6c8b64679a69e05a31b31a82a7e6e2c97d2fffab43593076729b3bf98da795f345f252a678a33e55d50209d3f15b1e74ef9f
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
# 3.5.2 / 2023-12-21
|
2
|
+
|
3
|
+
## Enhancements:
|
4
|
+
|
5
|
+
* Support dynamic library loading with extension .so or .o. Pull request
|
6
|
+
[#7241](https://github.com/rubygems/rubygems/pull/7241) by hogelog
|
7
|
+
* Installs bundler 2.5.2 as a default gem.
|
8
|
+
|
9
|
+
## Performance:
|
10
|
+
|
11
|
+
* Replace `object_id` comparison with identity Hash. Pull request
|
12
|
+
[#7303](https://github.com/rubygems/rubygems/pull/7303) by amomchilov
|
13
|
+
* Use IO.copy_stream when reading, writing. Pull request
|
14
|
+
[#6958](https://github.com/rubygems/rubygems/pull/6958) by martinemde
|
15
|
+
|
16
|
+
# 3.5.1 / 2023-12-15
|
17
|
+
|
18
|
+
## Enhancements:
|
19
|
+
|
20
|
+
* Installs bundler 2.5.1 as a default gem.
|
21
|
+
|
1
22
|
# 3.5.0 / 2023-12-15
|
2
23
|
|
3
24
|
## Security:
|
data/Manifest.txt
CHANGED
@@ -248,18 +248,22 @@ bundler/lib/bundler/ui/silent.rb
|
|
248
248
|
bundler/lib/bundler/uri_credentials_filter.rb
|
249
249
|
bundler/lib/bundler/uri_normalizer.rb
|
250
250
|
bundler/lib/bundler/vendor/.document
|
251
|
+
bundler/lib/bundler/vendor/connection_pool/.document
|
251
252
|
bundler/lib/bundler/vendor/connection_pool/LICENSE
|
252
253
|
bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb
|
253
254
|
bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb
|
254
255
|
bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb
|
255
256
|
bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb
|
257
|
+
bundler/lib/bundler/vendor/fileutils/.document
|
256
258
|
bundler/lib/bundler/vendor/fileutils/LICENSE.txt
|
257
259
|
bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb
|
260
|
+
bundler/lib/bundler/vendor/net-http-persistent/.document
|
258
261
|
bundler/lib/bundler/vendor/net-http-persistent/README.rdoc
|
259
262
|
bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb
|
260
263
|
bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb
|
261
264
|
bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb
|
262
265
|
bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb
|
266
|
+
bundler/lib/bundler/vendor/pub_grub/.document
|
263
267
|
bundler/lib/bundler/vendor/pub_grub/LICENSE.txt
|
264
268
|
bundler/lib/bundler/vendor/pub_grub/lib/pub_grub.rb
|
265
269
|
bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb
|
@@ -277,6 +281,7 @@ bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb
|
|
277
281
|
bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb
|
278
282
|
bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb
|
279
283
|
bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb
|
284
|
+
bundler/lib/bundler/vendor/thor/.document
|
280
285
|
bundler/lib/bundler/vendor/thor/LICENSE.md
|
281
286
|
bundler/lib/bundler/vendor/thor/lib/thor.rb
|
282
287
|
bundler/lib/bundler/vendor/thor/lib/thor/actions.rb
|
@@ -308,14 +313,15 @@ bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb
|
|
308
313
|
bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb
|
309
314
|
bundler/lib/bundler/vendor/thor/lib/thor/shell/column_printer.rb
|
310
315
|
bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb
|
311
|
-
bundler/lib/bundler/vendor/thor/lib/thor/shell/lcs_diff.rb
|
312
316
|
bundler/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb
|
313
317
|
bundler/lib/bundler/vendor/thor/lib/thor/shell/terminal.rb
|
314
318
|
bundler/lib/bundler/vendor/thor/lib/thor/shell/wrapped_printer.rb
|
315
319
|
bundler/lib/bundler/vendor/thor/lib/thor/util.rb
|
316
320
|
bundler/lib/bundler/vendor/thor/lib/thor/version.rb
|
321
|
+
bundler/lib/bundler/vendor/tsort/.document
|
317
322
|
bundler/lib/bundler/vendor/tsort/LICENSE.txt
|
318
323
|
bundler/lib/bundler/vendor/tsort/lib/tsort.rb
|
324
|
+
bundler/lib/bundler/vendor/uri/.document
|
319
325
|
bundler/lib/bundler/vendor/uri/LICENSE.txt
|
320
326
|
bundler/lib/bundler/vendor/uri/lib/uri.rb
|
321
327
|
bundler/lib/bundler/vendor/uri/lib/uri/common.rb
|
@@ -425,6 +431,7 @@ lib/rubygems/installer.rb
|
|
425
431
|
lib/rubygems/installer_uninstaller_utils.rb
|
426
432
|
lib/rubygems/local_remote_options.rb
|
427
433
|
lib/rubygems/name_tuple.rb
|
434
|
+
lib/rubygems/net-http/.document
|
428
435
|
lib/rubygems/net-http/LICENSE.txt
|
429
436
|
lib/rubygems/net-http/lib/net/http.rb
|
430
437
|
lib/rubygems/net-http/lib/net/http/backward.rb
|
@@ -438,6 +445,7 @@ lib/rubygems/net-http/lib/net/http/response.rb
|
|
438
445
|
lib/rubygems/net-http/lib/net/http/responses.rb
|
439
446
|
lib/rubygems/net-http/lib/net/http/status.rb
|
440
447
|
lib/rubygems/net-http/lib/net/https.rb
|
448
|
+
lib/rubygems/net-protocol/.document
|
441
449
|
lib/rubygems/net-protocol/LICENSE.txt
|
442
450
|
lib/rubygems/net-protocol/lib/net/protocol.rb
|
443
451
|
lib/rubygems/net/http.rb
|
@@ -481,6 +489,7 @@ lib/rubygems/request_set/lockfile.rb
|
|
481
489
|
lib/rubygems/request_set/lockfile/parser.rb
|
482
490
|
lib/rubygems/request_set/lockfile/tokenizer.rb
|
483
491
|
lib/rubygems/requirement.rb
|
492
|
+
lib/rubygems/resolv/.document
|
484
493
|
lib/rubygems/resolv/LICENSE.txt
|
485
494
|
lib/rubygems/resolv/lib/resolv.rb
|
486
495
|
lib/rubygems/resolver.rb
|
@@ -503,6 +512,7 @@ lib/rubygems/resolver/local_specification.rb
|
|
503
512
|
lib/rubygems/resolver/lock_set.rb
|
504
513
|
lib/rubygems/resolver/lock_specification.rb
|
505
514
|
lib/rubygems/resolver/molinillo.rb
|
515
|
+
lib/rubygems/resolver/molinillo/.document
|
506
516
|
lib/rubygems/resolver/molinillo/LICENSE
|
507
517
|
lib/rubygems/resolver/molinillo/lib/molinillo.rb
|
508
518
|
lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb
|
@@ -564,6 +574,7 @@ lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem
|
|
564
574
|
lib/rubygems/stub_specification.rb
|
565
575
|
lib/rubygems/text.rb
|
566
576
|
lib/rubygems/timeout.rb
|
577
|
+
lib/rubygems/timeout/.document
|
567
578
|
lib/rubygems/timeout/LICENSE.txt
|
568
579
|
lib/rubygems/timeout/lib/timeout.rb
|
569
580
|
lib/rubygems/tsort.rb
|
data/bundler/CHANGELOG.md
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
# 2.5.2 (December 21, 2023)
|
2
|
+
|
3
|
+
## Enhancements:
|
4
|
+
|
5
|
+
- Avoid vendored thor gem polluting the global namespace [#7305](https://github.com/rubygems/rubygems/pull/7305)
|
6
|
+
|
7
|
+
## Bug fixes:
|
8
|
+
|
9
|
+
- Fix `bundle update --bundler` when latest version does not support current ruby [#7310](https://github.com/rubygems/rubygems/pull/7310)
|
10
|
+
- Fix incorrect lockfiles being generated in some situations [#7307](https://github.com/rubygems/rubygems/pull/7307)
|
11
|
+
- Fix incorrect re-resolve messages [#7306](https://github.com/rubygems/rubygems/pull/7306)
|
12
|
+
|
13
|
+
# 2.5.1 (December 15, 2023)
|
14
|
+
|
15
|
+
## Bug fixes:
|
16
|
+
|
17
|
+
- Fix `ruby` Gemfile DSL with `file:` parameter no longer working [#7288](https://github.com/rubygems/rubygems/pull/7288)
|
18
|
+
|
19
|
+
## Performance:
|
20
|
+
|
21
|
+
- Save array allocation for every dependency in Gemfile [#7270](https://github.com/rubygems/rubygems/pull/7270)
|
22
|
+
|
1
23
|
# 2.5.0 (December 15, 2023)
|
2
24
|
|
3
25
|
## Breaking changes:
|
@@ -4,8 +4,8 @@ module Bundler
|
|
4
4
|
# Represents metadata from when the Bundler gem was built.
|
5
5
|
module BuildMetadata
|
6
6
|
# begin ivars
|
7
|
-
@built_at = "2023-12-
|
8
|
-
@git_commit_sha = "
|
7
|
+
@built_at = "2023-12-21".freeze
|
8
|
+
@git_commit_sha = "00351925e4".freeze
|
9
9
|
@release = true
|
10
10
|
# end ivars
|
11
11
|
|
@@ -30,6 +30,7 @@ module Bundler
|
|
30
30
|
|
31
31
|
def from_api(digest, source_uri, algo = DEFAULT_ALGORITHM)
|
32
32
|
return if Bundler.settings[:disable_checksum_validation]
|
33
|
+
|
33
34
|
Checksum.new(algo, to_hexdigest(digest, algo), Source.new(:api, source_uri))
|
34
35
|
end
|
35
36
|
|
@@ -41,11 +42,13 @@ module Bundler
|
|
41
42
|
def to_hexdigest(digest, algo = DEFAULT_ALGORITHM)
|
42
43
|
return digest unless algo == DEFAULT_ALGORITHM
|
43
44
|
return digest if digest.match?(/\A[0-9a-f]{64}\z/i)
|
45
|
+
|
44
46
|
if digest.match?(%r{\A[-0-9a-z_+/]{43}={0,2}\z}i)
|
45
47
|
digest = digest.tr("-_", "+/") # fix urlsafe base64
|
46
|
-
|
48
|
+
digest.unpack1("m0").unpack1("H*")
|
49
|
+
else
|
50
|
+
raise ArgumentError, "#{digest.inspect} is not a valid SHA256 hex or base64 digest"
|
47
51
|
end
|
48
|
-
raise ArgumentError, "#{digest.inspect} is not a valid SHA256 hex or base64 digest"
|
49
52
|
end
|
50
53
|
end
|
51
54
|
|
@@ -63,6 +66,10 @@ module Bundler
|
|
63
66
|
|
64
67
|
alias_method :eql?, :==
|
65
68
|
|
69
|
+
def same_source?(other)
|
70
|
+
sources.include?(other.sources.first)
|
71
|
+
end
|
72
|
+
|
66
73
|
def match?(other)
|
67
74
|
other.is_a?(self.class) && other.digest == digest && other.algo == algo
|
68
75
|
end
|
@@ -81,6 +88,7 @@ module Bundler
|
|
81
88
|
|
82
89
|
def merge!(other)
|
83
90
|
return nil unless match?(other)
|
91
|
+
|
84
92
|
@sources.concat(other.sources).uniq!
|
85
93
|
self
|
86
94
|
end
|
@@ -161,26 +169,17 @@ module Bundler
|
|
161
169
|
|
162
170
|
def initialize
|
163
171
|
@store = {}
|
164
|
-
|
165
|
-
|
166
|
-
def initialize_copy(other)
|
167
|
-
@store = {}
|
168
|
-
other.store.each do |lock_name, checksums|
|
169
|
-
store[lock_name] = checksums.dup
|
170
|
-
end
|
172
|
+
@store_mutex = Mutex.new
|
171
173
|
end
|
172
174
|
|
173
175
|
def inspect
|
174
176
|
"#<#{self.class}:#{object_id} size=#{store.size}>"
|
175
177
|
end
|
176
178
|
|
177
|
-
def fetch(spec, algo = DEFAULT_ALGORITHM)
|
178
|
-
store[spec.name_tuple.lock_name]&.fetch(algo, nil)
|
179
|
-
end
|
180
|
-
|
181
179
|
# Replace when the new checksum is from the same source.
|
182
|
-
# The primary purpose
|
180
|
+
# The primary purpose is registering checksums from gems where there are
|
183
181
|
# duplicates of the same gem (according to full_name) in the index.
|
182
|
+
#
|
184
183
|
# In particular, this is when 2 gems have two similar platforms, e.g.
|
185
184
|
# "darwin20" and "darwin-20", both of which resolve to darwin-20.
|
186
185
|
# In the Index, the later gem replaces the former, so we do that here.
|
@@ -192,19 +191,19 @@ module Bundler
|
|
192
191
|
return unless checksum
|
193
192
|
|
194
193
|
lock_name = spec.name_tuple.lock_name
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
register_checksum(lock_name, checksum)
|
194
|
+
@store_mutex.synchronize do
|
195
|
+
existing = fetch_checksum(lock_name, checksum.algo)
|
196
|
+
if !existing || existing.same_source?(checksum)
|
197
|
+
store_checksum(lock_name, checksum)
|
198
|
+
else
|
199
|
+
merge_checksum(lock_name, checksum, existing)
|
200
|
+
end
|
203
201
|
end
|
204
202
|
end
|
205
203
|
|
206
204
|
def register(spec, checksum)
|
207
205
|
return unless checksum
|
206
|
+
|
208
207
|
register_checksum(spec.name_tuple.lock_name, checksum)
|
209
208
|
end
|
210
209
|
|
@@ -218,7 +217,8 @@ module Bundler
|
|
218
217
|
|
219
218
|
def to_lock(spec)
|
220
219
|
lock_name = spec.name_tuple.lock_name
|
221
|
-
|
220
|
+
checksums = @store[lock_name]
|
221
|
+
if checksums
|
222
222
|
"#{lock_name} #{checksums.values.map(&:to_lock).sort.join(",")}"
|
223
223
|
else
|
224
224
|
lock_name
|
@@ -228,18 +228,27 @@ module Bundler
|
|
228
228
|
private
|
229
229
|
|
230
230
|
def register_checksum(lock_name, checksum)
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
checksum
|
239
|
-
else
|
240
|
-
raise ChecksumMismatchError.new(lock_name, existing, checksum)
|
231
|
+
@store_mutex.synchronize do
|
232
|
+
existing = fetch_checksum(lock_name, checksum.algo)
|
233
|
+
if existing
|
234
|
+
merge_checksum(lock_name, checksum, existing)
|
235
|
+
else
|
236
|
+
store_checksum(lock_name, checksum)
|
237
|
+
end
|
241
238
|
end
|
242
239
|
end
|
240
|
+
|
241
|
+
def merge_checksum(lock_name, checksum, existing)
|
242
|
+
existing.merge!(checksum) || raise(ChecksumMismatchError.new(lock_name, existing, checksum))
|
243
|
+
end
|
244
|
+
|
245
|
+
def store_checksum(lock_name, checksum)
|
246
|
+
(@store[lock_name] ||= {})[checksum.algo] = checksum
|
247
|
+
end
|
248
|
+
|
249
|
+
def fetch_checksum(lock_name, algo)
|
250
|
+
@store[lock_name]&.fetch(algo, nil)
|
251
|
+
end
|
243
252
|
end
|
244
253
|
end
|
245
254
|
end
|
@@ -496,7 +496,15 @@ module Bundler
|
|
496
496
|
private :sources
|
497
497
|
|
498
498
|
def nothing_changed?
|
499
|
-
!@source_changes &&
|
499
|
+
!@source_changes &&
|
500
|
+
!@dependency_changes &&
|
501
|
+
!@new_platform &&
|
502
|
+
!@path_changes &&
|
503
|
+
!@local_changes &&
|
504
|
+
!@missing_lockfile_dep &&
|
505
|
+
!@unlocking_bundler &&
|
506
|
+
!@locked_spec_with_missing_deps &&
|
507
|
+
!@locked_spec_with_invalid_deps
|
500
508
|
end
|
501
509
|
|
502
510
|
def no_resolve_needed?
|
@@ -653,7 +661,8 @@ module Bundler
|
|
653
661
|
[@local_changes, "the gemspecs for git local gems changed"],
|
654
662
|
[@missing_lockfile_dep, "your lock file is missing \"#{@missing_lockfile_dep}\""],
|
655
663
|
[@unlocking_bundler, "an update to the version of Bundler itself was requested"],
|
656
|
-
[@
|
664
|
+
[@locked_spec_with_missing_deps, "your lock file includes \"#{@locked_spec_with_missing_deps}\" but not some of its dependencies"],
|
665
|
+
[@locked_spec_with_invalid_deps, "your lockfile does not satisfy dependencies of \"#{@locked_spec_with_invalid_deps}\""],
|
657
666
|
].select(&:first).map(&:last).join(", ")
|
658
667
|
end
|
659
668
|
|
@@ -708,26 +717,25 @@ module Bundler
|
|
708
717
|
end
|
709
718
|
|
710
719
|
def check_lockfile
|
711
|
-
@invalid_lockfile_dep = nil
|
712
720
|
@missing_lockfile_dep = nil
|
713
721
|
|
714
|
-
|
722
|
+
@locked_spec_with_invalid_deps = nil
|
723
|
+
@locked_spec_with_missing_deps = nil
|
724
|
+
|
715
725
|
missing = []
|
716
726
|
invalid = []
|
717
727
|
|
718
728
|
@locked_specs.each do |s|
|
719
|
-
|
720
|
-
next if dep.name == "bundler"
|
729
|
+
validation = @locked_specs.validate_deps(s)
|
721
730
|
|
722
|
-
|
723
|
-
|
724
|
-
end
|
731
|
+
missing << s if validation == :missing
|
732
|
+
invalid << s if validation == :invalid
|
725
733
|
end
|
726
734
|
|
727
735
|
if missing.any?
|
728
736
|
@locked_specs.delete(missing)
|
729
737
|
|
730
|
-
@
|
738
|
+
@locked_spec_with_missing_deps = missing.first.name
|
731
739
|
elsif !@dependency_changes
|
732
740
|
@missing_lockfile_dep = current_dependencies.find do |d|
|
733
741
|
@locked_specs[d.name].empty? && d.name != "bundler"
|
@@ -737,7 +745,7 @@ module Bundler
|
|
737
745
|
if invalid.any?
|
738
746
|
@locked_specs.delete(invalid)
|
739
747
|
|
740
|
-
@
|
748
|
+
@locked_spec_with_invalid_deps = invalid.first.name
|
741
749
|
end
|
742
750
|
end
|
743
751
|
|
data/bundler/lib/bundler/dsl.rb
CHANGED
@@ -20,7 +20,7 @@ module Bundler
|
|
20
20
|
|
21
21
|
GITHUB_PULL_REQUEST_URL = %r{\Ahttps://github\.com/([A-Za-z0-9_\-\.]+/[A-Za-z0-9_\-\.]+)/pull/(\d+)\z}
|
22
22
|
|
23
|
-
attr_reader :gemspecs
|
23
|
+
attr_reader :gemspecs, :gemfile
|
24
24
|
attr_accessor :dependencies
|
25
25
|
|
26
26
|
def initialize
|
@@ -404,13 +404,11 @@ module Bundler
|
|
404
404
|
end
|
405
405
|
|
406
406
|
def validate_keys(command, opts, valid_keys)
|
407
|
-
|
408
|
-
|
409
|
-
git_source = opts.keys & @git_sources.keys.map(&:to_s)
|
410
|
-
if opts["branch"] && !(opts["git"] || opts["github"] || git_source.any?)
|
407
|
+
if opts["branch"] && !(opts["git"] || opts["github"] || (opts.keys & @git_sources.keys.map(&:to_s)).any?)
|
411
408
|
raise GemfileError, %(The `branch` option for `#{command}` is not allowed. Only gems with a git source can specify a branch)
|
412
409
|
end
|
413
410
|
|
411
|
+
invalid_keys = opts.keys - valid_keys
|
414
412
|
return true unless invalid_keys.any?
|
415
413
|
|
416
414
|
message = String.new
|
@@ -10,6 +10,8 @@ module Bundler
|
|
10
10
|
attr_reader :name, :version, :platform
|
11
11
|
attr_accessor :source, :remote, :force_ruby_platform, :dependencies, :required_ruby_version, :required_rubygems_version
|
12
12
|
|
13
|
+
alias_method :runtime_dependencies, :dependencies
|
14
|
+
|
13
15
|
def self.from_spec(s)
|
14
16
|
lazy_spec = new(s.name, s.version, s.platform, s.source)
|
15
17
|
lazy_spec.dependencies = s.dependencies
|
@@ -37,7 +37,7 @@ module Bundler
|
|
37
37
|
|
38
38
|
specs_for_dep.first.dependencies.each do |d|
|
39
39
|
next if d.type == :development
|
40
|
-
incomplete = true if d.name != "bundler" && lookup[d.name].
|
40
|
+
incomplete = true if d.name != "bundler" && lookup[d.name].nil?
|
41
41
|
deps << [d, dep[1]]
|
42
42
|
end
|
43
43
|
else
|
@@ -45,7 +45,7 @@ module Bundler
|
|
45
45
|
end
|
46
46
|
|
47
47
|
if incomplete && check
|
48
|
-
@incomplete_specs += lookup[name]
|
48
|
+
@incomplete_specs += lookup[name] || [LazySpecification.new(name, nil, nil)]
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -64,7 +64,9 @@ module Bundler
|
|
64
64
|
valid_platform = lookup.all? do |_, specs|
|
65
65
|
spec = specs.first
|
66
66
|
matching_specs = spec.source.specs.search([spec.name, spec.version])
|
67
|
-
platform_spec = GemHelpers.select_best_platform_match(matching_specs, platform).find
|
67
|
+
platform_spec = GemHelpers.select_best_platform_match(matching_specs, platform).find do |s|
|
68
|
+
s.matches_current_metadata? && valid_dependencies?(s)
|
69
|
+
end
|
68
70
|
|
69
71
|
if platform_spec
|
70
72
|
new_specs << LazySpecification.from_spec(platform_spec)
|
@@ -90,9 +92,20 @@ module Bundler
|
|
90
92
|
platforms
|
91
93
|
end
|
92
94
|
|
95
|
+
def validate_deps(s)
|
96
|
+
s.runtime_dependencies.each do |dep|
|
97
|
+
next if dep.name == "bundler"
|
98
|
+
|
99
|
+
return :missing unless names.include?(dep.name)
|
100
|
+
return :invalid if none? {|spec| dep.matches_spec?(spec) }
|
101
|
+
end
|
102
|
+
|
103
|
+
:valid
|
104
|
+
end
|
105
|
+
|
93
106
|
def [](key)
|
94
107
|
key = key.name if key.respond_to?(:name)
|
95
|
-
lookup[key]
|
108
|
+
lookup[key]&.reverse || []
|
96
109
|
end
|
97
110
|
|
98
111
|
def []=(key, value)
|
@@ -167,7 +180,7 @@ module Bundler
|
|
167
180
|
end
|
168
181
|
|
169
182
|
def what_required(spec)
|
170
|
-
unless req = find {|s| s.
|
183
|
+
unless req = find {|s| s.runtime_dependencies.any? {|d| d.name == spec.name } }
|
171
184
|
return [spec]
|
172
185
|
end
|
173
186
|
what_required(req) << spec
|
@@ -193,8 +206,16 @@ module Bundler
|
|
193
206
|
sorted.each(&b)
|
194
207
|
end
|
195
208
|
|
209
|
+
def names
|
210
|
+
lookup.keys
|
211
|
+
end
|
212
|
+
|
196
213
|
private
|
197
214
|
|
215
|
+
def valid_dependencies?(s)
|
216
|
+
validate_deps(s) == :valid
|
217
|
+
end
|
218
|
+
|
198
219
|
def sorted
|
199
220
|
rake = @specs.find {|s| s.name == "rake" }
|
200
221
|
begin
|
@@ -213,8 +234,9 @@ module Bundler
|
|
213
234
|
|
214
235
|
def lookup
|
215
236
|
@lookup ||= begin
|
216
|
-
lookup =
|
237
|
+
lookup = {}
|
217
238
|
@specs.each do |s|
|
239
|
+
lookup[s.name] ||= []
|
218
240
|
lookup[s.name] << s
|
219
241
|
end
|
220
242
|
lookup
|
@@ -228,6 +250,8 @@ module Bundler
|
|
228
250
|
|
229
251
|
def specs_for_dependency(dep, platform)
|
230
252
|
specs_for_name = lookup[dep.name]
|
253
|
+
return [] unless specs_for_name
|
254
|
+
|
231
255
|
matching_specs = if dep.force_ruby_platform
|
232
256
|
GemHelpers.force_ruby_platform(specs_for_name)
|
233
257
|
else
|
@@ -240,7 +264,11 @@ module Bundler
|
|
240
264
|
def tsort_each_child(s)
|
241
265
|
s.dependencies.sort_by(&:name).each do |d|
|
242
266
|
next if d.type == :development
|
243
|
-
|
267
|
+
|
268
|
+
specs_for_name = lookup[d.name]
|
269
|
+
next unless specs_for_name
|
270
|
+
|
271
|
+
specs_for_name.each {|s2| yield s2 }
|
244
272
|
end
|
245
273
|
end
|
246
274
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
# Vendored files do not need to be documented
|
@@ -0,0 +1 @@
|
|
1
|
+
# Vendored files do not need to be documented
|
@@ -0,0 +1 @@
|
|
1
|
+
# Vendored files do not need to be documented
|
@@ -20,7 +20,7 @@ autoload :OpenSSL, 'openssl'
|
|
20
20
|
#
|
21
21
|
# Example:
|
22
22
|
#
|
23
|
-
# require 'bundler/vendor/net-http/lib/net/http/persistent'
|
23
|
+
# require 'bundler/vendor/net-http-persistent/lib/net/http/persistent'
|
24
24
|
#
|
25
25
|
# uri = Bundler::URI 'http://example.com/awesome/web/service'
|
26
26
|
#
|
@@ -0,0 +1 @@
|
|
1
|
+
# Vendored files do not need to be documented
|
@@ -0,0 +1 @@
|
|
1
|
+
# Vendored files do not need to be documented
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require_relative "basic"
|
2
|
-
require_relative "lcs_diff"
|
3
2
|
|
4
3
|
class Bundler::Thor
|
5
4
|
module Shell
|
@@ -7,8 +6,6 @@ class Bundler::Thor
|
|
7
6
|
# Bundler::Thor::Shell::Basic to see all available methods.
|
8
7
|
#
|
9
8
|
class Color < Basic
|
10
|
-
include LCSDiff
|
11
|
-
|
12
9
|
# Embed in a String to clear all previous ANSI sequences.
|
13
10
|
CLEAR = "\e[0m"
|
14
11
|
# The start of an ANSI bold sequence.
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require_relative "basic"
|
2
|
-
require_relative "lcs_diff"
|
3
2
|
|
4
3
|
class Bundler::Thor
|
5
4
|
module Shell
|
@@ -7,8 +6,6 @@ class Bundler::Thor
|
|
7
6
|
# Bundler::Thor::Shell::Basic to see all available methods.
|
8
7
|
#
|
9
8
|
class HTML < Basic
|
10
|
-
include LCSDiff
|
11
|
-
|
12
9
|
# The start of an HTML bold sequence.
|
13
10
|
BOLD = "font-weight: bold"
|
14
11
|
|
@@ -0,0 +1 @@
|
|
1
|
+
# Vendored files do not need to be documented
|
@@ -0,0 +1 @@
|
|
1
|
+
# Vendored files do not need to be documented
|
data/bundler/lib/bundler.rb
CHANGED
@@ -100,9 +100,7 @@ module Bundler
|
|
100
100
|
end
|
101
101
|
|
102
102
|
def create_bundle_path
|
103
|
-
|
104
|
-
mkdir_p(p)
|
105
|
-
end unless bundle_path.exist?
|
103
|
+
mkdir_p(bundle_path) unless bundle_path.exist?
|
106
104
|
|
107
105
|
@bundle_path = bundle_path.realpath
|
108
106
|
rescue Errno::EEXIST
|
@@ -119,7 +117,7 @@ module Bundler
|
|
119
117
|
@bin_path ||= begin
|
120
118
|
path = settings[:bin] || "bin"
|
121
119
|
path = Pathname.new(path).expand_path(root).expand_path
|
122
|
-
|
120
|
+
mkdir_p(path)
|
123
121
|
path
|
124
122
|
end
|
125
123
|
end
|
@@ -483,7 +481,7 @@ module Bundler
|
|
483
481
|
configured_bundle_path.use_system_gems?
|
484
482
|
end
|
485
483
|
|
486
|
-
def mkdir_p(path
|
484
|
+
def mkdir_p(path)
|
487
485
|
SharedHelpers.filesystem_access(path, :write) do |p|
|
488
486
|
FileUtils.mkdir_p(p)
|
489
487
|
end
|
@@ -84,7 +84,13 @@ class Gem::BasicSpecification
|
|
84
84
|
return false
|
85
85
|
end
|
86
86
|
|
87
|
-
|
87
|
+
is_soext = file.end_with?(".so", ".o")
|
88
|
+
|
89
|
+
if is_soext
|
90
|
+
have_file? file.delete_suffix(File.extname(file)), Gem.dynamic_library_suffixes
|
91
|
+
else
|
92
|
+
have_file? file, Gem.suffixes
|
93
|
+
end
|
88
94
|
end
|
89
95
|
|
90
96
|
def default_gem?
|
@@ -0,0 +1 @@
|
|
1
|
+
# Vendored files do not need to be documented
|
@@ -0,0 +1 @@
|
|
1
|
+
# Vendored files do not need to be documented
|
data/lib/rubygems/package.rb
CHANGED
@@ -268,7 +268,7 @@ class Gem::Package
|
|
268
268
|
|
269
269
|
tar.add_file_simple file, stat.mode, stat.size do |dst_io|
|
270
270
|
File.open file, "rb" do |src_io|
|
271
|
-
|
271
|
+
copy_stream(src_io, dst_io)
|
272
272
|
end
|
273
273
|
end
|
274
274
|
end
|
@@ -453,7 +453,7 @@ EOM
|
|
453
453
|
end
|
454
454
|
|
455
455
|
if entry.file?
|
456
|
-
File.open(destination, "wb") {|out| out
|
456
|
+
File.open(destination, "wb") {|out| copy_stream(entry, out) }
|
457
457
|
FileUtils.chmod file_mode(entry.header.mode), destination
|
458
458
|
end
|
459
459
|
|
@@ -714,6 +714,16 @@ EOM
|
|
714
714
|
rescue Zlib::GzipFile::Error => e
|
715
715
|
raise Gem::Package::FormatError.new(e.message, entry.full_name)
|
716
716
|
end
|
717
|
+
|
718
|
+
if RUBY_ENGINE == "truffleruby"
|
719
|
+
def copy_stream(src, dst) # :nodoc:
|
720
|
+
dst.write src.read
|
721
|
+
end
|
722
|
+
else
|
723
|
+
def copy_stream(src, dst) # :nodoc:
|
724
|
+
IO.copy_stream(src, dst)
|
725
|
+
end
|
726
|
+
end
|
717
727
|
end
|
718
728
|
|
719
729
|
require_relative "package/digest_io"
|
data/lib/rubygems/request.rb
CHANGED
@@ -30,7 +30,7 @@ class Gem::Request
|
|
30
30
|
@uri = uri
|
31
31
|
@request_class = request_class
|
32
32
|
@last_modified = last_modified
|
33
|
-
@requests = Hash.new
|
33
|
+
@requests = Hash.new(0).compare_by_identity
|
34
34
|
@user_agent = user_agent
|
35
35
|
|
36
36
|
@connection_pool = pool
|
@@ -196,7 +196,7 @@ class Gem::Request
|
|
196
196
|
bad_response = false
|
197
197
|
|
198
198
|
begin
|
199
|
-
@requests[connection
|
199
|
+
@requests[connection] += 1
|
200
200
|
|
201
201
|
verbose "#{request.method} #{Gem::Uri.redact(@uri)}"
|
202
202
|
|
@@ -247,7 +247,7 @@ class Gem::Request
|
|
247
247
|
rescue EOFError, Gem::Timeout::Error,
|
248
248
|
Errno::ECONNABORTED, Errno::ECONNRESET, Errno::EPIPE
|
249
249
|
|
250
|
-
requests = @requests[connection
|
250
|
+
requests = @requests[connection]
|
251
251
|
verbose "connection reset after #{requests} requests, retrying"
|
252
252
|
|
253
253
|
raise Gem::RemoteFetcher::FetchError.new("too many connection resets", @uri) if retried
|
@@ -267,7 +267,7 @@ class Gem::Request
|
|
267
267
|
# Resets HTTP connection +connection+.
|
268
268
|
|
269
269
|
def reset(connection)
|
270
|
-
@requests.delete connection
|
270
|
+
@requests.delete connection
|
271
271
|
|
272
272
|
connection.finish
|
273
273
|
connection.start
|
@@ -0,0 +1 @@
|
|
1
|
+
# Vendored files do not need to be documented
|
@@ -0,0 +1 @@
|
|
1
|
+
# Vendored files do not need to be documented
|
@@ -0,0 +1 @@
|
|
1
|
+
# Vendored files do not need to be documented
|
data/lib/rubygems.rb
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
require "rbconfig"
|
10
10
|
|
11
11
|
module Gem
|
12
|
-
VERSION = "3.5.
|
12
|
+
VERSION = "3.5.2"
|
13
13
|
end
|
14
14
|
|
15
15
|
# Must be first since it unloads the prelude from 1.9.2
|
@@ -942,6 +942,13 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
|
|
942
942
|
end].compact.uniq
|
943
943
|
end
|
944
944
|
|
945
|
+
##
|
946
|
+
# Suffixes for dynamic library require-able paths.
|
947
|
+
|
948
|
+
def self.dynamic_library_suffixes
|
949
|
+
@dynamic_library_suffixes ||= suffixes - [".rb"]
|
950
|
+
end
|
951
|
+
|
945
952
|
##
|
946
953
|
# Prints the amount of time the supplied block takes to run using the debug
|
947
954
|
# UI output.
|
data/rubygems-update.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "rubygems-update"
|
5
|
-
s.version = "3.5.
|
5
|
+
s.version = "3.5.2"
|
6
6
|
s.authors = ["Jim Weirich", "Chad Fowler", "Eric Hodel", "Luis Lavena", "Aaron Patterson", "Samuel Giddins", "André Arko", "Evan Phoenix", "Hiroshi SHIBATA"]
|
7
7
|
s.email = ["", "", "drbrain@segment7.net", "luislavena@gmail.com", "aaron@tenderlovemaking.com", "segiddins@segiddins.me", "andre@arko.net", "evan@phx.io", "hsbt@ruby-lang.org"]
|
8
8
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubygems-update
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.
|
4
|
+
version: 3.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Weirich
|
@@ -16,7 +16,7 @@ authors:
|
|
16
16
|
autorequire:
|
17
17
|
bindir: exe
|
18
18
|
cert_chain: []
|
19
|
-
date: 2023-12-
|
19
|
+
date: 2023-12-21 00:00:00.000000000 Z
|
20
20
|
dependencies: []
|
21
21
|
description: |-
|
22
22
|
A package (also known as a library) contains a set of functionality
|
@@ -330,18 +330,22 @@ files:
|
|
330
330
|
- bundler/lib/bundler/uri_credentials_filter.rb
|
331
331
|
- bundler/lib/bundler/uri_normalizer.rb
|
332
332
|
- bundler/lib/bundler/vendor/.document
|
333
|
+
- bundler/lib/bundler/vendor/connection_pool/.document
|
333
334
|
- bundler/lib/bundler/vendor/connection_pool/LICENSE
|
334
335
|
- bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb
|
335
336
|
- bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb
|
336
337
|
- bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb
|
337
338
|
- bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb
|
339
|
+
- bundler/lib/bundler/vendor/fileutils/.document
|
338
340
|
- bundler/lib/bundler/vendor/fileutils/LICENSE.txt
|
339
341
|
- bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb
|
342
|
+
- bundler/lib/bundler/vendor/net-http-persistent/.document
|
340
343
|
- bundler/lib/bundler/vendor/net-http-persistent/README.rdoc
|
341
344
|
- bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb
|
342
345
|
- bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb
|
343
346
|
- bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb
|
344
347
|
- bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb
|
348
|
+
- bundler/lib/bundler/vendor/pub_grub/.document
|
345
349
|
- bundler/lib/bundler/vendor/pub_grub/LICENSE.txt
|
346
350
|
- bundler/lib/bundler/vendor/pub_grub/lib/pub_grub.rb
|
347
351
|
- bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb
|
@@ -359,6 +363,7 @@ files:
|
|
359
363
|
- bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb
|
360
364
|
- bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb
|
361
365
|
- bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb
|
366
|
+
- bundler/lib/bundler/vendor/thor/.document
|
362
367
|
- bundler/lib/bundler/vendor/thor/LICENSE.md
|
363
368
|
- bundler/lib/bundler/vendor/thor/lib/thor.rb
|
364
369
|
- bundler/lib/bundler/vendor/thor/lib/thor/actions.rb
|
@@ -390,14 +395,15 @@ files:
|
|
390
395
|
- bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb
|
391
396
|
- bundler/lib/bundler/vendor/thor/lib/thor/shell/column_printer.rb
|
392
397
|
- bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb
|
393
|
-
- bundler/lib/bundler/vendor/thor/lib/thor/shell/lcs_diff.rb
|
394
398
|
- bundler/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb
|
395
399
|
- bundler/lib/bundler/vendor/thor/lib/thor/shell/terminal.rb
|
396
400
|
- bundler/lib/bundler/vendor/thor/lib/thor/shell/wrapped_printer.rb
|
397
401
|
- bundler/lib/bundler/vendor/thor/lib/thor/util.rb
|
398
402
|
- bundler/lib/bundler/vendor/thor/lib/thor/version.rb
|
403
|
+
- bundler/lib/bundler/vendor/tsort/.document
|
399
404
|
- bundler/lib/bundler/vendor/tsort/LICENSE.txt
|
400
405
|
- bundler/lib/bundler/vendor/tsort/lib/tsort.rb
|
406
|
+
- bundler/lib/bundler/vendor/uri/.document
|
401
407
|
- bundler/lib/bundler/vendor/uri/LICENSE.txt
|
402
408
|
- bundler/lib/bundler/vendor/uri/lib/uri.rb
|
403
409
|
- bundler/lib/bundler/vendor/uri/lib/uri/common.rb
|
@@ -507,6 +513,7 @@ files:
|
|
507
513
|
- lib/rubygems/installer_uninstaller_utils.rb
|
508
514
|
- lib/rubygems/local_remote_options.rb
|
509
515
|
- lib/rubygems/name_tuple.rb
|
516
|
+
- lib/rubygems/net-http/.document
|
510
517
|
- lib/rubygems/net-http/LICENSE.txt
|
511
518
|
- lib/rubygems/net-http/lib/net/http.rb
|
512
519
|
- lib/rubygems/net-http/lib/net/http/backward.rb
|
@@ -520,6 +527,7 @@ files:
|
|
520
527
|
- lib/rubygems/net-http/lib/net/http/responses.rb
|
521
528
|
- lib/rubygems/net-http/lib/net/http/status.rb
|
522
529
|
- lib/rubygems/net-http/lib/net/https.rb
|
530
|
+
- lib/rubygems/net-protocol/.document
|
523
531
|
- lib/rubygems/net-protocol/LICENSE.txt
|
524
532
|
- lib/rubygems/net-protocol/lib/net/protocol.rb
|
525
533
|
- lib/rubygems/net/http.rb
|
@@ -563,6 +571,7 @@ files:
|
|
563
571
|
- lib/rubygems/request_set/lockfile/parser.rb
|
564
572
|
- lib/rubygems/request_set/lockfile/tokenizer.rb
|
565
573
|
- lib/rubygems/requirement.rb
|
574
|
+
- lib/rubygems/resolv/.document
|
566
575
|
- lib/rubygems/resolv/LICENSE.txt
|
567
576
|
- lib/rubygems/resolv/lib/resolv.rb
|
568
577
|
- lib/rubygems/resolver.rb
|
@@ -585,6 +594,7 @@ files:
|
|
585
594
|
- lib/rubygems/resolver/lock_set.rb
|
586
595
|
- lib/rubygems/resolver/lock_specification.rb
|
587
596
|
- lib/rubygems/resolver/molinillo.rb
|
597
|
+
- lib/rubygems/resolver/molinillo/.document
|
588
598
|
- lib/rubygems/resolver/molinillo/LICENSE
|
589
599
|
- lib/rubygems/resolver/molinillo/lib/molinillo.rb
|
590
600
|
- lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb
|
@@ -646,6 +656,7 @@ files:
|
|
646
656
|
- lib/rubygems/stub_specification.rb
|
647
657
|
- lib/rubygems/text.rb
|
648
658
|
- lib/rubygems/timeout.rb
|
659
|
+
- lib/rubygems/timeout/.document
|
649
660
|
- lib/rubygems/timeout/LICENSE.txt
|
650
661
|
- lib/rubygems/timeout/lib/timeout.rb
|
651
662
|
- lib/rubygems/tsort.rb
|
@@ -691,7 +702,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
691
702
|
- !ruby/object:Gem::Version
|
692
703
|
version: '0'
|
693
704
|
requirements: []
|
694
|
-
rubygems_version: 3.5.
|
705
|
+
rubygems_version: 3.5.2
|
695
706
|
signing_key:
|
696
707
|
specification_version: 4
|
697
708
|
summary: RubyGems is a package management framework for Ruby. This gem is downloaded
|
@@ -1,49 +0,0 @@
|
|
1
|
-
module LCSDiff
|
2
|
-
protected
|
3
|
-
|
4
|
-
# Overwrite show_diff to show diff with colors if Diff::LCS is
|
5
|
-
# available.
|
6
|
-
def show_diff(destination, content) #:nodoc:
|
7
|
-
if diff_lcs_loaded? && ENV["THOR_DIFF"].nil? && ENV["RAILS_DIFF"].nil?
|
8
|
-
actual = File.binread(destination).to_s.split("\n")
|
9
|
-
content = content.to_s.split("\n")
|
10
|
-
|
11
|
-
Diff::LCS.sdiff(actual, content).each do |diff|
|
12
|
-
output_diff_line(diff)
|
13
|
-
end
|
14
|
-
else
|
15
|
-
super
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def output_diff_line(diff) #:nodoc:
|
22
|
-
case diff.action
|
23
|
-
when "-"
|
24
|
-
say "- #{diff.old_element.chomp}", :red, true
|
25
|
-
when "+"
|
26
|
-
say "+ #{diff.new_element.chomp}", :green, true
|
27
|
-
when "!"
|
28
|
-
say "- #{diff.old_element.chomp}", :red, true
|
29
|
-
say "+ #{diff.new_element.chomp}", :green, true
|
30
|
-
else
|
31
|
-
say " #{diff.old_element.chomp}", nil, true
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
# Check if Diff::LCS is loaded. If it is, use it to create pretty output
|
36
|
-
# for diff.
|
37
|
-
def diff_lcs_loaded? #:nodoc:
|
38
|
-
return true if defined?(Diff::LCS)
|
39
|
-
return @diff_lcs_loaded unless @diff_lcs_loaded.nil?
|
40
|
-
|
41
|
-
@diff_lcs_loaded = begin
|
42
|
-
require "diff/lcs"
|
43
|
-
true
|
44
|
-
rescue LoadError
|
45
|
-
false
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|