bundler 2.3.12 → 2.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +367 -1
- data/README.md +2 -2
- data/bundler.gemspec +8 -10
- data/exe/bundle +1 -4
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/cli/add.rb +1 -1
- data/lib/bundler/cli/binstubs.rb +5 -1
- data/lib/bundler/cli/check.rb +1 -1
- data/lib/bundler/cli/common.rb +3 -1
- data/lib/bundler/cli/console.rb +2 -2
- data/lib/bundler/cli/doctor.rb +4 -6
- data/lib/bundler/cli/gem.rb +62 -40
- data/lib/bundler/cli/init.rb +5 -1
- data/lib/bundler/cli/install.rb +7 -5
- data/lib/bundler/cli/lock.rb +8 -5
- data/lib/bundler/cli/open.rb +6 -4
- data/lib/bundler/cli/outdated.rb +13 -6
- data/lib/bundler/cli/platform.rb +1 -1
- data/lib/bundler/cli/viz.rb +1 -1
- data/lib/bundler/cli.rb +52 -7
- data/lib/bundler/compact_index_client/cache.rb +1 -1
- data/lib/bundler/compact_index_client/updater.rb +53 -39
- data/lib/bundler/constants.rb +1 -1
- data/lib/bundler/current_ruby.rb +15 -6
- data/lib/bundler/definition.rb +203 -110
- data/lib/bundler/dependency.rb +21 -84
- data/lib/bundler/digest.rb +1 -1
- data/lib/bundler/dsl.rb +13 -18
- data/lib/bundler/endpoint_specification.rb +6 -10
- data/lib/bundler/env.rb +1 -1
- data/lib/bundler/environment_preserver.rb +1 -0
- data/lib/bundler/errors.rb +15 -15
- data/lib/bundler/feature_flag.rb +0 -1
- data/lib/bundler/fetcher/base.rb +6 -8
- data/lib/bundler/fetcher/compact_index.rb +9 -11
- data/lib/bundler/fetcher/dependency.rb +1 -1
- data/lib/bundler/fetcher/downloader.rb +2 -5
- data/lib/bundler/fetcher.rb +12 -12
- data/lib/bundler/force_platform.rb +18 -0
- data/lib/bundler/friendly_errors.rb +21 -7
- data/lib/bundler/gem_helpers.rb +9 -2
- data/lib/bundler/gem_version_promoter.rb +53 -98
- data/lib/bundler/graph.rb +3 -3
- data/lib/bundler/index.rb +11 -49
- data/lib/bundler/injector.rb +8 -3
- data/lib/bundler/inline.rb +9 -21
- data/lib/bundler/installer/gem_installer.rb +14 -1
- data/lib/bundler/installer/parallel_installer.rb +0 -31
- data/lib/bundler/installer/standalone.rb +41 -10
- data/lib/bundler/installer.rb +18 -39
- data/lib/bundler/lazy_specification.rb +53 -48
- data/lib/bundler/lockfile_generator.rb +1 -1
- data/lib/bundler/lockfile_parser.rb +9 -5
- data/lib/bundler/man/bundle-add.1 +13 -5
- data/lib/bundler/man/bundle-add.1.ronn +10 -4
- data/lib/bundler/man/bundle-binstubs.1 +1 -1
- data/lib/bundler/man/bundle-cache.1 +7 -1
- data/lib/bundler/man/bundle-cache.1.ronn +7 -0
- data/lib/bundler/man/bundle-check.1 +1 -1
- data/lib/bundler/man/bundle-clean.1 +2 -2
- data/lib/bundler/man/bundle-clean.1.ronn +1 -1
- data/lib/bundler/man/bundle-config.1 +26 -7
- data/lib/bundler/man/bundle-config.1.ronn +17 -7
- data/lib/bundler/man/bundle-console.1 +53 -0
- data/lib/bundler/man/bundle-console.1.ronn +44 -0
- data/lib/bundler/man/bundle-doctor.1 +1 -1
- data/lib/bundler/man/bundle-exec.1 +6 -6
- data/lib/bundler/man/bundle-exec.1.ronn +6 -6
- data/lib/bundler/man/bundle-gem.1 +27 -37
- data/lib/bundler/man/bundle-gem.1.ronn +5 -5
- data/lib/bundler/man/bundle-help.1 +13 -0
- data/lib/bundler/man/bundle-help.1.ronn +12 -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 +5 -2
- data/lib/bundler/man/bundle-inject.1.ronn +3 -1
- data/lib/bundler/man/bundle-install.1 +5 -30
- data/lib/bundler/man/bundle-install.1.ronn +6 -29
- 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 +22 -2
- data/lib/bundler/man/bundle-open.1.ronn +9 -1
- data/lib/bundler/man/bundle-outdated.1 +1 -1
- data/lib/bundler/man/bundle-platform.1 +16 -6
- data/lib/bundler/man/bundle-platform.1.ronn +14 -7
- data/lib/bundler/man/bundle-plugin.1 +81 -0
- data/lib/bundler/man/bundle-plugin.1.ronn +59 -0
- 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-version.1 +35 -0
- data/lib/bundler/man/bundle-version.1.ronn +24 -0
- data/lib/bundler/man/bundle-viz.1 +4 -1
- data/lib/bundler/man/bundle-viz.1.ronn +2 -0
- data/lib/bundler/man/bundle.1 +15 -10
- data/lib/bundler/man/bundle.1.ronn +12 -7
- data/lib/bundler/man/gemfile.5 +92 -81
- data/lib/bundler/man/gemfile.5.ronn +98 -85
- data/lib/bundler/man/index.txt +4 -0
- data/lib/bundler/match_metadata.rb +13 -0
- data/lib/bundler/match_platform.rb +0 -1
- data/lib/bundler/match_remote_metadata.rb +29 -0
- data/lib/bundler/mirror.rb +5 -7
- data/lib/bundler/plugin/api/source.rb +3 -3
- data/lib/bundler/plugin/index.rb +4 -4
- data/lib/bundler/plugin/installer/git.rb +0 -4
- data/lib/bundler/plugin/installer/rubygems.rb +0 -8
- data/lib/bundler/plugin.rb +2 -0
- data/lib/bundler/process_lock.rb +1 -1
- data/lib/bundler/remote_specification.rb +8 -9
- data/lib/bundler/resolver/base.rb +77 -0
- data/lib/bundler/resolver/candidate.rb +94 -0
- data/lib/bundler/resolver/incompatibility.rb +15 -0
- data/lib/bundler/resolver/package.rb +72 -0
- data/lib/bundler/resolver/root.rb +25 -0
- data/lib/bundler/resolver/spec_group.rb +42 -70
- data/lib/bundler/resolver.rb +322 -326
- data/lib/bundler/ruby_dsl.rb +1 -1
- data/lib/bundler/ruby_version.rb +5 -5
- data/lib/bundler/rubygems_ext.rb +102 -12
- data/lib/bundler/rubygems_gem_installer.rb +32 -20
- data/lib/bundler/rubygems_integration.rb +12 -34
- data/lib/bundler/runtime.rb +1 -6
- data/lib/bundler/settings.rb +2 -8
- data/lib/bundler/shared_helpers.rb +7 -7
- data/lib/bundler/source/git/git_proxy.rb +193 -67
- data/lib/bundler/source/git.rb +21 -25
- data/lib/bundler/source/metadata.rb +1 -2
- data/lib/bundler/source/path/installer.rb +1 -22
- data/lib/bundler/source/path.rb +6 -6
- data/lib/bundler/source/rubygems.rb +75 -117
- data/lib/bundler/source.rb +3 -4
- data/lib/bundler/source_list.rb +12 -2
- data/lib/bundler/spec_set.rb +52 -34
- data/lib/bundler/stub_specification.rb +5 -3
- data/lib/bundler/templates/Executable +1 -1
- data/lib/bundler/templates/Executable.bundler +4 -9
- data/lib/bundler/templates/Executable.standalone +2 -0
- data/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +3 -0
- data/lib/bundler/templates/newgem/README.md.tt +6 -4
- data/lib/bundler/templates/newgem/Rakefile.tt +2 -1
- data/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -0
- data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +15 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
- data/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +12 -0
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +10 -0
- data/lib/bundler/templates/newgem/gitignore.tt +3 -0
- data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +13 -4
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +8 -2
- data/lib/bundler/ui/shell.rb +35 -12
- data/lib/bundler/ui/silent.rb +21 -5
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +3 -3
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +0 -1
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +3 -1
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1350 -408
- data/lib/bundler/vendor/net-http-persistent/README.rdoc +1 -1
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +1 -1
- data/lib/bundler/vendor/pub_grub/LICENSE.txt +21 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +189 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +151 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +53 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +128 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +409 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +240 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb +178 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub.rb +31 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri/common.rb +64 -16
- data/lib/bundler/vendor/uri/lib/uri/file.rb +7 -1
- data/lib/bundler/vendor/uri/lib/uri/ftp.rb +2 -1
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +27 -7
- data/lib/bundler/vendor/uri/lib/uri/http.rb +40 -2
- data/lib/bundler/vendor/uri/lib/uri/https.rb +2 -1
- data/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri/ldaps.rb +2 -1
- data/lib/bundler/vendor/uri/lib/uri/mailto.rb +2 -2
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +13 -7
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +10 -5
- data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri/ws.rb +1 -2
- data/lib/bundler/vendor/uri/lib/uri/wss.rb +2 -1
- data/lib/bundler/vendor/uri/lib/uri.rb +3 -2
- data/lib/bundler/vendored_persistent.rb +1 -33
- data/lib/bundler/{vendored_tmpdir.rb → vendored_pub_grub.rb} +1 -1
- data/lib/bundler/version.rb +5 -1
- data/lib/bundler/worker.rb +5 -7
- data/lib/bundler.rb +35 -69
- metadata +45 -34
- data/lib/bundler/dep_proxy.rb +0 -55
- data/lib/bundler/templates/newgem/travis.yml.tt +0 -6
- data/lib/bundler/vendor/molinillo/LICENSE +0 -9
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +0 -88
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +0 -36
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +0 -66
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +0 -62
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +0 -63
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +0 -61
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +0 -126
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +0 -46
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +0 -36
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +0 -164
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -255
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +0 -149
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +0 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +0 -112
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +0 -67
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +0 -839
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +0 -46
- data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +0 -58
- data/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -11
- data/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +0 -154
- data/lib/bundler/vendored_molinillo.rb +0 -4
- data/lib/bundler/version_ranges.rb +0 -122
- /data/lib/bundler/templates/newgem/ext/newgem/{extconf.rb.tt → extconf-c.rb.tt} +0 -0
@@ -135,110 +135,78 @@ module Bundler
|
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
138
|
-
def install(spec,
|
139
|
-
force =
|
140
|
-
ensure_builtin_gems_cached =
|
141
|
-
|
142
|
-
if ensure_builtin_gems_cached && spec.default_gem?
|
143
|
-
|
144
|
-
|
145
|
-
force = true
|
146
|
-
else
|
147
|
-
spec.loaded_from = loaded_from(spec)
|
148
|
-
end
|
138
|
+
def install(spec, options = {})
|
139
|
+
force = options[:force]
|
140
|
+
ensure_builtin_gems_cached = options[:ensure_builtin_gems_cached]
|
141
|
+
|
142
|
+
if ensure_builtin_gems_cached && spec.default_gem? && !cached_path(spec)
|
143
|
+
cached_built_in_gem(spec) unless spec.remote
|
144
|
+
force = true
|
149
145
|
end
|
150
146
|
|
151
147
|
if installed?(spec) && !force
|
152
|
-
print_using_message "Using #{version_message(spec)}"
|
148
|
+
print_using_message "Using #{version_message(spec, options[:previous_spec])}"
|
153
149
|
return nil # no post-install message
|
154
150
|
end
|
155
151
|
|
156
|
-
# Download the gem to get the spec, because some specs that are returned
|
157
|
-
# by rubygems.org are broken and wrong.
|
158
152
|
if spec.remote
|
159
153
|
# Check for this spec from other sources
|
160
|
-
uris = [spec.remote.anonymized_uri
|
161
|
-
uris += remotes_for_spec(spec).map(&:anonymized_uri)
|
162
|
-
uris.uniq!
|
154
|
+
uris = [spec.remote, *remotes_for_spec(spec)].map(&:anonymized_uri).uniq
|
163
155
|
Installer.ambiguous_gems << [spec.name, *uris] if uris.length > 1
|
156
|
+
end
|
157
|
+
|
158
|
+
path = fetch_gem_if_possible(spec, options[:previous_spec])
|
159
|
+
raise GemNotFound, "Could not find #{spec.file_name} for installation" unless path
|
160
|
+
|
161
|
+
return if Bundler.settings[:no_install]
|
162
|
+
|
163
|
+
install_path = rubygems_dir
|
164
|
+
bin_path = Bundler.system_bindir
|
165
|
+
|
166
|
+
require_relative "../rubygems_gem_installer"
|
167
|
+
|
168
|
+
installer = Bundler::RubyGemsGemInstaller.at(
|
169
|
+
path,
|
170
|
+
:security_policy => Bundler.rubygems.security_policies[Bundler.settings["trust-policy"]],
|
171
|
+
:install_dir => install_path.to_s,
|
172
|
+
:bin_dir => bin_path.to_s,
|
173
|
+
:ignore_dependencies => true,
|
174
|
+
:wrappers => true,
|
175
|
+
:env_shebang => true,
|
176
|
+
:build_args => options[:build_args],
|
177
|
+
:bundler_expected_checksum => spec.respond_to?(:checksum) && spec.checksum,
|
178
|
+
:bundler_extension_cache_path => extension_cache_path(spec)
|
179
|
+
)
|
164
180
|
|
165
|
-
|
166
|
-
begin
|
167
|
-
|
168
|
-
spec.__swap__(s)
|
181
|
+
if spec.remote
|
182
|
+
s = begin
|
183
|
+
installer.spec
|
169
184
|
rescue Gem::Package::FormatError
|
170
185
|
Bundler.rm_rf(path)
|
171
186
|
raise
|
187
|
+
rescue Gem::Security::Exception => e
|
188
|
+
raise SecurityError,
|
189
|
+
"The gem #{File.basename(path, ".gem")} can't be installed because " \
|
190
|
+
"the security policy didn't allow it, with the message: #{e.message}"
|
172
191
|
end
|
192
|
+
|
193
|
+
spec.__swap__(s)
|
173
194
|
end
|
174
195
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
Bundler.ui.confirm message
|
196
|
+
message = "Installing #{version_message(spec, options[:previous_spec])}"
|
197
|
+
message += " with native extensions" if spec.extensions.any?
|
198
|
+
Bundler.ui.confirm message
|
179
199
|
|
180
|
-
|
181
|
-
raise GemNotFound, "Could not find #{spec.file_name} for installation" unless path
|
182
|
-
if requires_sudo?
|
183
|
-
install_path = Bundler.tmp(spec.full_name)
|
184
|
-
bin_path = install_path.join("bin")
|
185
|
-
else
|
186
|
-
install_path = rubygems_dir
|
187
|
-
bin_path = Bundler.system_bindir
|
188
|
-
end
|
200
|
+
installed_spec = installer.install
|
189
201
|
|
190
|
-
|
191
|
-
|
192
|
-
require_relative "../rubygems_gem_installer"
|
193
|
-
|
194
|
-
installed_spec = Bundler::RubyGemsGemInstaller.at(
|
195
|
-
path,
|
196
|
-
:install_dir => install_path.to_s,
|
197
|
-
:bin_dir => bin_path.to_s,
|
198
|
-
:ignore_dependencies => true,
|
199
|
-
:wrappers => true,
|
200
|
-
:env_shebang => true,
|
201
|
-
:build_args => opts[:build_args],
|
202
|
-
:bundler_expected_checksum => spec.respond_to?(:checksum) && spec.checksum,
|
203
|
-
:bundler_extension_cache_path => extension_cache_path(spec)
|
204
|
-
).install
|
205
|
-
spec.full_gem_path = installed_spec.full_gem_path
|
206
|
-
|
207
|
-
# SUDO HAX
|
208
|
-
if requires_sudo?
|
209
|
-
Bundler.rubygems.repository_subdirectories.each do |name|
|
210
|
-
src = File.join(install_path, name, "*")
|
211
|
-
dst = File.join(rubygems_dir, name)
|
212
|
-
if name == "extensions" && Dir.glob(src).any?
|
213
|
-
src = File.join(src, "*/*")
|
214
|
-
ext_src = Dir.glob(src).first
|
215
|
-
ext_src.gsub!(src[0..-6], "")
|
216
|
-
dst = File.dirname(File.join(dst, ext_src))
|
217
|
-
end
|
218
|
-
SharedHelpers.filesystem_access(dst) do |p|
|
219
|
-
Bundler.mkdir_p(p)
|
220
|
-
end
|
221
|
-
Bundler.sudo "cp -R #{src} #{dst}" if Dir[src].any?
|
222
|
-
end
|
223
|
-
|
224
|
-
spec.executables.each do |exe|
|
225
|
-
SharedHelpers.filesystem_access(Bundler.system_bindir) do |p|
|
226
|
-
Bundler.mkdir_p(p)
|
227
|
-
end
|
228
|
-
Bundler.sudo "cp -R #{install_path}/bin/#{exe} #{Bundler.system_bindir}/"
|
229
|
-
end
|
230
|
-
end
|
231
|
-
installed_spec.loaded_from = loaded_from(spec)
|
232
|
-
end
|
233
|
-
spec.loaded_from = loaded_from(spec)
|
202
|
+
spec.full_gem_path = installed_spec.full_gem_path
|
203
|
+
spec.loaded_from = installed_spec.loaded_from
|
234
204
|
|
235
205
|
spec.post_install_message
|
236
|
-
ensure
|
237
|
-
Bundler.rm_rf(install_path) if requires_sudo?
|
238
206
|
end
|
239
207
|
|
240
208
|
def cache(spec, custom_path = nil)
|
241
|
-
cached_path = cached_gem(spec)
|
209
|
+
cached_path = Bundler.settings[:cache_all_platforms] ? fetch_gem_if_possible(spec) : cached_gem(spec)
|
242
210
|
raise GemNotFound, "Missing gem file '#{spec.file_name}'." unless cached_path
|
243
211
|
return if File.dirname(cached_path) == Bundler.app_cache.to_s
|
244
212
|
Bundler.ui.info " * #{File.basename(cached_path)}"
|
@@ -324,7 +292,7 @@ module Bundler
|
|
324
292
|
end
|
325
293
|
|
326
294
|
def dependency_api_available?
|
327
|
-
api_fetchers.any?
|
295
|
+
@allow_remote && api_fetchers.any?
|
328
296
|
end
|
329
297
|
|
330
298
|
protected
|
@@ -348,10 +316,6 @@ module Bundler
|
|
348
316
|
end
|
349
317
|
end
|
350
318
|
|
351
|
-
def loaded_from(spec)
|
352
|
-
"#{rubygems_dir}/specifications/#{spec.full_name}.gemspec"
|
353
|
-
end
|
354
|
-
|
355
319
|
def cached_gem(spec)
|
356
320
|
if spec.default_gem?
|
357
321
|
cached_built_in_gem(spec)
|
@@ -364,13 +328,17 @@ module Bundler
|
|
364
328
|
global_cache_path = download_cache_path(spec)
|
365
329
|
@caches << global_cache_path if global_cache_path
|
366
330
|
|
367
|
-
possibilities = @caches.map {|p|
|
331
|
+
possibilities = @caches.map {|p| package_path(p, spec) }
|
368
332
|
possibilities.find {|p| File.exist?(p) }
|
369
333
|
end
|
370
334
|
|
335
|
+
def package_path(cache_path, spec)
|
336
|
+
"#{cache_path}/#{spec.file_name}"
|
337
|
+
end
|
338
|
+
|
371
339
|
def normalize_uri(uri)
|
372
340
|
uri = uri.to_s
|
373
|
-
uri = "#{uri}/" unless
|
341
|
+
uri = "#{uri}/" unless %r{/$}.match?(uri)
|
374
342
|
require_relative "../vendored_uri"
|
375
343
|
uri = Bundler::URI(uri)
|
376
344
|
raise ArgumentError, "The source must be an absolute URI. For example:\n" \
|
@@ -413,7 +381,7 @@ module Bundler
|
|
413
381
|
idx = @allow_local ? installed_specs.dup : Index.new
|
414
382
|
|
415
383
|
Dir["#{cache_path}/*.gem"].each do |gemfile|
|
416
|
-
next if
|
384
|
+
next if /^bundler\-[\d\.]+?\.gem/.match?(gemfile)
|
417
385
|
s ||= Bundler.rubygems.spec_from_gem(gemfile)
|
418
386
|
s.source = self
|
419
387
|
idx << s
|
@@ -458,48 +426,35 @@ module Bundler
|
|
458
426
|
end
|
459
427
|
end
|
460
428
|
|
461
|
-
def
|
462
|
-
|
429
|
+
def fetch_gem_if_possible(spec, previous_spec = nil)
|
430
|
+
if spec.remote
|
431
|
+
fetch_gem(spec, previous_spec)
|
432
|
+
else
|
433
|
+
cached_gem(spec)
|
434
|
+
end
|
435
|
+
end
|
463
436
|
|
437
|
+
def fetch_gem(spec, previous_spec = nil)
|
464
438
|
spec.fetch_platform
|
465
439
|
|
466
440
|
cache_path = download_cache_path(spec) || default_cache_path_for(rubygems_dir)
|
467
|
-
gem_path =
|
441
|
+
gem_path = package_path(cache_path, spec)
|
442
|
+
return gem_path if File.exist?(gem_path)
|
468
443
|
|
469
|
-
|
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
|
475
|
-
|
476
|
-
SharedHelpers.filesystem_access(download_cache_path) do |p|
|
444
|
+
SharedHelpers.filesystem_access(cache_path) do |p|
|
477
445
|
FileUtils.mkdir_p(p)
|
478
446
|
end
|
479
|
-
download_gem(spec,
|
480
|
-
|
481
|
-
if requires_sudo?
|
482
|
-
SharedHelpers.filesystem_access(cache_path) do |p|
|
483
|
-
Bundler.mkdir_p(p)
|
484
|
-
end
|
485
|
-
Bundler.sudo "mv #{download_cache_path}/#{spec.file_name} #{gem_path}"
|
486
|
-
end
|
447
|
+
download_gem(spec, cache_path, previous_spec)
|
487
448
|
|
488
449
|
gem_path
|
489
|
-
ensure
|
490
|
-
Bundler.rm_rf(download_path) if requires_sudo?
|
491
450
|
end
|
492
451
|
|
493
452
|
def installed?(spec)
|
494
453
|
installed_specs[spec].any? && !spec.deleted_gem?
|
495
454
|
end
|
496
455
|
|
497
|
-
def requires_sudo?
|
498
|
-
Bundler.requires_sudo?
|
499
|
-
end
|
500
|
-
|
501
456
|
def rubygems_dir
|
502
|
-
Bundler.
|
457
|
+
Bundler.bundle_path
|
503
458
|
end
|
504
459
|
|
505
460
|
def default_cache_path_for(dir)
|
@@ -521,9 +476,12 @@ module Bundler
|
|
521
476
|
# @param [String] download_cache_path
|
522
477
|
# the local directory the .gem will end up in.
|
523
478
|
#
|
524
|
-
|
479
|
+
# @param [Specification] previous_spec
|
480
|
+
# the spec previously locked
|
481
|
+
#
|
482
|
+
def download_gem(spec, download_cache_path, previous_spec = nil)
|
525
483
|
uri = spec.remote.uri
|
526
|
-
Bundler.ui.confirm("Fetching #{version_message(spec)}")
|
484
|
+
Bundler.ui.confirm("Fetching #{version_message(spec, previous_spec)}")
|
527
485
|
Bundler.rubygems.download_gem(spec, uri, download_cache_path)
|
528
486
|
end
|
529
487
|
|
data/lib/bundler/source.rb
CHANGED
@@ -15,13 +15,12 @@ module Bundler
|
|
15
15
|
specs.unmet_dependency_names
|
16
16
|
end
|
17
17
|
|
18
|
-
def version_message(spec)
|
18
|
+
def version_message(spec, locked_spec = nil)
|
19
19
|
message = "#{spec.name} #{spec.version}"
|
20
20
|
message += " (#{spec.platform})" if spec.platform != Gem::Platform::RUBY && !spec.platform.nil?
|
21
21
|
|
22
|
-
if
|
23
|
-
|
24
|
-
locked_spec_version = locked_spec.version if locked_spec
|
22
|
+
if locked_spec
|
23
|
+
locked_spec_version = locked_spec.version
|
25
24
|
if locked_spec_version && spec.version != locked_spec_version
|
26
25
|
message += Bundler.ui.add_color(" (was #{locked_spec_version})", version_color(spec.version, locked_spec_version))
|
27
26
|
end
|
data/lib/bundler/source_list.rb
CHANGED
@@ -101,6 +101,10 @@ module Bundler
|
|
101
101
|
source_list_for(source).find {|s| equivalent_source?(source, s) }
|
102
102
|
end
|
103
103
|
|
104
|
+
def get_with_fallback(source)
|
105
|
+
get(source) || default_source
|
106
|
+
end
|
107
|
+
|
104
108
|
def lock_sources
|
105
109
|
lock_other_sources + lock_rubygems_sources
|
106
110
|
end
|
@@ -157,11 +161,17 @@ module Bundler
|
|
157
161
|
end
|
158
162
|
|
159
163
|
def map_sources(replacement_sources)
|
160
|
-
[@rubygems_sources, @
|
164
|
+
rubygems, git, plugin = [@rubygems_sources, @git_sources, @plugin_sources].map do |sources|
|
161
165
|
sources.map do |source|
|
162
166
|
replacement_sources.find {|s| s == source } || source
|
163
167
|
end
|
164
168
|
end
|
169
|
+
|
170
|
+
path = @path_sources.map do |source|
|
171
|
+
replacement_sources.find {|s| s == (source.is_a?(Source::Gemspec) ? source.as_path_source : source) } || source
|
172
|
+
end
|
173
|
+
|
174
|
+
[rubygems, path, git, plugin]
|
165
175
|
end
|
166
176
|
|
167
177
|
def global_replacement_source(replacement_sources)
|
@@ -202,7 +212,7 @@ module Bundler
|
|
202
212
|
def warn_on_git_protocol(source)
|
203
213
|
return if Bundler.settings["git.allow_insecure"]
|
204
214
|
|
205
|
-
if source.uri
|
215
|
+
if /^git\:/.match?(source.uri)
|
206
216
|
Bundler.ui.warn "The git source `#{source.uri}` uses the `git` protocol, " \
|
207
217
|
"which transmits data without encryption. Disable this warning with " \
|
208
218
|
"`bundle config set --local git.allow_insecure true`, or switch to the `https` " \
|
data/lib/bundler/spec_set.rb
CHANGED
@@ -7,40 +7,43 @@ module Bundler
|
|
7
7
|
include Enumerable
|
8
8
|
include TSort
|
9
9
|
|
10
|
-
|
10
|
+
attr_reader :incomplete_specs
|
11
|
+
|
12
|
+
def initialize(specs, incomplete_specs = [])
|
11
13
|
@specs = specs
|
14
|
+
@incomplete_specs = incomplete_specs
|
12
15
|
end
|
13
16
|
|
14
|
-
def for(dependencies, check = false,
|
15
|
-
handled = []
|
16
|
-
deps = dependencies.
|
17
|
+
def for(dependencies, check = false, platforms = [nil])
|
18
|
+
handled = ["bundler"].product(platforms).map {|k| [k, true] }.to_h
|
19
|
+
deps = dependencies.product(platforms)
|
17
20
|
specs = []
|
18
21
|
|
19
22
|
loop do
|
20
23
|
break unless dep = deps.shift
|
21
|
-
next if handled.any?{|d| d.name == dep.name && (match_current_platform || d.__platform == dep.__platform) } || dep.name == "bundler"
|
22
24
|
|
23
|
-
|
25
|
+
name = dep[0].name
|
26
|
+
platform = dep[1]
|
27
|
+
|
28
|
+
key = [name, platform]
|
29
|
+
next if handled.key?(key)
|
30
|
+
|
31
|
+
handled[key] = true
|
24
32
|
|
25
|
-
specs_for_dep =
|
33
|
+
specs_for_dep = specs_for_dependency(*dep)
|
26
34
|
if specs_for_dep.any?
|
27
|
-
|
35
|
+
specs.concat(specs_for_dep)
|
28
36
|
|
29
37
|
specs_for_dep.first.dependencies.each do |d|
|
30
38
|
next if d.type == :development
|
31
|
-
|
32
|
-
deps << d
|
39
|
+
deps << [d, dep[1]]
|
33
40
|
end
|
34
41
|
elsif check
|
35
|
-
|
42
|
+
@incomplete_specs += lookup[name]
|
36
43
|
end
|
37
44
|
end
|
38
45
|
|
39
|
-
|
40
|
-
specs << spec
|
41
|
-
end
|
42
|
-
|
43
|
-
check ? true : specs
|
46
|
+
specs
|
44
47
|
end
|
45
48
|
|
46
49
|
def [](key)
|
@@ -54,6 +57,12 @@ module Bundler
|
|
54
57
|
@sorted = nil
|
55
58
|
end
|
56
59
|
|
60
|
+
def delete(spec)
|
61
|
+
@specs.delete(spec)
|
62
|
+
@lookup = nil
|
63
|
+
@sorted = nil
|
64
|
+
end
|
65
|
+
|
57
66
|
def sort!
|
58
67
|
self
|
59
68
|
end
|
@@ -67,14 +76,9 @@ module Bundler
|
|
67
76
|
end
|
68
77
|
|
69
78
|
def materialize(deps)
|
70
|
-
materialized = self.for(deps,
|
79
|
+
materialized = self.for(deps, true)
|
71
80
|
|
72
|
-
materialized
|
73
|
-
next s unless s.is_a?(LazySpecification)
|
74
|
-
s.source.local!
|
75
|
-
s.__materialize__ || s
|
76
|
-
end
|
77
|
-
SpecSet.new(materialized)
|
81
|
+
SpecSet.new(materialized, incomplete_specs)
|
78
82
|
end
|
79
83
|
|
80
84
|
# Materialize for all the specs in the spec set, regardless of what platform they're for
|
@@ -83,14 +87,19 @@ module Bundler
|
|
83
87
|
def materialized_for_all_platforms
|
84
88
|
@specs.map do |s|
|
85
89
|
next s unless s.is_a?(LazySpecification)
|
86
|
-
s.source.local!
|
87
90
|
s.source.remote!
|
88
|
-
spec = s.
|
91
|
+
spec = s.materialize_for_installation
|
89
92
|
raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec
|
90
93
|
spec
|
91
94
|
end
|
92
95
|
end
|
93
96
|
|
97
|
+
def incomplete_ruby_specs?(deps)
|
98
|
+
self.for(deps, true, [Gem::Platform::RUBY])
|
99
|
+
|
100
|
+
@incomplete_specs.any?
|
101
|
+
end
|
102
|
+
|
94
103
|
def missing_specs
|
95
104
|
@specs.select {|s| s.is_a?(LazySpecification) }
|
96
105
|
end
|
@@ -105,10 +114,20 @@ module Bundler
|
|
105
114
|
SpecSet.new(arr)
|
106
115
|
end
|
107
116
|
|
117
|
+
def -(other)
|
118
|
+
SpecSet.new(to_a - other.to_a)
|
119
|
+
end
|
120
|
+
|
108
121
|
def find_by_name_and_platform(name, platform)
|
109
122
|
@specs.detect {|spec| spec.name == name && spec.match_platform(platform) }
|
110
123
|
end
|
111
124
|
|
125
|
+
def delete_by_name(name)
|
126
|
+
@specs.reject! {|spec| spec.name == name }
|
127
|
+
@lookup = nil
|
128
|
+
@sorted = nil
|
129
|
+
end
|
130
|
+
|
112
131
|
def what_required(spec)
|
113
132
|
unless req = find {|s| s.dependencies.any? {|d| d.type == :runtime && d.name == spec.name } }
|
114
133
|
return [spec]
|
@@ -146,7 +165,7 @@ module Bundler
|
|
146
165
|
cgems = extract_circular_gems(error)
|
147
166
|
raise CyclicDependencyError, "Your bundle requires gems that depend" \
|
148
167
|
" on each other, creating an infinite loop. Please remove either" \
|
149
|
-
" gem '#{cgems[
|
168
|
+
" gem '#{cgems[0]}' or gem '#{cgems[1]}' and try again."
|
150
169
|
end
|
151
170
|
end
|
152
171
|
|
@@ -157,7 +176,7 @@ module Bundler
|
|
157
176
|
def lookup
|
158
177
|
@lookup ||= begin
|
159
178
|
lookup = Hash.new {|h, k| h[k] = [] }
|
160
|
-
|
179
|
+
@specs.each do |s|
|
161
180
|
lookup[s.name] << s
|
162
181
|
end
|
163
182
|
lookup
|
@@ -169,13 +188,12 @@ module Bundler
|
|
169
188
|
@specs.sort_by(&:name).each {|s| yield s }
|
170
189
|
end
|
171
190
|
|
172
|
-
def
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
end
|
191
|
+
def specs_for_dependency(dep, platform)
|
192
|
+
specs_for_name = lookup[dep.name]
|
193
|
+
target_platform = dep.force_ruby_platform ? Gem::Platform::RUBY : (platform || Bundler.local_platform)
|
194
|
+
matching_specs = GemHelpers.select_best_platform_match(specs_for_name, target_platform)
|
195
|
+
matching_specs.map!(&:materialize_for_installation).compact! if platform.nil?
|
196
|
+
matching_specs
|
179
197
|
end
|
180
198
|
|
181
199
|
def tsort_each_child(s)
|
@@ -64,9 +64,11 @@ module Bundler
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def full_gem_path
|
67
|
-
|
68
|
-
|
69
|
-
|
67
|
+
stub.full_gem_path
|
68
|
+
end
|
69
|
+
|
70
|
+
def full_gem_path=(path)
|
71
|
+
stub.full_gem_path = path
|
70
72
|
end
|
71
73
|
|
72
74
|
def full_require_paths
|
@@ -13,7 +13,7 @@ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("<%= relative_gemfile_path %>", __dir
|
|
13
13
|
bundle_binstub = File.expand_path("bundle", __dir__)
|
14
14
|
|
15
15
|
if File.file?(bundle_binstub)
|
16
|
-
if File.read(bundle_binstub, 300)
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
17
17
|
load(bundle_binstub)
|
18
18
|
else
|
19
19
|
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
@@ -62,8 +62,9 @@ m = Module.new do
|
|
62
62
|
|
63
63
|
def bundler_requirement
|
64
64
|
@bundler_requirement ||=
|
65
|
-
env_var_version ||
|
66
|
-
|
65
|
+
env_var_version ||
|
66
|
+
cli_arg_version ||
|
67
|
+
bundler_requirement_for(lockfile_version)
|
67
68
|
end
|
68
69
|
|
69
70
|
def bundler_requirement_for(version)
|
@@ -71,13 +72,7 @@ m = Module.new do
|
|
71
72
|
|
72
73
|
bundler_gem_version = Gem::Version.new(version)
|
73
74
|
|
74
|
-
|
75
|
-
|
76
|
-
return requirement unless Gem.rubygems_version < Gem::Version.new("2.7.0")
|
77
|
-
|
78
|
-
requirement += ".a" if bundler_gem_version.prerelease?
|
79
|
-
|
80
|
-
requirement
|
75
|
+
bundler_gem_version.approximate_recommendation
|
81
76
|
end
|
82
77
|
|
83
78
|
def load_bundler!
|
@@ -1,18 +1,20 @@
|
|
1
1
|
# <%= config[:constant_name] %>
|
2
2
|
|
3
|
-
|
3
|
+
TODO: Delete this and the text below, and describe your gem
|
4
4
|
|
5
|
-
|
5
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/<%= config[:namespaced_path] %>`. To experiment with that code, run `bin/console` for an interactive prompt.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
|
+
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
10
|
+
|
9
11
|
Install the gem and add to the application's Gemfile by executing:
|
10
12
|
|
11
|
-
$ bundle add
|
13
|
+
$ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
|
12
14
|
|
13
15
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
14
16
|
|
15
|
-
$ gem install
|
17
|
+
$ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
|
16
18
|
|
17
19
|
## Usage
|
18
20
|
|
@@ -39,7 +39,8 @@ require "standard/rake"
|
|
39
39
|
|
40
40
|
<% end -%>
|
41
41
|
<% if config[:ext] -%>
|
42
|
-
<% default_task_names.unshift(:
|
42
|
+
<% default_task_names.unshift(:compile) -%>
|
43
|
+
<% default_task_names.unshift(:clobber) unless config[:ext] == 'rust' -%>
|
43
44
|
require "rake/extensiontask"
|
44
45
|
|
45
46
|
task build: :compile
|
@@ -3,8 +3,20 @@ jobs:
|
|
3
3
|
build:
|
4
4
|
docker:
|
5
5
|
- image: ruby:<%= RUBY_VERSION %>
|
6
|
+
<%- if config[:ext] == 'rust' -%>
|
7
|
+
environment:
|
8
|
+
RB_SYS_FORCE_INSTALL_RUST_TOOLCHAIN: 'true'
|
9
|
+
<%- end -%>
|
6
10
|
steps:
|
7
11
|
- checkout
|
12
|
+
<%- if config[:ext] == 'rust' -%>
|
13
|
+
- run:
|
14
|
+
name: Install Rust/Cargo dependencies
|
15
|
+
command: apt-get update && apt-get install -y clang
|
16
|
+
- run:
|
17
|
+
name: Install a RubyGems version that can compile rust extensions
|
18
|
+
command: gem update --system '<%= ::Gem.rubygems_version %>'
|
19
|
+
<%- end -%>
|
8
20
|
- run:
|
9
21
|
name: Run the default task
|
10
22
|
command: |
|
@@ -0,0 +1,15 @@
|
|
1
|
+
[package]
|
2
|
+
name = <%= config[:name].inspect %>
|
3
|
+
version = "0.1.0"
|
4
|
+
edition = "2021"
|
5
|
+
authors = ["<%= config[:author] %> <<%= config[:email] %>>"]
|
6
|
+
<%- if config[:mit] -%>
|
7
|
+
license = "MIT"
|
8
|
+
<%- end -%>
|
9
|
+
publish = false
|
10
|
+
|
11
|
+
[lib]
|
12
|
+
crate-type = ["cdylib"]
|
13
|
+
|
14
|
+
[dependencies]
|
15
|
+
magnus = { version = "0.4" }
|