bundler 2.3.26 → 2.4.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +228 -1
- data/README.md +3 -6
- data/bundler.gemspec +2 -2
- 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 +1 -0
- 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 +2 -2
- data/lib/bundler/cli/install.rb +2 -3
- data/lib/bundler/cli/lock.rb +8 -5
- data/lib/bundler/cli/open.rb +6 -4
- data/lib/bundler/cli/outdated.rb +1 -3
- data/lib/bundler/cli/viz.rb +1 -1
- data/lib/bundler/cli.rb +45 -2
- data/lib/bundler/compact_index_client/cache.rb +1 -1
- data/lib/bundler/compact_index_client/updater.rb +40 -39
- data/lib/bundler/constants.rb +1 -1
- data/lib/bundler/current_ruby.rb +2 -0
- data/lib/bundler/definition.rb +99 -51
- data/lib/bundler/dependency.rb +13 -12
- data/lib/bundler/digest.rb +1 -1
- data/lib/bundler/dsl.rb +3 -3
- data/lib/bundler/endpoint_specification.rb +0 -4
- data/lib/bundler/env.rb +1 -1
- data/lib/bundler/environment_preserver.rb +3 -2
- data/lib/bundler/errors.rb +1 -11
- data/lib/bundler/fetcher/compact_index.rb +9 -11
- data/lib/bundler/fetcher/dependency.rb +2 -6
- data/lib/bundler/fetcher/downloader.rb +2 -5
- data/lib/bundler/fetcher.rb +4 -8
- data/lib/bundler/force_platform.rb +18 -0
- data/lib/bundler/friendly_errors.rb +0 -3
- data/lib/bundler/gem_version_promoter.rb +52 -86
- data/lib/bundler/graph.rb +3 -3
- data/lib/bundler/index.rb +7 -15
- data/lib/bundler/injector.rb +2 -2
- data/lib/bundler/inline.rb +8 -10
- data/lib/bundler/installer/parallel_installer.rb +3 -33
- data/lib/bundler/installer/standalone.rb +12 -8
- data/lib/bundler/installer.rb +9 -23
- data/lib/bundler/lazy_specification.rb +42 -42
- data/lib/bundler/lockfile_generator.rb +1 -1
- data/lib/bundler/lockfile_parser.rb +16 -16
- 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 +3 -3
- data/lib/bundler/man/bundle-cache.1.ronn +2 -2
- 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 +2 -2
- data/lib/bundler/man/bundle-config.1.ronn +1 -1
- data/lib/bundler/man/bundle-console.1 +1 -1
- data/lib/bundler/man/bundle-doctor.1 +1 -1
- data/lib/bundler/man/bundle-exec.1 +5 -5
- data/lib/bundler/man/bundle-exec.1.ronn +5 -5
- 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 +1 -1
- data/lib/bundler/man/bundle-info.1 +1 -1
- data/lib/bundler/man/bundle-init.1 +5 -1
- data/lib/bundler/man/bundle-init.1.ronn +2 -0
- data/lib/bundler/man/bundle-inject.1 +1 -1
- data/lib/bundler/man/bundle-install.1 +1 -30
- data/lib/bundler/man/bundle-install.1.ronn +0 -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 +2 -2
- data/lib/bundler/man/bundle-platform.1.ronn +1 -1
- data/lib/bundler/man/bundle-plugin.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-version.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 +1 -1
- data/lib/bundler/mirror.rb +5 -7
- data/lib/bundler/plugin/index.rb +4 -4
- data/lib/bundler/plugin/installer/rubygems.rb +0 -4
- data/lib/bundler/plugin/installer.rb +5 -2
- data/lib/bundler/plugin.rb +1 -1
- data/lib/bundler/remote_specification.rb +2 -6
- data/lib/bundler/resolver/base.rb +72 -15
- 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 +26 -36
- data/lib/bundler/resolver.rb +311 -278
- data/lib/bundler/ruby_version.rb +1 -1
- data/lib/bundler/rubygems_ext.rb +16 -9
- data/lib/bundler/rubygems_gem_installer.rb +4 -2
- data/lib/bundler/rubygems_integration.rb +10 -14
- data/lib/bundler/runtime.rb +1 -5
- data/lib/bundler/safe_marshal.rb +31 -0
- data/lib/bundler/settings.rb +1 -7
- data/lib/bundler/setup.rb +4 -1
- data/lib/bundler/shared_helpers.rb +2 -1
- data/lib/bundler/source/git/git_proxy.rb +214 -69
- data/lib/bundler/source/git.rb +17 -18
- data/lib/bundler/source/metadata.rb +0 -1
- data/lib/bundler/source/path/installer.rb +1 -22
- data/lib/bundler/source/path.rb +6 -6
- data/lib/bundler/source/rubygems.rb +19 -77
- data/lib/bundler/source_list.rb +8 -2
- data/lib/bundler/spec_set.rb +22 -14
- data/lib/bundler/templates/Executable +1 -1
- data/lib/bundler/templates/Executable.bundler +5 -10
- 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 +12 -1
- data/lib/bundler/templates/newgem/bin/console.tt +0 -4
- 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-c.rb.tt +10 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +1 -1
- 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 +8 -0
- 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/uri_normalizer.rb +23 -0
- 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 +150 -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 +60 -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 +129 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +411 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +243 -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 +17 -69
- metadata +35 -33
- data/lib/bundler/templates/gems.rb +0 -5
- data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +0 -5
- 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/source/git.rb
CHANGED
@@ -19,7 +19,7 @@ module Bundler
|
|
19
19
|
# Stringify options that could be set as symbols
|
20
20
|
%w[ref branch tag revision].each {|k| options[k] = options[k].to_s if options[k] }
|
21
21
|
|
22
|
-
@uri = options["uri"] || ""
|
22
|
+
@uri = URINormalizer.normalize_suffix(options["uri"] || "", :trailing_slash => false)
|
23
23
|
@safe_uri = URICredentialsFilter.credential_filtered_uri(@uri)
|
24
24
|
@branch = options["branch"]
|
25
25
|
@ref = options["ref"] || options["branch"] || options["tag"]
|
@@ -64,7 +64,7 @@ module Bundler
|
|
64
64
|
at = if local?
|
65
65
|
path
|
66
66
|
elsif user_ref = options["ref"]
|
67
|
-
if
|
67
|
+
if /\A[a-z0-9]{4,}\z/i.match?(ref)
|
68
68
|
shortref_for_display(user_ref)
|
69
69
|
else
|
70
70
|
user_ref
|
@@ -72,7 +72,7 @@ module Bundler
|
|
72
72
|
elsif ref
|
73
73
|
ref
|
74
74
|
else
|
75
|
-
|
75
|
+
current_branch
|
76
76
|
end
|
77
77
|
|
78
78
|
rev = "at #{at}@#{shortref_for_display(revision)}"
|
@@ -102,13 +102,7 @@ module Bundler
|
|
102
102
|
@install_path ||= begin
|
103
103
|
git_scope = "#{base_name}-#{shortref_for_path(revision)}"
|
104
104
|
|
105
|
-
|
106
|
-
|
107
|
-
if !path.exist? && Bundler.requires_sudo?
|
108
|
-
Bundler.user_bundle_path.join(Bundler.ruby_scope).join(git_scope)
|
109
|
-
else
|
110
|
-
path
|
111
|
-
end
|
105
|
+
Bundler.install_path.join(git_scope)
|
112
106
|
end
|
113
107
|
end
|
114
108
|
|
@@ -132,7 +126,7 @@ module Bundler
|
|
132
126
|
path = Pathname.new(path)
|
133
127
|
path = path.expand_path(Bundler.root) unless path.relative?
|
134
128
|
|
135
|
-
unless
|
129
|
+
unless branch || Bundler.settings[:disable_local_branch_check]
|
136
130
|
raise GitError, "Cannot use local override for #{name} at #{path} because " \
|
137
131
|
":branch is not specified in Gemfile. Specify a branch or run " \
|
138
132
|
"`bundle config unset local.#{override_for(original_path)}` to remove the local override"
|
@@ -147,14 +141,14 @@ module Bundler
|
|
147
141
|
|
148
142
|
# Create a new git proxy without the cached revision
|
149
143
|
# so the Gemfile.lock always picks up the new revision.
|
150
|
-
@git_proxy = GitProxy.new(path, uri,
|
144
|
+
@git_proxy = GitProxy.new(path, uri, options)
|
151
145
|
|
152
|
-
if
|
146
|
+
if current_branch != branch && !Bundler.settings[:disable_local_branch_check]
|
153
147
|
raise GitError, "Local override for #{name} at #{path} is using branch " \
|
154
|
-
"#{
|
148
|
+
"#{current_branch} but Gemfile specifies #{branch}"
|
155
149
|
end
|
156
150
|
|
157
|
-
changed = cached_revision && cached_revision !=
|
151
|
+
changed = cached_revision && cached_revision != revision
|
158
152
|
|
159
153
|
if !Bundler.settings[:disable_local_revision_check] && changed && !@unlocked && !git_proxy.contains?(cached_revision)
|
160
154
|
raise GitError, "The Gemfile lock is pointing to revision #{shortref_for_display(cached_revision)} " \
|
@@ -179,6 +173,7 @@ module Bundler
|
|
179
173
|
end
|
180
174
|
|
181
175
|
def install(spec, options = {})
|
176
|
+
return if Bundler.settings[:no_install]
|
182
177
|
force = options[:force]
|
183
178
|
|
184
179
|
print_using_message "Using #{version_message(spec, options[:previous_spec])} from #{self}"
|
@@ -219,7 +214,7 @@ module Bundler
|
|
219
214
|
# across different projects, this cache will be shared.
|
220
215
|
# When using local git repos, this is set to the local repo.
|
221
216
|
def cache_path
|
222
|
-
@cache_path ||= if Bundler.
|
217
|
+
@cache_path ||= if Bundler.feature_flag.global_gem_cache?
|
223
218
|
Bundler.user_cache
|
224
219
|
else
|
225
220
|
Bundler.bundle_path.join("cache", "bundler")
|
@@ -234,6 +229,10 @@ module Bundler
|
|
234
229
|
git_proxy.revision
|
235
230
|
end
|
236
231
|
|
232
|
+
def current_branch
|
233
|
+
git_proxy.current_branch
|
234
|
+
end
|
235
|
+
|
237
236
|
def allow_git_ops?
|
238
237
|
@allow_remote || @allow_cached
|
239
238
|
end
|
@@ -297,7 +296,7 @@ module Bundler
|
|
297
296
|
end
|
298
297
|
|
299
298
|
def uri_hash
|
300
|
-
if
|
299
|
+
if %r{^\w+://(\w+@)?}.match?(uri)
|
301
300
|
# Downcase the domain component of the URI
|
302
301
|
# and strip off a trailing slash, if one is present
|
303
302
|
input = Bundler::URI.parse(uri).normalize.to_s.sub(%r{/$}, "")
|
@@ -319,7 +318,7 @@ module Bundler
|
|
319
318
|
end
|
320
319
|
|
321
320
|
def git_proxy
|
322
|
-
@git_proxy ||= GitProxy.new(cache_path, uri,
|
321
|
+
@git_proxy ||= GitProxy.new(cache_path, uri, options, cached_revision, self)
|
323
322
|
end
|
324
323
|
|
325
324
|
def fetch
|
@@ -18,13 +18,7 @@ module Bundler
|
|
18
18
|
@build_args = options[:build_args] || Bundler.rubygems.build_args
|
19
19
|
@gem_bin_dir = "#{Bundler.rubygems.gem_dir}/bin"
|
20
20
|
@disable_extensions = options[:disable_extensions]
|
21
|
-
|
22
|
-
if Bundler.requires_sudo?
|
23
|
-
@tmp_dir = Bundler.tmp(spec.full_name).to_s
|
24
|
-
@bin_dir = "#{@tmp_dir}/bin"
|
25
|
-
else
|
26
|
-
@bin_dir = @gem_bin_dir
|
27
|
-
end
|
21
|
+
@bin_dir = @gem_bin_dir
|
28
22
|
end
|
29
23
|
|
30
24
|
def post_install
|
@@ -38,25 +32,10 @@ module Bundler
|
|
38
32
|
generate_bin unless spec.executables.empty?
|
39
33
|
|
40
34
|
run_hooks(:post_install)
|
41
|
-
ensure
|
42
|
-
Bundler.rm_rf(@tmp_dir) if Bundler.requires_sudo?
|
43
35
|
end
|
44
36
|
|
45
37
|
private
|
46
38
|
|
47
|
-
def generate_bin
|
48
|
-
super
|
49
|
-
|
50
|
-
if Bundler.requires_sudo?
|
51
|
-
SharedHelpers.filesystem_access(@gem_bin_dir) do |p|
|
52
|
-
Bundler.mkdir_p(p)
|
53
|
-
end
|
54
|
-
spec.executables.each do |exe|
|
55
|
-
Bundler.sudo "cp -R #{@bin_dir}/#{exe} #{@gem_bin_dir}"
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
39
|
def run_hooks(type)
|
61
40
|
hooks_meth = "#{type}_hooks"
|
62
41
|
return unless Gem.respond_to?(hooks_meth)
|
data/lib/bundler/source/path.rb
CHANGED
@@ -11,7 +11,7 @@ module Bundler
|
|
11
11
|
|
12
12
|
protected :original_path
|
13
13
|
|
14
|
-
DEFAULT_GLOB = "{,*,*/*}.gemspec"
|
14
|
+
DEFAULT_GLOB = "{,*,*/*}.gemspec"
|
15
15
|
|
16
16
|
def initialize(options)
|
17
17
|
@options = options.dup
|
@@ -224,13 +224,13 @@ module Bundler
|
|
224
224
|
|
225
225
|
# Some gem authors put absolute paths in their gemspec
|
226
226
|
# and we have to save them from themselves
|
227
|
-
spec.files = spec.files.map do |
|
228
|
-
next
|
229
|
-
next if File.directory?(
|
227
|
+
spec.files = spec.files.map do |path|
|
228
|
+
next path unless /\A#{Pathname::SEPARATOR_PAT}/.match?(path)
|
229
|
+
next if File.directory?(path)
|
230
230
|
begin
|
231
|
-
Pathname.new(
|
231
|
+
Pathname.new(path).relative_path_from(gem_dir).to_s
|
232
232
|
rescue ArgumentError
|
233
|
-
|
233
|
+
path
|
234
234
|
end
|
235
235
|
end.compact
|
236
236
|
|
@@ -7,8 +7,6 @@ module Bundler
|
|
7
7
|
class Rubygems < Source
|
8
8
|
autoload :Remote, File.expand_path("rubygems/remote", __dir__)
|
9
9
|
|
10
|
-
# Use the API when installing less than X gems
|
11
|
-
API_REQUEST_LIMIT = 500
|
12
10
|
# Ask for X gems per API request
|
13
11
|
API_REQUEST_SIZE = 50
|
14
12
|
|
@@ -145,7 +143,7 @@ module Bundler
|
|
145
143
|
end
|
146
144
|
|
147
145
|
if installed?(spec) && !force
|
148
|
-
print_using_message "Using #{version_message(spec)}"
|
146
|
+
print_using_message "Using #{version_message(spec, options[:previous_spec])}"
|
149
147
|
return nil # no post-install message
|
150
148
|
end
|
151
149
|
|
@@ -160,27 +158,20 @@ module Bundler
|
|
160
158
|
|
161
159
|
return if Bundler.settings[:no_install]
|
162
160
|
|
163
|
-
|
164
|
-
|
165
|
-
bin_path = install_path.join("bin")
|
166
|
-
else
|
167
|
-
install_path = rubygems_dir
|
168
|
-
bin_path = Bundler.system_bindir
|
169
|
-
end
|
170
|
-
|
171
|
-
Bundler.mkdir_p bin_path, :no_sudo => true unless spec.executables.empty? || Bundler.rubygems.provides?(">= 2.7.5")
|
161
|
+
install_path = rubygems_dir
|
162
|
+
bin_path = Bundler.system_bindir
|
172
163
|
|
173
164
|
require_relative "../rubygems_gem_installer"
|
174
165
|
|
175
166
|
installer = Bundler::RubyGemsGemInstaller.at(
|
176
167
|
path,
|
177
|
-
:security_policy
|
178
|
-
:install_dir
|
179
|
-
:bin_dir
|
168
|
+
:security_policy => Bundler.rubygems.security_policies[Bundler.settings["trust-policy"]],
|
169
|
+
:install_dir => install_path.to_s,
|
170
|
+
:bin_dir => bin_path.to_s,
|
180
171
|
:ignore_dependencies => true,
|
181
|
-
:wrappers
|
182
|
-
:env_shebang
|
183
|
-
:build_args
|
172
|
+
:wrappers => true,
|
173
|
+
:env_shebang => true,
|
174
|
+
:build_args => options[:build_args],
|
184
175
|
:bundler_expected_checksum => spec.respond_to?(:checksum) && spec.checksum,
|
185
176
|
:bundler_extension_cache_path => extension_cache_path(spec)
|
186
177
|
)
|
@@ -209,34 +200,7 @@ module Bundler
|
|
209
200
|
spec.full_gem_path = installed_spec.full_gem_path
|
210
201
|
spec.loaded_from = installed_spec.loaded_from
|
211
202
|
|
212
|
-
# SUDO HAX
|
213
|
-
if requires_sudo?
|
214
|
-
Bundler.rubygems.repository_subdirectories.each do |name|
|
215
|
-
src = File.join(install_path, name, "*")
|
216
|
-
dst = File.join(rubygems_dir, name)
|
217
|
-
if name == "extensions" && Dir.glob(src).any?
|
218
|
-
src = File.join(src, "*/*")
|
219
|
-
ext_src = Dir.glob(src).first
|
220
|
-
ext_src.gsub!(src[0..-6], "")
|
221
|
-
dst = File.dirname(File.join(dst, ext_src))
|
222
|
-
end
|
223
|
-
SharedHelpers.filesystem_access(dst) do |p|
|
224
|
-
Bundler.mkdir_p(p)
|
225
|
-
end
|
226
|
-
Bundler.sudo "cp -R #{src} #{dst}" if Dir[src].any?
|
227
|
-
end
|
228
|
-
|
229
|
-
spec.executables.each do |exe|
|
230
|
-
SharedHelpers.filesystem_access(Bundler.system_bindir) do |p|
|
231
|
-
Bundler.mkdir_p(p)
|
232
|
-
end
|
233
|
-
Bundler.sudo "cp -R #{install_path}/bin/#{exe} #{Bundler.system_bindir}/"
|
234
|
-
end
|
235
|
-
end
|
236
|
-
|
237
203
|
spec.post_install_message
|
238
|
-
ensure
|
239
|
-
Bundler.rm_rf(install_path) if requires_sudo?
|
240
204
|
end
|
241
205
|
|
242
206
|
def cache(spec, custom_path = nil)
|
@@ -326,7 +290,7 @@ module Bundler
|
|
326
290
|
end
|
327
291
|
|
328
292
|
def dependency_api_available?
|
329
|
-
api_fetchers.any?
|
293
|
+
@allow_remote && api_fetchers.any?
|
330
294
|
end
|
331
295
|
|
332
296
|
protected
|
@@ -371,8 +335,7 @@ module Bundler
|
|
371
335
|
end
|
372
336
|
|
373
337
|
def normalize_uri(uri)
|
374
|
-
uri = uri.to_s
|
375
|
-
uri = "#{uri}/" unless uri =~ %r{/$}
|
338
|
+
uri = URINormalizer.normalize_suffix(uri.to_s)
|
376
339
|
require_relative "../vendored_uri"
|
377
340
|
uri = Bundler::URI(uri)
|
378
341
|
raise ArgumentError, "The source must be an absolute URI. For example:\n" \
|
@@ -415,7 +378,7 @@ module Bundler
|
|
415
378
|
idx = @allow_local ? installed_specs.dup : Index.new
|
416
379
|
|
417
380
|
Dir["#{cache_path}/*.gem"].each do |gemfile|
|
418
|
-
next if
|
381
|
+
next if /^bundler\-[\d\.]+?\.gem/.match?(gemfile)
|
419
382
|
s ||= Bundler.rubygems.spec_from_gem(gemfile)
|
420
383
|
s.source = self
|
421
384
|
idx << s
|
@@ -436,12 +399,11 @@ module Bundler
|
|
436
399
|
# gather lists from non-api sites
|
437
400
|
fetch_names(index_fetchers, nil, idx, false)
|
438
401
|
|
439
|
-
#
|
440
|
-
#
|
441
|
-
#
|
442
|
-
|
443
|
-
|
444
|
-
" Downloading full index instead..." unless allow_api
|
402
|
+
# legacy multi-remote sources need special logic to figure out
|
403
|
+
# dependency names and that logic can be very costly if one remote
|
404
|
+
# uses the dependency API but others don't. So use full indexes
|
405
|
+
# consistently in that particular case.
|
406
|
+
allow_api = !multiple_remotes?
|
445
407
|
|
446
408
|
fetch_names(api_fetchers, allow_api && dependency_names, idx, false)
|
447
409
|
end
|
@@ -475,38 +437,18 @@ module Bundler
|
|
475
437
|
gem_path = package_path(cache_path, spec)
|
476
438
|
return gem_path if File.exist?(gem_path)
|
477
439
|
|
478
|
-
|
479
|
-
download_path = Bundler.tmp(spec.full_name)
|
480
|
-
download_cache_path = default_cache_path_for(download_path)
|
481
|
-
else
|
482
|
-
download_cache_path = cache_path
|
483
|
-
end
|
484
|
-
|
485
|
-
SharedHelpers.filesystem_access(download_cache_path) do |p|
|
440
|
+
SharedHelpers.filesystem_access(cache_path) do |p|
|
486
441
|
FileUtils.mkdir_p(p)
|
487
442
|
end
|
488
|
-
download_gem(spec,
|
489
|
-
|
490
|
-
if requires_sudo?
|
491
|
-
SharedHelpers.filesystem_access(cache_path) do |p|
|
492
|
-
Bundler.mkdir_p(p)
|
493
|
-
end
|
494
|
-
Bundler.sudo "mv #{package_path(download_cache_path, spec)} #{gem_path}"
|
495
|
-
end
|
443
|
+
download_gem(spec, cache_path, previous_spec)
|
496
444
|
|
497
445
|
gem_path
|
498
|
-
ensure
|
499
|
-
Bundler.rm_rf(download_path) if requires_sudo?
|
500
446
|
end
|
501
447
|
|
502
448
|
def installed?(spec)
|
503
449
|
installed_specs[spec].any? && !spec.deleted_gem?
|
504
450
|
end
|
505
451
|
|
506
|
-
def requires_sudo?
|
507
|
-
Bundler.requires_sudo?
|
508
|
-
end
|
509
|
-
|
510
452
|
def rubygems_dir
|
511
453
|
Bundler.bundle_path
|
512
454
|
end
|
data/lib/bundler/source_list.rb
CHANGED
@@ -161,11 +161,17 @@ module Bundler
|
|
161
161
|
end
|
162
162
|
|
163
163
|
def map_sources(replacement_sources)
|
164
|
-
[@rubygems_sources, @
|
164
|
+
rubygems, git, plugin = [@rubygems_sources, @git_sources, @plugin_sources].map do |sources|
|
165
165
|
sources.map do |source|
|
166
166
|
replacement_sources.find {|s| s == source } || source
|
167
167
|
end
|
168
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]
|
169
175
|
end
|
170
176
|
|
171
177
|
def global_replacement_source(replacement_sources)
|
@@ -206,7 +212,7 @@ module Bundler
|
|
206
212
|
def warn_on_git_protocol(source)
|
207
213
|
return if Bundler.settings["git.allow_insecure"]
|
208
214
|
|
209
|
-
if source.uri
|
215
|
+
if /^git\:/.match?(source.uri)
|
210
216
|
Bundler.ui.warn "The git source `#{source.uri}` uses the `git` protocol, " \
|
211
217
|
"which transmits data without encryption. Disable this warning with " \
|
212
218
|
"`bundle config set --local git.allow_insecure true`, or switch to the `https` " \
|
data/lib/bundler/spec_set.rb
CHANGED
@@ -24,6 +24,7 @@ module Bundler
|
|
24
24
|
|
25
25
|
name = dep[0].name
|
26
26
|
platform = dep[1]
|
27
|
+
incomplete = false
|
27
28
|
|
28
29
|
key = [name, platform]
|
29
30
|
next if handled.key?(key)
|
@@ -36,14 +37,19 @@ module Bundler
|
|
36
37
|
|
37
38
|
specs_for_dep.first.dependencies.each do |d|
|
38
39
|
next if d.type == :development
|
40
|
+
incomplete = true if d.name != "bundler" && lookup[d.name].empty?
|
39
41
|
deps << [d, dep[1]]
|
40
42
|
end
|
41
|
-
|
42
|
-
|
43
|
+
else
|
44
|
+
incomplete = true
|
45
|
+
end
|
46
|
+
|
47
|
+
if incomplete && check
|
48
|
+
@incomplete_specs += lookup[name].any? ? lookup[name] : [LazySpecification.new(name, nil, nil)]
|
43
49
|
end
|
44
50
|
end
|
45
51
|
|
46
|
-
specs
|
52
|
+
specs.uniq
|
47
53
|
end
|
48
54
|
|
49
55
|
def [](key)
|
@@ -57,8 +63,8 @@ module Bundler
|
|
57
63
|
@sorted = nil
|
58
64
|
end
|
59
65
|
|
60
|
-
def delete(
|
61
|
-
@specs.delete(spec)
|
66
|
+
def delete(specs)
|
67
|
+
specs.each {|spec| @specs.delete(spec) }
|
62
68
|
@lookup = nil
|
63
69
|
@sorted = nil
|
64
70
|
end
|
@@ -95,6 +101,10 @@ module Bundler
|
|
95
101
|
end
|
96
102
|
|
97
103
|
def incomplete_ruby_specs?(deps)
|
104
|
+
return false if @specs.empty?
|
105
|
+
|
106
|
+
@incomplete_specs = []
|
107
|
+
|
98
108
|
self.for(deps, true, [Gem::Platform::RUBY])
|
99
109
|
|
100
110
|
@incomplete_specs.any?
|
@@ -122,8 +132,8 @@ module Bundler
|
|
122
132
|
@specs.detect {|spec| spec.name == name && spec.match_platform(platform) }
|
123
133
|
end
|
124
134
|
|
125
|
-
def
|
126
|
-
@specs.reject! {|spec| spec.name == name
|
135
|
+
def delete_by_name(name)
|
136
|
+
@specs.reject! {|spec| spec.name == name }
|
127
137
|
@lookup = nil
|
128
138
|
@sorted = nil
|
129
139
|
end
|
@@ -165,7 +175,7 @@ module Bundler
|
|
165
175
|
cgems = extract_circular_gems(error)
|
166
176
|
raise CyclicDependencyError, "Your bundle requires gems that depend" \
|
167
177
|
" on each other, creating an infinite loop. Please remove either" \
|
168
|
-
" gem '#{cgems[
|
178
|
+
" gem '#{cgems[0]}' or gem '#{cgems[1]}' and try again."
|
169
179
|
end
|
170
180
|
end
|
171
181
|
|
@@ -190,12 +200,10 @@ module Bundler
|
|
190
200
|
|
191
201
|
def specs_for_dependency(dep, platform)
|
192
202
|
specs_for_name = lookup[dep.name]
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
GemHelpers.select_best_platform_match(specs_for_name, dep.force_ruby_platform ? Gem::Platform::RUBY : platform)
|
198
|
-
end
|
203
|
+
target_platform = dep.force_ruby_platform ? Gem::Platform::RUBY : (platform || Bundler.local_platform)
|
204
|
+
matching_specs = GemHelpers.select_best_platform_match(specs_for_name, target_platform)
|
205
|
+
matching_specs.map!(&:materialize_for_installation).compact! if platform.nil?
|
206
|
+
matching_specs
|
199
207
|
end
|
200
208
|
|
201
209
|
def tsort_each_child(s)
|
@@ -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.
|
@@ -47,7 +47,7 @@ m = Module.new do
|
|
47
47
|
def lockfile
|
48
48
|
lockfile =
|
49
49
|
case File.basename(gemfile)
|
50
|
-
when "gems.rb" then gemfile.sub(/\.rb$/,
|
50
|
+
when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
|
51
51
|
else "#{gemfile}.lock"
|
52
52
|
end
|
53
53
|
File.expand_path(lockfile)
|
@@ -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,17 @@ 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' -%>
|
44
|
+
<% if config[:ext] == 'rust' -%>
|
45
|
+
require "rb_sys/extensiontask"
|
46
|
+
|
47
|
+
task build: :compile
|
48
|
+
|
49
|
+
RbSys::ExtensionTask.new(<%= config[:name].inspect %>) do |ext|
|
50
|
+
ext.lib_dir = "lib/<%= config[:namespaced_path] %>"
|
51
|
+
end
|
52
|
+
<% else -%>
|
43
53
|
require "rake/extensiontask"
|
44
54
|
|
45
55
|
task build: :compile
|
@@ -47,6 +57,7 @@ task build: :compile
|
|
47
57
|
Rake::ExtensionTask.new("<%= config[:underscored_name] %>") do |ext|
|
48
58
|
ext.lib_dir = "lib/<%= config[:namespaced_path] %>"
|
49
59
|
end
|
60
|
+
<% end -%>
|
50
61
|
|
51
62
|
<% end -%>
|
52
63
|
<% if default_task_names.size == 1 -%>
|
@@ -7,9 +7,5 @@ require "<%= config[:namespaced_path] %>"
|
|
7
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
8
8
|
# with your gem easier. You can also use a different console, if you like.
|
9
9
|
|
10
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
-
# require "pry"
|
12
|
-
# Pry.start
|
13
|
-
|
14
10
|
require "irb"
|
15
11
|
IRB.start(__FILE__)
|
@@ -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" }
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "mkmf"
|
4
|
+
|
5
|
+
# Makes all symbols private by default to avoid unintended conflict
|
6
|
+
# with other gems. To explicitly export symbols you can use RUBY_FUNC_EXPORTED
|
7
|
+
# selectively, or entirely remove this flag.
|
8
|
+
append_cflags("-fvisibility=hidden")
|
9
|
+
|
10
|
+
create_makefile(<%= config[:makefile_path].inspect %>)
|