bundler 2.2.24 → 2.2.33
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +149 -1
- data/README.md +1 -1
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/cli/cache.rb +1 -1
- data/lib/bundler/cli/doctor.rb +4 -3
- data/lib/bundler/cli/exec.rb +1 -6
- data/lib/bundler/cli/gem.rb +90 -10
- data/lib/bundler/cli/info.rb +16 -4
- data/lib/bundler/cli/install.rb +4 -17
- data/lib/bundler/cli/issue.rb +4 -3
- data/lib/bundler/cli/list.rb +7 -1
- data/lib/bundler/cli/open.rb +1 -2
- data/lib/bundler/cli/remove.rb +1 -2
- data/lib/bundler/cli/update.rb +3 -3
- data/lib/bundler/cli.rb +16 -10
- data/lib/bundler/compact_index_client/updater.rb +0 -5
- data/lib/bundler/compact_index_client.rb +2 -2
- data/lib/bundler/definition.rb +84 -150
- data/lib/bundler/digest.rb +71 -0
- data/lib/bundler/dsl.rb +32 -4
- data/lib/bundler/environment_preserver.rb +4 -1
- data/lib/bundler/errors.rb +19 -3
- data/lib/bundler/fetcher.rb +2 -1
- data/lib/bundler/friendly_errors.rb +5 -30
- data/lib/bundler/gem_helper.rb +6 -17
- data/lib/bundler/installer/gem_installer.rb +3 -16
- data/lib/bundler/installer/standalone.rb +13 -8
- data/lib/bundler/installer.rb +0 -1
- data/lib/bundler/lazy_specification.rb +17 -1
- data/lib/bundler/lockfile_parser.rb +2 -0
- data/lib/bundler/man/bundle-add.1 +1 -1
- data/lib/bundler/man/bundle-binstubs.1 +1 -1
- data/lib/bundler/man/bundle-cache.1 +1 -1
- data/lib/bundler/man/bundle-check.1 +1 -1
- data/lib/bundler/man/bundle-clean.1 +1 -1
- data/lib/bundler/man/bundle-config.1 +3 -3
- data/lib/bundler/man/bundle-config.1.ronn +2 -2
- data/lib/bundler/man/bundle-doctor.1 +1 -1
- data/lib/bundler/man/bundle-exec.1 +1 -1
- data/lib/bundler/man/bundle-gem.1 +14 -1
- data/lib/bundler/man/bundle-gem.1.ronn +16 -0
- data/lib/bundler/man/bundle-info.1 +1 -1
- data/lib/bundler/man/bundle-init.1 +1 -1
- data/lib/bundler/man/bundle-inject.1 +1 -1
- data/lib/bundler/man/bundle-install.1 +1 -1
- data/lib/bundler/man/bundle-list.1 +1 -1
- data/lib/bundler/man/bundle-lock.1 +1 -1
- data/lib/bundler/man/bundle-open.1 +1 -1
- data/lib/bundler/man/bundle-outdated.1 +1 -1
- data/lib/bundler/man/bundle-platform.1 +1 -1
- data/lib/bundler/man/bundle-pristine.1 +1 -1
- data/lib/bundler/man/bundle-remove.1 +1 -1
- data/lib/bundler/man/bundle-show.1 +1 -1
- data/lib/bundler/man/bundle-update.1 +1 -1
- data/lib/bundler/man/bundle-viz.1 +1 -1
- data/lib/bundler/man/bundle.1 +1 -1
- data/lib/bundler/man/gemfile.5 +27 -1
- data/lib/bundler/man/gemfile.5.ronn +8 -0
- data/lib/bundler/plugin/api/source.rb +1 -0
- data/lib/bundler/plugin/installer.rb +2 -0
- data/lib/bundler/plugin.rb +23 -6
- data/lib/bundler/resolver.rb +8 -17
- data/lib/bundler/rubygems_ext.rb +4 -0
- data/lib/bundler/rubygems_gem_installer.rb +25 -5
- data/lib/bundler/rubygems_integration.rb +28 -9
- data/lib/bundler/runtime.rb +17 -8
- data/lib/bundler/settings.rb +13 -1
- data/lib/bundler/setup.rb +2 -2
- data/lib/bundler/shared_helpers.rb +2 -10
- data/lib/bundler/source/git/git_proxy.rb +8 -6
- data/lib/bundler/source/git.rb +22 -4
- data/lib/bundler/source/rubygems.rb +70 -81
- data/lib/bundler/source/rubygems_aggregate.rb +4 -0
- data/lib/bundler/source.rb +4 -0
- data/lib/bundler/source_list.rb +22 -31
- data/lib/bundler/spec_set.rb +14 -36
- data/lib/bundler/templates/Executable.bundler +6 -6
- data/lib/bundler/templates/newgem/Gemfile.tt +5 -2
- data/lib/bundler/templates/newgem/Rakefile.tt +5 -1
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +13 -2
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +16 -14
- data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
- data/lib/bundler/templates/newgem/standard.yml.tt +2 -0
- data/lib/bundler/vendor/.document +1 -0
- data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +19 -21
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +57 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +39 -74
- data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
- data/lib/bundler/vendor/molinillo/LICENSE +9 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +2 -2
- data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
- data/lib/bundler/vendor/thor/LICENSE.md +20 -0
- data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
- data/lib/bundler/vendor/tsort/lib/tsort.rb +453 -0
- data/lib/bundler/vendor/uri/LICENSE.txt +22 -0
- data/lib/bundler/vendored_tsort.rb +4 -0
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler/worker.rb +19 -4
- data/lib/bundler.rb +13 -22
- metadata +20 -7
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
@@ -29,6 +29,7 @@ module Bundler
|
|
29
29
|
def local_only!
|
30
30
|
@specs = nil
|
31
31
|
@allow_local = true
|
32
|
+
@allow_cached = false
|
32
33
|
@allow_remote = false
|
33
34
|
end
|
34
35
|
|
@@ -50,6 +51,7 @@ module Bundler
|
|
50
51
|
return if @allow_cached
|
51
52
|
|
52
53
|
@specs = nil
|
54
|
+
@allow_local = true
|
53
55
|
@allow_cached = true
|
54
56
|
end
|
55
57
|
|
@@ -71,6 +73,10 @@ module Bundler
|
|
71
73
|
@remotes.size > 1
|
72
74
|
end
|
73
75
|
|
76
|
+
def no_remotes?
|
77
|
+
@remotes.size == 0
|
78
|
+
end
|
79
|
+
|
74
80
|
def can_lock?(spec)
|
75
81
|
return super unless multiple_remotes?
|
76
82
|
include?(spec.source)
|
@@ -95,12 +101,27 @@ module Bundler
|
|
95
101
|
def to_s
|
96
102
|
if remotes.empty?
|
97
103
|
"locally installed gems"
|
98
|
-
|
99
|
-
|
104
|
+
elsif @allow_remote && @allow_cached && @allow_local
|
105
|
+
"rubygems repository #{remote_names}, cached gems or installed locally"
|
106
|
+
elsif @allow_remote && @allow_local
|
100
107
|
"rubygems repository #{remote_names} or installed locally"
|
108
|
+
elsif @allow_remote
|
109
|
+
"rubygems repository #{remote_names}"
|
110
|
+
elsif @allow_cached && @allow_local
|
111
|
+
"cached gems or installed locally"
|
112
|
+
else
|
113
|
+
"locally installed gems"
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def identifier
|
118
|
+
if remotes.empty?
|
119
|
+
"locally installed gems"
|
120
|
+
else
|
121
|
+
"rubygems repository #{remote_names}"
|
101
122
|
end
|
102
123
|
end
|
103
|
-
alias_method :name, :
|
124
|
+
alias_method :name, :identifier
|
104
125
|
|
105
126
|
def specs
|
106
127
|
@specs ||= begin
|
@@ -118,7 +139,7 @@ module Bundler
|
|
118
139
|
force = opts[:force]
|
119
140
|
ensure_builtin_gems_cached = opts[:ensure_builtin_gems_cached]
|
120
141
|
|
121
|
-
if ensure_builtin_gems_cached &&
|
142
|
+
if ensure_builtin_gems_cached && spec.default_gem?
|
122
143
|
if !cached_path(spec)
|
123
144
|
cached_built_in_gem(spec) unless spec.remote
|
124
145
|
force = true
|
@@ -127,7 +148,7 @@ module Bundler
|
|
127
148
|
end
|
128
149
|
end
|
129
150
|
|
130
|
-
if
|
151
|
+
if installed?(spec) && !force
|
131
152
|
print_using_message "Using #{version_message(spec)}"
|
132
153
|
return nil # no post-install message
|
133
154
|
end
|
@@ -145,7 +166,7 @@ module Bundler
|
|
145
166
|
begin
|
146
167
|
s = Bundler.rubygems.spec_from_gem(path, Bundler.settings["trust-policy"])
|
147
168
|
spec.__swap__(s)
|
148
|
-
rescue
|
169
|
+
rescue Gem::Package::FormatError
|
149
170
|
Bundler.rm_rf(path)
|
150
171
|
raise
|
151
172
|
end
|
@@ -157,6 +178,7 @@ module Bundler
|
|
157
178
|
Bundler.ui.confirm message
|
158
179
|
|
159
180
|
path = cached_gem(spec)
|
181
|
+
raise GemNotFound, "Could not find #{spec.file_name} for installation" unless path
|
160
182
|
if requires_sudo?
|
161
183
|
install_path = Bundler.tmp(spec.full_name)
|
162
184
|
bin_path = install_path.join("bin")
|
@@ -216,12 +238,8 @@ module Bundler
|
|
216
238
|
end
|
217
239
|
|
218
240
|
def cache(spec, custom_path = nil)
|
219
|
-
|
220
|
-
|
221
|
-
else
|
222
|
-
cached_path = cached_gem(spec)
|
223
|
-
end
|
224
|
-
raise GemNotFound, "Missing gem file '#{spec.full_name}.gem'." unless cached_path
|
241
|
+
cached_path = cached_gem(spec)
|
242
|
+
raise GemNotFound, "Missing gem file '#{spec.file_name}'." unless cached_path
|
225
243
|
return if File.dirname(cached_path) == Bundler.app_cache.to_s
|
226
244
|
Bundler.ui.info " * #{File.basename(cached_path)}"
|
227
245
|
FileUtils.cp(cached_path, Bundler.app_cache(custom_path))
|
@@ -248,10 +266,6 @@ module Bundler
|
|
248
266
|
@remotes.unshift(uri) unless @remotes.include?(uri)
|
249
267
|
end
|
250
268
|
|
251
|
-
def equivalent_remotes?(other_remotes)
|
252
|
-
other_remotes.map(&method(:remove_auth)) == @remotes.map(&method(:remove_auth))
|
253
|
-
end
|
254
|
-
|
255
269
|
def spec_names
|
256
270
|
if @allow_remote && dependency_api_available?
|
257
271
|
remote_specs.spec_names
|
@@ -315,8 +329,16 @@ module Bundler
|
|
315
329
|
|
316
330
|
protected
|
317
331
|
|
332
|
+
def remote_names
|
333
|
+
remotes.map(&:to_s).join(", ")
|
334
|
+
end
|
335
|
+
|
318
336
|
def credless_remotes
|
319
|
-
|
337
|
+
if Bundler.settings[:allow_deployment_source_credential_changes]
|
338
|
+
remotes.map(&method(:remove_auth))
|
339
|
+
else
|
340
|
+
remotes.map(&method(:suppress_configured_credentials))
|
341
|
+
end
|
320
342
|
end
|
321
343
|
|
322
344
|
def remotes_for_spec(spec)
|
@@ -331,14 +353,17 @@ module Bundler
|
|
331
353
|
end
|
332
354
|
|
333
355
|
def cached_gem(spec)
|
334
|
-
|
335
|
-
|
336
|
-
|
356
|
+
if spec.default_gem?
|
357
|
+
cached_built_in_gem(spec)
|
358
|
+
else
|
359
|
+
cached_path(spec)
|
337
360
|
end
|
338
|
-
cached_gem
|
339
361
|
end
|
340
362
|
|
341
363
|
def cached_path(spec)
|
364
|
+
global_cache_path = download_cache_path(spec)
|
365
|
+
@caches << global_cache_path if global_cache_path
|
366
|
+
|
342
367
|
possibilities = @caches.map {|p| "#{p}/#{spec.file_name}" }
|
343
368
|
possibilities.find {|p| File.exist?(p) }
|
344
369
|
end
|
@@ -438,19 +463,26 @@ module Bundler
|
|
438
463
|
|
439
464
|
spec.fetch_platform
|
440
465
|
|
441
|
-
|
442
|
-
gem_path = "#{
|
466
|
+
cache_path = download_cache_path(spec) || default_cache_path_for(rubygems_dir)
|
467
|
+
gem_path = "#{cache_path}/#{spec.file_name}"
|
468
|
+
|
469
|
+
if requires_sudo?
|
470
|
+
download_path = Bundler.tmp(spec.full_name)
|
471
|
+
download_cache_path = default_cache_path_for(download_path)
|
472
|
+
else
|
473
|
+
download_cache_path = cache_path
|
474
|
+
end
|
443
475
|
|
444
|
-
SharedHelpers.filesystem_access(
|
476
|
+
SharedHelpers.filesystem_access(download_cache_path) do |p|
|
445
477
|
FileUtils.mkdir_p(p)
|
446
478
|
end
|
447
|
-
download_gem(spec,
|
479
|
+
download_gem(spec, download_cache_path)
|
448
480
|
|
449
481
|
if requires_sudo?
|
450
|
-
SharedHelpers.filesystem_access(
|
482
|
+
SharedHelpers.filesystem_access(cache_path) do |p|
|
451
483
|
Bundler.mkdir_p(p)
|
452
484
|
end
|
453
|
-
Bundler.sudo "mv #{
|
485
|
+
Bundler.sudo "mv #{download_cache_path}/#{spec.file_name} #{gem_path}"
|
454
486
|
end
|
455
487
|
|
456
488
|
gem_path
|
@@ -458,16 +490,8 @@ module Bundler
|
|
458
490
|
Bundler.rm_rf(download_path) if requires_sudo?
|
459
491
|
end
|
460
492
|
|
461
|
-
def builtin_gem?(spec)
|
462
|
-
# Ruby 2.1, where all included gems have this summary
|
463
|
-
return true if spec.summary =~ /is bundled with Ruby/
|
464
|
-
|
465
|
-
# Ruby 2.0, where gemspecs are stored in specifications/default/
|
466
|
-
spec.loaded_from && spec.loaded_from.include?("specifications/default/")
|
467
|
-
end
|
468
|
-
|
469
493
|
def installed?(spec)
|
470
|
-
installed_specs[spec].any?
|
494
|
+
installed_specs[spec].any? && !spec.deleted_gem?
|
471
495
|
end
|
472
496
|
|
473
497
|
def requires_sudo?
|
@@ -478,6 +502,10 @@ module Bundler
|
|
478
502
|
Bundler.rubygems.gem_dir
|
479
503
|
end
|
480
504
|
|
505
|
+
def default_cache_path_for(dir)
|
506
|
+
"#{dir}/cache"
|
507
|
+
end
|
508
|
+
|
481
509
|
def cache_path
|
482
510
|
Bundler.app_cache
|
483
511
|
end
|
@@ -490,52 +518,13 @@ module Bundler
|
|
490
518
|
# @param [Specification] spec
|
491
519
|
# the spec we want to download or retrieve from the cache.
|
492
520
|
#
|
493
|
-
# @param [String]
|
521
|
+
# @param [String] download_cache_path
|
494
522
|
# the local directory the .gem will end up in.
|
495
523
|
#
|
496
|
-
def download_gem(spec,
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
SharedHelpers.filesystem_access(local_path) do
|
501
|
-
FileUtils.cp(cache_path, local_path)
|
502
|
-
end
|
503
|
-
else
|
504
|
-
uri = spec.remote.uri
|
505
|
-
Bundler.ui.confirm("Fetching #{version_message(spec)}")
|
506
|
-
rubygems_local_path = Bundler.rubygems.download_gem(spec, uri, download_path)
|
507
|
-
|
508
|
-
# older rubygems return varying file:// variants depending on version
|
509
|
-
rubygems_local_path = rubygems_local_path.gsub(/\Afile:/, "") unless Bundler.rubygems.provides?(">= 3.2.0.rc.2")
|
510
|
-
rubygems_local_path = rubygems_local_path.gsub(%r{\A//}, "") if Bundler.rubygems.provides?("< 3.1.0")
|
511
|
-
|
512
|
-
if rubygems_local_path != local_path
|
513
|
-
SharedHelpers.filesystem_access(local_path) do
|
514
|
-
FileUtils.mv(rubygems_local_path, local_path)
|
515
|
-
end
|
516
|
-
end
|
517
|
-
cache_globally(spec, local_path)
|
518
|
-
end
|
519
|
-
end
|
520
|
-
|
521
|
-
# Checks if the requested spec exists in the global cache. If it does
|
522
|
-
# not, we create the relevant global cache subdirectory if it does not
|
523
|
-
# exist and copy the spec from the local cache to the global cache.
|
524
|
-
#
|
525
|
-
# @param [Specification] spec
|
526
|
-
# the spec we want to copy to the global cache.
|
527
|
-
#
|
528
|
-
# @param [String] local_cache_path
|
529
|
-
# the local directory from which we want to copy the .gem.
|
530
|
-
#
|
531
|
-
def cache_globally(spec, local_cache_path)
|
532
|
-
return unless cache_path = download_cache_path(spec)
|
533
|
-
return if cache_path.exist?
|
534
|
-
|
535
|
-
SharedHelpers.filesystem_access(cache_path.dirname, &:mkpath)
|
536
|
-
SharedHelpers.filesystem_access(cache_path) do
|
537
|
-
FileUtils.cp(local_cache_path, cache_path)
|
538
|
-
end
|
524
|
+
def download_gem(spec, download_cache_path)
|
525
|
+
uri = spec.remote.uri
|
526
|
+
Bundler.ui.confirm("Fetching #{version_message(spec)}")
|
527
|
+
Bundler.rubygems.download_gem(spec, uri, download_cache_path)
|
539
528
|
end
|
540
529
|
|
541
530
|
# Returns the global cache path of the calling Rubygems::Source object.
|
@@ -554,7 +543,7 @@ module Bundler
|
|
554
543
|
return unless remote = spec.remote
|
555
544
|
return unless cache_slug = remote.cache_slug
|
556
545
|
|
557
|
-
Bundler.user_cache.join("gems", cache_slug
|
546
|
+
Bundler.user_cache.join("gems", cache_slug)
|
558
547
|
end
|
559
548
|
|
560
549
|
def extension_cache_slug(spec)
|
data/lib/bundler/source.rb
CHANGED
data/lib/bundler/source_list.rb
CHANGED
@@ -37,6 +37,10 @@ module Bundler
|
|
37
37
|
global_rubygems_source.multiple_remotes?
|
38
38
|
end
|
39
39
|
|
40
|
+
def implicit_global_source?
|
41
|
+
global_rubygems_source.no_remotes?
|
42
|
+
end
|
43
|
+
|
40
44
|
def add_path_source(options = {})
|
41
45
|
if options["gemspec"]
|
42
46
|
add_source_to_list Source::Gemspec.new(options), path_sources
|
@@ -94,7 +98,7 @@ module Bundler
|
|
94
98
|
end
|
95
99
|
|
96
100
|
def get(source)
|
97
|
-
source_list_for(source).find {|s|
|
101
|
+
source_list_for(source).find {|s| equivalent_source?(source, s) }
|
98
102
|
end
|
99
103
|
|
100
104
|
def lock_sources
|
@@ -102,14 +106,14 @@ module Bundler
|
|
102
106
|
end
|
103
107
|
|
104
108
|
def lock_other_sources
|
105
|
-
(path_sources + git_sources + plugin_sources).sort_by(&:
|
109
|
+
(path_sources + git_sources + plugin_sources).sort_by(&:identifier)
|
106
110
|
end
|
107
111
|
|
108
112
|
def lock_rubygems_sources
|
109
113
|
if merged_gem_lockfile_sections?
|
110
114
|
[combine_rubygems_sources]
|
111
115
|
else
|
112
|
-
rubygems_sources.sort_by(&:
|
116
|
+
rubygems_sources.sort_by(&:identifier)
|
113
117
|
end
|
114
118
|
end
|
115
119
|
|
@@ -117,7 +121,8 @@ module Bundler
|
|
117
121
|
def replace_sources!(replacement_sources)
|
118
122
|
return false if replacement_sources.empty?
|
119
123
|
|
120
|
-
@path_sources, @git_sources, @plugin_sources = map_sources(replacement_sources)
|
124
|
+
@rubygems_sources, @path_sources, @git_sources, @plugin_sources = map_sources(replacement_sources)
|
125
|
+
@global_rubygems_source = global_replacement_source(replacement_sources)
|
121
126
|
|
122
127
|
different_sources?(lock_sources, replacement_sources)
|
123
128
|
end
|
@@ -152,15 +157,23 @@ module Bundler
|
|
152
157
|
end
|
153
158
|
|
154
159
|
def map_sources(replacement_sources)
|
155
|
-
[path_sources, git_sources, plugin_sources].map do |sources|
|
160
|
+
[@rubygems_sources, @path_sources, @git_sources, @plugin_sources].map do |sources|
|
156
161
|
sources.map do |source|
|
157
162
|
replacement_sources.find {|s| s == source } || source
|
158
163
|
end
|
159
164
|
end
|
160
165
|
end
|
161
166
|
|
167
|
+
def global_replacement_source(replacement_sources)
|
168
|
+
replacement_source = replacement_sources.find {|s| s == global_rubygems_source }
|
169
|
+
return global_rubygems_source unless replacement_source
|
170
|
+
|
171
|
+
replacement_source.local!
|
172
|
+
replacement_source
|
173
|
+
end
|
174
|
+
|
162
175
|
def different_sources?(lock_sources, replacement_sources)
|
163
|
-
!
|
176
|
+
!equivalent_sources?(lock_sources, replacement_sources)
|
164
177
|
end
|
165
178
|
|
166
179
|
def rubygems_aggregate_class
|
@@ -197,34 +210,12 @@ module Bundler
|
|
197
210
|
end
|
198
211
|
end
|
199
212
|
|
200
|
-
def equal_sources?(lock_sources, replacement_sources)
|
201
|
-
lock_sources.sort_by(&:to_s) == replacement_sources.sort_by(&:to_s)
|
202
|
-
end
|
203
|
-
|
204
|
-
def equal_source?(source, other_source)
|
205
|
-
return source.include?(other_source) if source.is_a?(Source::Rubygems) && other_source.is_a?(Source::Rubygems) && !merged_gem_lockfile_sections?
|
206
|
-
|
207
|
-
source == other_source
|
208
|
-
end
|
209
|
-
|
210
|
-
def equivalent_source?(source, other_source)
|
211
|
-
return false unless Bundler.settings[:allow_deployment_source_credential_changes] && source.is_a?(Source::Rubygems)
|
212
|
-
|
213
|
-
equivalent_rubygems_sources?([source], [other_source])
|
214
|
-
end
|
215
|
-
|
216
213
|
def equivalent_sources?(lock_sources, replacement_sources)
|
217
|
-
|
218
|
-
|
219
|
-
lock_rubygems_sources, lock_other_sources = lock_sources.partition {|s| s.is_a?(Source::Rubygems) }
|
220
|
-
replacement_rubygems_sources, replacement_other_sources = replacement_sources.partition {|s| s.is_a?(Source::Rubygems) }
|
221
|
-
|
222
|
-
equivalent_rubygems_sources?(lock_rubygems_sources, replacement_rubygems_sources) && equal_sources?(lock_other_sources, replacement_other_sources)
|
214
|
+
lock_sources.sort_by(&:identifier) == replacement_sources.sort_by(&:identifier)
|
223
215
|
end
|
224
216
|
|
225
|
-
def
|
226
|
-
|
227
|
-
lock_sources.all? {|s| s.equivalent_remotes?(actual_remotes) }
|
217
|
+
def equivalent_source?(source, other_source)
|
218
|
+
source == other_source
|
228
219
|
end
|
229
220
|
end
|
230
221
|
end
|
data/lib/bundler/spec_set.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "vendored_tsort"
|
4
4
|
|
5
5
|
module Bundler
|
6
6
|
class SpecSet
|
@@ -11,7 +11,7 @@ module Bundler
|
|
11
11
|
@specs = specs
|
12
12
|
end
|
13
13
|
|
14
|
-
def for(dependencies, check = false, match_current_platform = false
|
14
|
+
def for(dependencies, check = false, match_current_platform = false)
|
15
15
|
handled = []
|
16
16
|
deps = dependencies.dup
|
17
17
|
specs = []
|
@@ -24,7 +24,7 @@ module Bundler
|
|
24
24
|
|
25
25
|
specs_for_dep = spec_for_dependency(dep, match_current_platform)
|
26
26
|
if specs_for_dep.any?
|
27
|
-
specs += specs_for_dep
|
27
|
+
match_current_platform ? specs += specs_for_dep : specs |= specs_for_dep
|
28
28
|
|
29
29
|
specs_for_dep.first.dependencies.each do |d|
|
30
30
|
next if d.type == :development
|
@@ -33,11 +33,6 @@ module Bundler
|
|
33
33
|
end
|
34
34
|
elsif check
|
35
35
|
return false
|
36
|
-
elsif raise_on_missing
|
37
|
-
others = lookup[dep.name] if match_current_platform
|
38
|
-
message = "Unable to find a spec satisfying #{dep} in the set. Perhaps the lockfile is corrupted?"
|
39
|
-
message += " Found #{others.join(", ")} that did not match the current platform." if others && !others.empty?
|
40
|
-
raise GemNotFound, message
|
41
36
|
end
|
42
37
|
end
|
43
38
|
|
@@ -71,52 +66,35 @@ module Bundler
|
|
71
66
|
lookup.dup
|
72
67
|
end
|
73
68
|
|
74
|
-
def materialize(deps
|
75
|
-
materialized = self.for(deps, false, true
|
76
|
-
|
77
|
-
materialized.group_by(&:source).each do |source, specs|
|
78
|
-
next unless specs.any?{|s| s.is_a?(LazySpecification) }
|
79
|
-
|
80
|
-
source.local!
|
81
|
-
names = -> { specs.map(&:name).uniq }
|
82
|
-
source.double_check_for(names)
|
83
|
-
end
|
69
|
+
def materialize(deps)
|
70
|
+
materialized = self.for(deps, false, true)
|
84
71
|
|
85
72
|
materialized.map! do |s|
|
86
73
|
next s unless s.is_a?(LazySpecification)
|
87
|
-
|
88
|
-
|
89
|
-
unless missing_specs
|
90
|
-
raise GemNotFound, "Could not find #{s.full_name} in any of the sources"
|
91
|
-
end
|
92
|
-
missing_specs << s
|
93
|
-
end
|
94
|
-
spec
|
74
|
+
s.source.local!
|
75
|
+
s.__materialize__ || s
|
95
76
|
end
|
96
|
-
SpecSet.new(
|
77
|
+
SpecSet.new(materialized)
|
97
78
|
end
|
98
79
|
|
99
80
|
# Materialize for all the specs in the spec set, regardless of what platform they're for
|
100
81
|
# This is in contrast to how for does platform filtering (and specifically different from how `materialize` calls `for` only for the current platform)
|
101
82
|
# @return [Array<Gem::Specification>]
|
102
83
|
def materialized_for_all_platforms
|
103
|
-
@specs.group_by(&:source).each do |source, specs|
|
104
|
-
next unless specs.any?{|s| s.is_a?(LazySpecification) }
|
105
|
-
|
106
|
-
source.local!
|
107
|
-
source.remote!
|
108
|
-
names = -> { specs.map(&:name).uniq }
|
109
|
-
source.double_check_for(names)
|
110
|
-
end
|
111
|
-
|
112
84
|
@specs.map do |s|
|
113
85
|
next s unless s.is_a?(LazySpecification)
|
86
|
+
s.source.local!
|
87
|
+
s.source.remote!
|
114
88
|
spec = s.__materialize__
|
115
89
|
raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec
|
116
90
|
spec
|
117
91
|
end
|
118
92
|
end
|
119
93
|
|
94
|
+
def missing_specs
|
95
|
+
@specs.select {|s| s.is_a?(LazySpecification) }
|
96
|
+
end
|
97
|
+
|
120
98
|
def merge(set)
|
121
99
|
arr = sorted.dup
|
122
100
|
set.each do |set_spec|
|
@@ -60,16 +60,16 @@ m = Module.new do
|
|
60
60
|
Regexp.last_match(1)
|
61
61
|
end
|
62
62
|
|
63
|
-
def
|
64
|
-
@
|
63
|
+
def bundler_requirement
|
64
|
+
@bundler_requirement ||=
|
65
65
|
env_var_version || cli_arg_version ||
|
66
|
-
lockfile_version
|
66
|
+
bundler_requirement_for(lockfile_version)
|
67
67
|
end
|
68
68
|
|
69
|
-
def
|
70
|
-
return "#{Gem::Requirement.default}.a" unless
|
69
|
+
def bundler_requirement_for(version)
|
70
|
+
return "#{Gem::Requirement.default}.a" unless version
|
71
71
|
|
72
|
-
bundler_gem_version = Gem::Version.new(
|
72
|
+
bundler_gem_version = Gem::Version.new(version)
|
73
73
|
|
74
74
|
requirement = bundler_gem_version.approximate_recommendation
|
75
75
|
|
@@ -14,7 +14,10 @@ gem "rake-compiler"
|
|
14
14
|
|
15
15
|
gem "<%= config[:test] %>", "~> <%= config[:test_framework_version] %>"
|
16
16
|
<%- end -%>
|
17
|
-
<%- if config[:
|
17
|
+
<%- if config[:linter] == "rubocop" -%>
|
18
18
|
|
19
|
-
gem "rubocop", "~> <%= config[:
|
19
|
+
gem "rubocop", "~> <%= config[:linter_version] %>"
|
20
|
+
<%- elsif config[:linter] == "standard" -%>
|
21
|
+
|
22
|
+
gem "standard", "~> <%= config[:linter_version] %>"
|
20
23
|
<%- end -%>
|
@@ -18,12 +18,16 @@ require "rspec/core/rake_task"
|
|
18
18
|
RSpec::Core::RakeTask.new(:spec)
|
19
19
|
|
20
20
|
<% end -%>
|
21
|
-
<% if config[:
|
21
|
+
<% if config[:linter] == "rubocop" -%>
|
22
22
|
<% default_task_names << :rubocop -%>
|
23
23
|
require "rubocop/rake_task"
|
24
24
|
|
25
25
|
RuboCop::RakeTask.new
|
26
26
|
|
27
|
+
<% elsif config[:linter] == "standard" -%>
|
28
|
+
<% default_task_names << :standard -%>
|
29
|
+
require "standard/rake"
|
30
|
+
|
27
31
|
<% end -%>
|
28
32
|
<% if config[:ext] -%>
|
29
33
|
<% default_task_names.unshift(:clobber, :compile) -%>
|
@@ -1,16 +1,27 @@
|
|
1
1
|
name: Ruby
|
2
2
|
|
3
|
-
on:
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- <%= config[:git_default_branch] %>
|
7
|
+
|
8
|
+
pull_request:
|
4
9
|
|
5
10
|
jobs:
|
6
11
|
build:
|
7
12
|
runs-on: ubuntu-latest
|
13
|
+
name: Ruby ${{ matrix.ruby }}
|
14
|
+
strategy:
|
15
|
+
matrix:
|
16
|
+
ruby:
|
17
|
+
- '<%= RUBY_VERSION %>'
|
18
|
+
|
8
19
|
steps:
|
9
20
|
- uses: actions/checkout@v2
|
10
21
|
- name: Set up Ruby
|
11
22
|
uses: ruby/setup-ruby@v1
|
12
23
|
with:
|
13
|
-
ruby-version:
|
24
|
+
ruby-version: ${{ matrix.ruby }}
|
14
25
|
bundler-cache: true
|
15
26
|
- name: Run the default task
|
16
27
|
run: bundle exec rake
|
@@ -3,20 +3,20 @@
|
|
3
3
|
require_relative "lib/<%=config[:namespaced_path]%>/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name
|
7
|
-
spec.version
|
8
|
-
spec.authors
|
9
|
-
spec.email
|
10
|
-
|
11
|
-
spec.summary
|
12
|
-
spec.description
|
13
|
-
spec.homepage
|
6
|
+
spec.name = <%= config[:name].inspect %>
|
7
|
+
spec.version = <%= config[:constant_name] %>::VERSION
|
8
|
+
spec.authors = [<%= config[:author].inspect %>]
|
9
|
+
spec.email = [<%= config[:email].inspect %>]
|
10
|
+
|
11
|
+
spec.summary = "TODO: Write a short summary, because RubyGems requires one."
|
12
|
+
spec.description = "TODO: Write a longer description or delete this line."
|
13
|
+
spec.homepage = "TODO: Put your gem's website or public repo URL here."
|
14
14
|
<%- if config[:mit] -%>
|
15
|
-
spec.license
|
15
|
+
spec.license = "MIT"
|
16
16
|
<%- end -%>
|
17
17
|
spec.required_ruby_version = ">= <%= config[:required_ruby_version] %>"
|
18
18
|
|
19
|
-
spec.metadata["allowed_push_host"] = "TODO: Set to 'https://
|
19
|
+
spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
|
20
20
|
|
21
21
|
spec.metadata["homepage_uri"] = spec.homepage
|
22
22
|
spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
|
@@ -25,13 +25,15 @@ Gem::Specification.new do |spec|
|
|
25
25
|
# Specify which files should be added to the gem when it is released.
|
26
26
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
27
27
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
28
|
-
`git ls-files -z`.split("\x0").reject
|
28
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
29
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
30
|
+
end
|
29
31
|
end
|
30
|
-
spec.bindir
|
31
|
-
spec.executables
|
32
|
+
spec.bindir = "exe"
|
33
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
32
34
|
spec.require_paths = ["lib"]
|
33
35
|
<%- if config[:ext] -%>
|
34
|
-
spec.extensions
|
36
|
+
spec.extensions = ["ext/<%= config[:underscored_name] %>/extconf.rb"]
|
35
37
|
<%- end -%>
|
36
38
|
|
37
39
|
# Uncomment to register a new dependency of your gem
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%- config[:constant_array].each_with_index do |c, i| -%>
|
2
|
+
<%= " " * i %>module <%= c %>
|
3
|
+
<%- end -%>
|
4
|
+
<%= " " * config[:constant_array].size %>VERSION: String
|
5
|
+
<%= " " * config[:constant_array].size %># See the writing guide of rbs: https://github.com/ruby/rbs#guides
|
6
|
+
<%- (config[:constant_array].size-1).downto(0) do |i| -%>
|
7
|
+
<%= " " * i %>end
|
8
|
+
<%- end -%>
|
@@ -0,0 +1 @@
|
|
1
|
+
# Vendored files do not need to be documented
|