bundler 2.2.3 → 2.3.5
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/CHANGELOG.md +503 -7
- data/README.md +1 -1
- data/bundler.gemspec +2 -3
- data/exe/bundle +7 -8
- data/lib/bundler/.document +1 -0
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/cli/cache.rb +2 -1
- data/lib/bundler/cli/check.rb +4 -2
- data/lib/bundler/cli/common.rb +15 -2
- data/lib/bundler/cli/doctor.rb +15 -4
- data/lib/bundler/cli/exec.rb +1 -6
- data/lib/bundler/cli/gem.rb +132 -24
- data/lib/bundler/cli/info.rb +16 -4
- data/lib/bundler/cli/install.rb +12 -27
- data/lib/bundler/cli/issue.rb +4 -3
- data/lib/bundler/cli/list.rb +7 -1
- data/lib/bundler/cli/lock.rb +5 -1
- data/lib/bundler/cli/open.rb +1 -2
- data/lib/bundler/cli/outdated.rb +10 -11
- data/lib/bundler/cli/remove.rb +1 -2
- data/lib/bundler/cli/update.rb +17 -8
- data/lib/bundler/cli.rb +44 -60
- data/lib/bundler/compact_index_client/cache.rb +0 -9
- data/lib/bundler/compact_index_client/updater.rb +10 -19
- data/lib/bundler/compact_index_client.rb +2 -8
- data/lib/bundler/current_ruby.rb +5 -4
- data/lib/bundler/definition.rb +158 -316
- data/lib/bundler/dep_proxy.rb +15 -8
- data/lib/bundler/dependency.rb +5 -7
- data/lib/bundler/digest.rb +71 -0
- data/lib/bundler/dsl.rb +67 -66
- data/lib/bundler/endpoint_specification.rb +21 -11
- data/lib/bundler/environment_preserver.rb +4 -1
- data/lib/bundler/errors.rb +19 -3
- data/lib/bundler/feature_flag.rb +0 -5
- data/lib/bundler/fetcher/compact_index.rb +10 -15
- data/lib/bundler/fetcher/downloader.rb +9 -6
- data/lib/bundler/fetcher/index.rb +0 -27
- data/lib/bundler/fetcher.rb +10 -17
- data/lib/bundler/friendly_errors.rb +5 -32
- data/lib/bundler/gem_helper.rb +28 -21
- data/lib/bundler/gem_version_promoter.rb +2 -2
- data/lib/bundler/index.rb +8 -12
- data/lib/bundler/injector.rb +12 -3
- data/lib/bundler/inline.rb +2 -1
- data/lib/bundler/installer/gem_installer.rb +4 -22
- data/lib/bundler/installer/parallel_installer.rb +36 -15
- data/lib/bundler/installer/standalone.rb +29 -9
- data/lib/bundler/installer.rb +8 -34
- data/lib/bundler/lazy_specification.rb +32 -20
- data/lib/bundler/lockfile_generator.rb +1 -1
- data/lib/bundler/lockfile_parser.rb +16 -45
- data/{man → lib/bundler/man}/bundle-add.1 +10 -2
- data/lib/bundler/man/bundle-add.1.ronn +7 -1
- data/{man → lib/bundler/man}/bundle-binstubs.1 +1 -1
- data/{man → lib/bundler/man}/bundle-cache.1 +1 -1
- data/{man → lib/bundler/man}/bundle-check.1 +1 -1
- data/{man → lib/bundler/man}/bundle-clean.1 +1 -1
- data/{man → lib/bundler/man}/bundle-config.1 +27 -19
- data/lib/bundler/man/bundle-config.1.ronn +33 -25
- data/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
- data/{man → lib/bundler/man}/bundle-exec.1 +1 -1
- data/{man → lib/bundler/man}/bundle-gem.1 +14 -1
- data/lib/bundler/man/bundle-gem.1.ronn +16 -0
- data/{man → lib/bundler/man}/bundle-info.1 +1 -1
- data/{man → lib/bundler/man}/bundle-init.1 +1 -1
- data/{man → lib/bundler/man}/bundle-inject.1 +1 -1
- data/{man → lib/bundler/man}/bundle-install.1 +2 -2
- data/lib/bundler/man/bundle-install.1.ronn +2 -2
- data/{man → lib/bundler/man}/bundle-list.1 +1 -1
- data/{man → lib/bundler/man}/bundle-lock.1 +1 -1
- data/{man → lib/bundler/man}/bundle-open.1 +1 -1
- data/{man → lib/bundler/man}/bundle-outdated.1 +1 -1
- data/{man → lib/bundler/man}/bundle-platform.1 +1 -1
- data/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
- data/{man → lib/bundler/man}/bundle-remove.1 +1 -1
- data/{man → lib/bundler/man}/bundle-show.1 +1 -1
- data/{man → lib/bundler/man}/bundle-update.1 +5 -5
- data/lib/bundler/man/bundle-update.1.ronn +5 -4
- data/{man → lib/bundler/man}/bundle-viz.1 +1 -1
- data/{man → lib/bundler/man}/bundle.1 +1 -1
- data/{man → lib/bundler/man}/gemfile.5 +28 -2
- data/lib/bundler/man/gemfile.5.ronn +9 -1
- data/{man → lib/bundler/man}/index.txt +0 -0
- data/lib/bundler/plugin/api/source.rb +22 -0
- data/lib/bundler/plugin/index.rb +4 -1
- data/lib/bundler/plugin/installer.rb +10 -10
- data/lib/bundler/plugin/source_list.rb +4 -0
- data/lib/bundler/plugin.rb +28 -8
- data/lib/bundler/process_lock.rb +1 -1
- data/lib/bundler/psyched_yaml.rb +1 -13
- data/lib/bundler/resolver/spec_group.rb +36 -48
- data/lib/bundler/resolver.rb +97 -151
- data/lib/bundler/retry.rb +1 -1
- data/lib/bundler/ruby_version.rb +1 -1
- data/lib/bundler/rubygems_ext.rb +46 -8
- data/lib/bundler/rubygems_gem_installer.rb +68 -1
- data/lib/bundler/rubygems_integration.rb +43 -60
- data/lib/bundler/runtime.rb +18 -11
- data/lib/bundler/self_manager.rb +168 -0
- data/lib/bundler/settings.rb +97 -21
- data/lib/bundler/setup.rb +2 -2
- data/lib/bundler/shared_helpers.rb +6 -21
- data/lib/bundler/source/git/git_proxy.rb +60 -53
- data/lib/bundler/source/git.rb +38 -18
- data/lib/bundler/source/metadata.rb +1 -5
- data/lib/bundler/source/path/installer.rb +3 -1
- data/lib/bundler/source/path.rb +3 -1
- data/lib/bundler/source/rubygems.rb +113 -100
- data/lib/bundler/source/rubygems_aggregate.rb +68 -0
- data/lib/bundler/source.rb +21 -0
- data/lib/bundler/source_list.rb +100 -62
- data/lib/bundler/source_map.rb +58 -0
- data/lib/bundler/spec_set.rb +21 -34
- data/lib/bundler/stub_specification.rb +8 -0
- data/lib/bundler/templates/Executable.bundler +7 -7
- data/lib/bundler/templates/Gemfile +0 -2
- data/lib/bundler/templates/gems.rb +0 -3
- data/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +5 -2
- data/lib/bundler/templates/newgem/README.md.tt +5 -3
- data/lib/bundler/templates/newgem/Rakefile.tt +15 -2
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +15 -6
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +18 -16
- data/lib/bundler/templates/newgem/rubocop.yml.tt +3 -0
- data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
- data/lib/bundler/templates/newgem/standard.yml.tt +2 -0
- data/lib/bundler/templates/newgem/test/minitest/{newgem_test.rb.tt → test_newgem.rb.tt} +1 -1
- data/lib/bundler/ui/shell.rb +1 -1
- 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/delegates/specification_provider.rb +7 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +11 -5
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +2 -3
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +2 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +12 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +11 -7
- data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
- data/lib/bundler/vendor/thor/LICENSE.md +20 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +9 -7
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -2
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +7 -3
- data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
- data/lib/bundler/vendor/thor/lib/thor/error.rb +10 -5
- data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +5 -1
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +28 -9
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +27 -6
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +5 -1
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor.rb +5 -6
- data/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +1 -1
- 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/vendor/uri/lib/uri/common.rb +17 -80
- data/lib/bundler/vendor/uri/lib/uri/ftp.rb +0 -1
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +5 -6
- data/lib/bundler/vendor/uri/lib/uri/http.rb +0 -1
- data/lib/bundler/vendor/uri/lib/uri/https.rb +0 -1
- data/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri/mailto.rb +0 -1
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +1 -14
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +1 -12
- data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri/ws.rb +84 -0
- data/lib/bundler/vendor/uri/lib/uri/wss.rb +22 -0
- data/lib/bundler/vendor/uri/lib/uri.rb +0 -1
- 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 +29 -33
- metadata +54 -35
- data/lib/bundler/gemdeps.rb +0 -29
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
data/lib/bundler/source_list.rb
CHANGED
|
@@ -1,30 +1,53 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "set"
|
|
4
|
-
|
|
5
3
|
module Bundler
|
|
6
4
|
class SourceList
|
|
7
5
|
attr_reader :path_sources,
|
|
8
6
|
:git_sources,
|
|
9
7
|
:plugin_sources,
|
|
10
|
-
:
|
|
8
|
+
:global_path_source,
|
|
11
9
|
:metadata_source
|
|
12
10
|
|
|
11
|
+
def global_rubygems_source
|
|
12
|
+
@global_rubygems_source ||= rubygems_aggregate_class.new("allow_local" => true)
|
|
13
|
+
end
|
|
14
|
+
|
|
13
15
|
def initialize
|
|
14
16
|
@path_sources = []
|
|
15
17
|
@git_sources = []
|
|
16
18
|
@plugin_sources = []
|
|
17
19
|
@global_rubygems_source = nil
|
|
18
|
-
@
|
|
20
|
+
@global_path_source = nil
|
|
19
21
|
@rubygems_sources = []
|
|
20
22
|
@metadata_source = Source::Metadata.new
|
|
23
|
+
|
|
24
|
+
@merged_gem_lockfile_sections = false
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def merged_gem_lockfile_sections?
|
|
28
|
+
@merged_gem_lockfile_sections
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def merged_gem_lockfile_sections!(replacement_source)
|
|
32
|
+
@merged_gem_lockfile_sections = true
|
|
33
|
+
@global_rubygems_source = replacement_source
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def aggregate_global_source?
|
|
37
|
+
global_rubygems_source.multiple_remotes?
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def implicit_global_source?
|
|
41
|
+
global_rubygems_source.no_remotes?
|
|
21
42
|
end
|
|
22
43
|
|
|
23
44
|
def add_path_source(options = {})
|
|
24
45
|
if options["gemspec"]
|
|
25
46
|
add_source_to_list Source::Gemspec.new(options), path_sources
|
|
26
47
|
else
|
|
27
|
-
add_source_to_list Source::Path.new(options), path_sources
|
|
48
|
+
path_source = add_source_to_list Source::Path.new(options), path_sources
|
|
49
|
+
@global_path_source ||= path_source if options["global"]
|
|
50
|
+
path_source
|
|
28
51
|
end
|
|
29
52
|
end
|
|
30
53
|
|
|
@@ -35,32 +58,31 @@ module Bundler
|
|
|
35
58
|
end
|
|
36
59
|
|
|
37
60
|
def add_rubygems_source(options = {})
|
|
38
|
-
|
|
61
|
+
new_source = Source::Rubygems.new(options)
|
|
62
|
+
return @global_rubygems_source if @global_rubygems_source == new_source
|
|
63
|
+
|
|
64
|
+
add_source_to_list new_source, @rubygems_sources
|
|
39
65
|
end
|
|
40
66
|
|
|
41
67
|
def add_plugin_source(source, options = {})
|
|
42
68
|
add_source_to_list Plugin.source(source).new(options), @plugin_sources
|
|
43
69
|
end
|
|
44
70
|
|
|
45
|
-
def
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
end
|
|
49
|
-
add_rubygems_remote(uri)
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def add_rubygems_remote(uri)
|
|
53
|
-
return if Bundler.feature_flag.disable_multisource?
|
|
54
|
-
@rubygems_aggregate.add_remote(uri)
|
|
55
|
-
@rubygems_aggregate
|
|
71
|
+
def add_global_rubygems_remote(uri)
|
|
72
|
+
global_rubygems_source.add_remote(uri)
|
|
73
|
+
global_rubygems_source
|
|
56
74
|
end
|
|
57
75
|
|
|
58
76
|
def default_source
|
|
59
|
-
|
|
77
|
+
global_path_source || global_rubygems_source
|
|
60
78
|
end
|
|
61
79
|
|
|
62
80
|
def rubygems_sources
|
|
63
|
-
|
|
81
|
+
non_global_rubygems_sources + [global_rubygems_source]
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def non_global_rubygems_sources
|
|
85
|
+
@rubygems_sources
|
|
64
86
|
end
|
|
65
87
|
|
|
66
88
|
def rubygems_remotes
|
|
@@ -71,37 +93,51 @@ module Bundler
|
|
|
71
93
|
path_sources + git_sources + plugin_sources + rubygems_sources + [metadata_source]
|
|
72
94
|
end
|
|
73
95
|
|
|
96
|
+
def non_default_explicit_sources
|
|
97
|
+
all_sources - [default_source, metadata_source]
|
|
98
|
+
end
|
|
99
|
+
|
|
74
100
|
def get(source)
|
|
75
|
-
source_list_for(source).find {|s|
|
|
101
|
+
source_list_for(source).find {|s| equivalent_source?(source, s) }
|
|
76
102
|
end
|
|
77
103
|
|
|
78
104
|
def lock_sources
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
105
|
+
lock_other_sources + lock_rubygems_sources
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def lock_other_sources
|
|
109
|
+
(path_sources + git_sources + plugin_sources).sort_by(&:identifier)
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def lock_rubygems_sources
|
|
113
|
+
if merged_gem_lockfile_sections?
|
|
114
|
+
[combine_rubygems_sources]
|
|
82
115
|
else
|
|
83
|
-
|
|
116
|
+
rubygems_sources.sort_by(&:identifier)
|
|
84
117
|
end
|
|
85
118
|
end
|
|
86
119
|
|
|
87
120
|
# Returns true if there are changes
|
|
88
121
|
def replace_sources!(replacement_sources)
|
|
89
|
-
return
|
|
122
|
+
return false if replacement_sources.empty?
|
|
90
123
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
replacement_sources.find {|s| s == source } || source
|
|
94
|
-
end
|
|
95
|
-
end
|
|
124
|
+
@rubygems_sources, @path_sources, @git_sources, @plugin_sources = map_sources(replacement_sources)
|
|
125
|
+
@global_rubygems_source = global_replacement_source(replacement_sources)
|
|
96
126
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
@rubygems_aggregate = replacement_rubygems if replacement_rubygems
|
|
127
|
+
different_sources?(lock_sources, replacement_sources)
|
|
128
|
+
end
|
|
100
129
|
|
|
101
|
-
|
|
102
|
-
|
|
130
|
+
# Returns true if there are changes
|
|
131
|
+
def expired_sources?(replacement_sources)
|
|
132
|
+
return false if replacement_sources.empty?
|
|
103
133
|
|
|
104
|
-
|
|
134
|
+
lock_sources = dup_with_replaced_sources(replacement_sources).lock_sources
|
|
135
|
+
|
|
136
|
+
different_sources?(lock_sources, replacement_sources)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def local_only!
|
|
140
|
+
all_sources.each(&:local_only!)
|
|
105
141
|
end
|
|
106
142
|
|
|
107
143
|
def cached!
|
|
@@ -112,11 +148,33 @@ module Bundler
|
|
|
112
148
|
all_sources.each(&:remote!)
|
|
113
149
|
end
|
|
114
150
|
|
|
115
|
-
|
|
116
|
-
|
|
151
|
+
private
|
|
152
|
+
|
|
153
|
+
def dup_with_replaced_sources(replacement_sources)
|
|
154
|
+
new_source_list = dup
|
|
155
|
+
new_source_list.replace_sources!(replacement_sources)
|
|
156
|
+
new_source_list
|
|
117
157
|
end
|
|
118
158
|
|
|
119
|
-
|
|
159
|
+
def map_sources(replacement_sources)
|
|
160
|
+
[@rubygems_sources, @path_sources, @git_sources, @plugin_sources].map do |sources|
|
|
161
|
+
sources.map do |source|
|
|
162
|
+
replacement_sources.find {|s| s == source } || source
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
end
|
|
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
|
+
|
|
175
|
+
def different_sources?(lock_sources, replacement_sources)
|
|
176
|
+
!equivalent_sources?(lock_sources, replacement_sources)
|
|
177
|
+
end
|
|
120
178
|
|
|
121
179
|
def rubygems_aggregate_class
|
|
122
180
|
Source::Rubygems
|
|
@@ -152,32 +210,12 @@ module Bundler
|
|
|
152
210
|
end
|
|
153
211
|
end
|
|
154
212
|
|
|
155
|
-
def equal_sources?(lock_sources, replacement_sources)
|
|
156
|
-
lock_sources.to_set == replacement_sources.to_set
|
|
157
|
-
end
|
|
158
|
-
|
|
159
|
-
def equal_source?(source, other_source)
|
|
160
|
-
source == other_source
|
|
161
|
-
end
|
|
162
|
-
|
|
163
|
-
def equivalent_source?(source, other_source)
|
|
164
|
-
return false unless Bundler.settings[:allow_deployment_source_credential_changes] && source.is_a?(Source::Rubygems)
|
|
165
|
-
|
|
166
|
-
equivalent_rubygems_sources?([source], [other_source])
|
|
167
|
-
end
|
|
168
|
-
|
|
169
213
|
def equivalent_sources?(lock_sources, replacement_sources)
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
lock_rubygems_sources, lock_other_sources = lock_sources.partition {|s| s.is_a?(Source::Rubygems) }
|
|
173
|
-
replacement_rubygems_sources, replacement_other_sources = replacement_sources.partition {|s| s.is_a?(Source::Rubygems) }
|
|
174
|
-
|
|
175
|
-
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)
|
|
176
215
|
end
|
|
177
216
|
|
|
178
|
-
def
|
|
179
|
-
|
|
180
|
-
lock_sources.all? {|s| s.equivalent_remotes?(actual_remotes) }
|
|
217
|
+
def equivalent_source?(source, other_source)
|
|
218
|
+
source == other_source
|
|
181
219
|
end
|
|
182
220
|
end
|
|
183
221
|
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Bundler
|
|
4
|
+
class SourceMap
|
|
5
|
+
attr_reader :sources, :dependencies
|
|
6
|
+
|
|
7
|
+
def initialize(sources, dependencies)
|
|
8
|
+
@sources = sources
|
|
9
|
+
@dependencies = dependencies
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def pinned_spec_names(skip = nil)
|
|
13
|
+
direct_requirements.reject {|_, source| source == skip }.keys
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def all_requirements
|
|
17
|
+
requirements = direct_requirements.dup
|
|
18
|
+
|
|
19
|
+
unmet_deps = sources.non_default_explicit_sources.map do |source|
|
|
20
|
+
(source.spec_names - pinned_spec_names).each do |indirect_dependency_name|
|
|
21
|
+
previous_source = requirements[indirect_dependency_name]
|
|
22
|
+
if previous_source.nil?
|
|
23
|
+
requirements[indirect_dependency_name] = source
|
|
24
|
+
else
|
|
25
|
+
no_ambiguous_sources = Bundler.feature_flag.bundler_3_mode?
|
|
26
|
+
|
|
27
|
+
msg = ["The gem '#{indirect_dependency_name}' was found in multiple relevant sources."]
|
|
28
|
+
msg.concat [previous_source, source].map {|s| " * #{s}" }.sort
|
|
29
|
+
msg << "You #{no_ambiguous_sources ? :must : :should} add this gem to the source block for the source you wish it to be installed from."
|
|
30
|
+
msg = msg.join("\n")
|
|
31
|
+
|
|
32
|
+
raise SecurityError, msg if no_ambiguous_sources
|
|
33
|
+
Bundler.ui.warn "Warning: #{msg}"
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
source.unmet_deps
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
sources.default_source.add_dependency_names(unmet_deps.flatten - requirements.keys)
|
|
41
|
+
|
|
42
|
+
requirements
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def direct_requirements
|
|
46
|
+
@direct_requirements ||= begin
|
|
47
|
+
requirements = {}
|
|
48
|
+
default = sources.default_source
|
|
49
|
+
dependencies.each do |dep|
|
|
50
|
+
dep_source = dep.source || default
|
|
51
|
+
dep_source.add_dependency_names(dep.name)
|
|
52
|
+
requirements[dep.name] = dep_source
|
|
53
|
+
end
|
|
54
|
+
requirements
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
data/lib/bundler/spec_set.rb
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
require "set"
|
|
3
|
+
require_relative "vendored_tsort"
|
|
5
4
|
|
|
6
5
|
module Bundler
|
|
7
6
|
class SpecSet
|
|
@@ -12,32 +11,28 @@ module Bundler
|
|
|
12
11
|
@specs = specs
|
|
13
12
|
end
|
|
14
13
|
|
|
15
|
-
def for(dependencies,
|
|
16
|
-
handled =
|
|
14
|
+
def for(dependencies, check = false, match_current_platform = false)
|
|
15
|
+
handled = []
|
|
17
16
|
deps = dependencies.dup
|
|
18
17
|
specs = []
|
|
19
|
-
skip += ["bundler"]
|
|
20
18
|
|
|
21
19
|
loop do
|
|
22
20
|
break unless dep = deps.shift
|
|
23
|
-
next if
|
|
21
|
+
next if handled.any?{|d| d.name == dep.name && (match_current_platform || d.__platform == dep.__platform) } || dep.name == "bundler"
|
|
22
|
+
|
|
23
|
+
handled << dep
|
|
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
|
|
31
|
-
d = DepProxy.
|
|
31
|
+
d = DepProxy.get_proxy(d, dep.__platform) unless match_current_platform
|
|
32
32
|
deps << d
|
|
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
|
|
|
@@ -45,11 +40,7 @@ module Bundler
|
|
|
45
40
|
specs << spec
|
|
46
41
|
end
|
|
47
42
|
|
|
48
|
-
check ? true :
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
def valid_for?(deps)
|
|
52
|
-
self.for(deps, [], true)
|
|
43
|
+
check ? true : specs
|
|
53
44
|
end
|
|
54
45
|
|
|
55
46
|
def [](key)
|
|
@@ -75,32 +66,24 @@ module Bundler
|
|
|
75
66
|
lookup.dup
|
|
76
67
|
end
|
|
77
68
|
|
|
78
|
-
def materialize(deps
|
|
79
|
-
materialized = self.for(deps,
|
|
80
|
-
|
|
69
|
+
def materialize(deps)
|
|
70
|
+
materialized = self.for(deps, false, true)
|
|
71
|
+
|
|
81
72
|
materialized.map! do |s|
|
|
82
73
|
next s unless s.is_a?(LazySpecification)
|
|
83
|
-
s.source.
|
|
84
|
-
|
|
85
|
-
unless spec
|
|
86
|
-
unless missing_specs
|
|
87
|
-
raise GemNotFound, "Could not find #{s.full_name} in any of the sources"
|
|
88
|
-
end
|
|
89
|
-
missing_specs << s
|
|
90
|
-
end
|
|
91
|
-
spec
|
|
74
|
+
s.source.local!
|
|
75
|
+
s.__materialize__ || s
|
|
92
76
|
end
|
|
93
|
-
SpecSet.new(
|
|
77
|
+
SpecSet.new(materialized)
|
|
94
78
|
end
|
|
95
79
|
|
|
96
80
|
# Materialize for all the specs in the spec set, regardless of what platform they're for
|
|
97
81
|
# This is in contrast to how for does platform filtering (and specifically different from how `materialize` calls `for` only for the current platform)
|
|
98
82
|
# @return [Array<Gem::Specification>]
|
|
99
83
|
def materialized_for_all_platforms
|
|
100
|
-
names = @specs.map(&:name).uniq
|
|
101
84
|
@specs.map do |s|
|
|
102
85
|
next s unless s.is_a?(LazySpecification)
|
|
103
|
-
s.source.
|
|
86
|
+
s.source.local!
|
|
104
87
|
s.source.remote!
|
|
105
88
|
spec = s.__materialize__
|
|
106
89
|
raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec
|
|
@@ -108,6 +91,10 @@ module Bundler
|
|
|
108
91
|
end
|
|
109
92
|
end
|
|
110
93
|
|
|
94
|
+
def missing_specs
|
|
95
|
+
@specs.select {|s| s.is_a?(LazySpecification) }
|
|
96
|
+
end
|
|
97
|
+
|
|
111
98
|
def merge(set)
|
|
112
99
|
arr = sorted.dup
|
|
113
100
|
set.each do |set_spec|
|
|
@@ -185,7 +172,7 @@ module Bundler
|
|
|
185
172
|
def spec_for_dependency(dep, match_current_platform)
|
|
186
173
|
specs_for_platforms = lookup[dep.name]
|
|
187
174
|
if match_current_platform
|
|
188
|
-
GemHelpers.select_best_platform_match(specs_for_platforms, Bundler.local_platform)
|
|
175
|
+
GemHelpers.select_best_platform_match(specs_for_platforms.select{|s| Gem::Platform.match_spec?(s) }, Bundler.local_platform)
|
|
189
176
|
else
|
|
190
177
|
GemHelpers.select_best_platform_match(specs_for_platforms, dep.__platform)
|
|
191
178
|
end
|
|
@@ -26,11 +26,19 @@ module Bundler
|
|
|
26
26
|
|
|
27
27
|
# @!group Stub Delegates
|
|
28
28
|
|
|
29
|
+
def manually_installed?
|
|
30
|
+
# This is for manually installed gems which are gems that were fixed in place after a
|
|
31
|
+
# failed installation. Once the issue was resolved, the user then manually created
|
|
32
|
+
# the gem specification using the instructions provided by `gem help install`
|
|
33
|
+
installed_by_version == Gem::Version.new(0)
|
|
34
|
+
end
|
|
35
|
+
|
|
29
36
|
# This is defined directly to avoid having to loading the full spec
|
|
30
37
|
def missing_extensions?
|
|
31
38
|
return false if default_gem?
|
|
32
39
|
return false if extensions.empty?
|
|
33
40
|
return false if File.exist? gem_build_complete_path
|
|
41
|
+
return false if manually_installed?
|
|
34
42
|
|
|
35
43
|
true
|
|
36
44
|
end
|
|
@@ -60,20 +60,20 @@ 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
|
|
|
76
|
-
return requirement unless Gem
|
|
76
|
+
return requirement unless Gem.rubygems_version < Gem::Version.new("2.7.0")
|
|
77
77
|
|
|
78
78
|
requirement += ".a" if bundler_gem_version.prerelease?
|
|
79
79
|
|
|
@@ -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", "~>
|
|
19
|
+
gem "rubocop", "~> <%= config[:linter_version] %>"
|
|
20
|
+
<%- elsif config[:linter] == "standard" -%>
|
|
21
|
+
|
|
22
|
+
gem "standard", "~> <%= config[:linter_version] %>"
|
|
20
23
|
<%- end -%>
|
|
@@ -29,19 +29,21 @@ TODO: Write usage instructions here
|
|
|
29
29
|
After checking out the repo, run `bin/setup` to install dependencies.<% if config[:test] %> Then, run `rake <%= config[:test].sub('mini', '').sub('rspec', 'spec') %>` to run the tests.<% end %> You can also run `bin/console` for an interactive prompt that will allow you to experiment.<% if config[:bin] %> Run `bundle exec <%= config[:name] %>` to use the gem in this directory, ignoring other installed copies of this gem.<% end %>
|
|
30
30
|
|
|
31
31
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
32
|
+
<% if config[:git] -%>
|
|
32
33
|
|
|
33
34
|
## Contributing
|
|
34
35
|
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/<%= config[:github_username] %>/<%= config[:name] %>.<% if config[:coc] %> This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob
|
|
36
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/<%= config[:github_username] %>/<%= config[:name] %>.<% if config[:coc] %> This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob/<%= config[:git_default_branch] %>/CODE_OF_CONDUCT.md).<% end %>
|
|
37
|
+
<% end -%>
|
|
36
38
|
<% if config[:mit] -%>
|
|
37
39
|
|
|
38
40
|
## License
|
|
39
41
|
|
|
40
42
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
41
43
|
<% end -%>
|
|
42
|
-
<% if config[:coc] -%>
|
|
44
|
+
<% if config[:git] && config[:coc] -%>
|
|
43
45
|
|
|
44
46
|
## Code of Conduct
|
|
45
47
|
|
|
46
|
-
Everyone interacting in the <%= config[:constant_name] %> project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob
|
|
48
|
+
Everyone interacting in the <%= config[:constant_name] %> project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob/<%= config[:git_default_branch] %>/CODE_OF_CONDUCT.md).
|
|
47
49
|
<% end -%>
|
|
@@ -3,7 +3,16 @@
|
|
|
3
3
|
require "bundler/gem_tasks"
|
|
4
4
|
<% default_task_names = [config[:test_task]].compact -%>
|
|
5
5
|
<% case config[:test] -%>
|
|
6
|
-
<% when "minitest"
|
|
6
|
+
<% when "minitest" -%>
|
|
7
|
+
require "rake/testtask"
|
|
8
|
+
|
|
9
|
+
Rake::TestTask.new(:test) do |t|
|
|
10
|
+
t.libs << "test"
|
|
11
|
+
t.libs << "lib"
|
|
12
|
+
t.test_files = FileList["test/**/test_*.rb"]
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
<% when "test-unit" -%>
|
|
7
16
|
require "rake/testtask"
|
|
8
17
|
|
|
9
18
|
Rake::TestTask.new(:test) do |t|
|
|
@@ -18,12 +27,16 @@ require "rspec/core/rake_task"
|
|
|
18
27
|
RSpec::Core::RakeTask.new(:spec)
|
|
19
28
|
|
|
20
29
|
<% end -%>
|
|
21
|
-
<% if config[:
|
|
30
|
+
<% if config[:linter] == "rubocop" -%>
|
|
22
31
|
<% default_task_names << :rubocop -%>
|
|
23
32
|
require "rubocop/rake_task"
|
|
24
33
|
|
|
25
34
|
RuboCop::RakeTask.new
|
|
26
35
|
|
|
36
|
+
<% elsif config[:linter] == "standard" -%>
|
|
37
|
+
<% default_task_names << :standard -%>
|
|
38
|
+
require "standard/rake"
|
|
39
|
+
|
|
27
40
|
<% end -%>
|
|
28
41
|
<% if config[:ext] -%>
|
|
29
42
|
<% default_task_names.unshift(:clobber, :compile) -%>
|
|
@@ -1,18 +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 }}
|
|
25
|
+
bundler-cache: true
|
|
14
26
|
- name: Run the default task
|
|
15
|
-
run:
|
|
16
|
-
gem install bundler -v <%= Bundler::VERSION %>
|
|
17
|
-
bundle install
|
|
18
|
-
bundle exec rake
|
|
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
|
-
spec.required_ruby_version =
|
|
17
|
+
spec.required_ruby_version = ">= <%= config[:required_ruby_version] %>"
|
|
18
18
|
|
|
19
|
-
spec.metadata["allowed_push_host"] = "TODO: Set to '
|
|
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,18 +25,20 @@ 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(?:(?:bin|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
|
|
38
40
|
# spec.add_dependency "example-gem", "~> 1.0"
|
|
39
41
|
|
|
40
|
-
# For more information and examples about making a new gem,
|
|
42
|
+
# For more information and examples about making a new gem, check out our
|
|
41
43
|
# guide at: https://bundler.io/guides/creating_gem.html
|
|
42
44
|
end
|