rubygems-update 3.5.22 → 3.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +91 -0
- data/Manifest.txt +23 -16
- data/README.md +14 -9
- data/bundler/CHANGELOG.md +83 -0
- data/bundler/bundler.gemspec +2 -2
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli/add.rb +2 -0
- data/bundler/lib/bundler/cli/check.rb +2 -2
- data/bundler/lib/bundler/cli/console.rb +0 -4
- data/bundler/lib/bundler/cli/doctor.rb +4 -4
- data/bundler/lib/bundler/cli/exec.rb +1 -0
- data/bundler/lib/bundler/cli/gem.rb +1 -1
- data/bundler/lib/bundler/cli/info.rb +2 -2
- data/bundler/lib/bundler/cli/inject.rb +1 -1
- data/bundler/lib/bundler/cli/install.rb +4 -0
- data/bundler/lib/bundler/cli/lock.rb +20 -1
- data/bundler/lib/bundler/cli/pristine.rb +1 -1
- data/bundler/lib/bundler/cli/show.rb +2 -2
- data/bundler/lib/bundler/cli.rb +23 -53
- data/bundler/lib/bundler/compact_index_client/cache_file.rb +0 -5
- data/bundler/lib/bundler/compact_index_client/updater.rb +0 -11
- data/bundler/lib/bundler/definition.rb +143 -76
- data/bundler/lib/bundler/dependency.rb +1 -1
- data/bundler/lib/bundler/dsl.rb +33 -28
- data/bundler/lib/bundler/endpoint_specification.rb +10 -1
- data/bundler/lib/bundler/errors.rb +10 -0
- data/bundler/lib/bundler/feature_flag.rb +1 -0
- data/bundler/lib/bundler/fetcher/compact_index.rb +1 -1
- data/bundler/lib/bundler/fetcher.rb +10 -3
- data/bundler/lib/bundler/gem_helpers.rb +21 -5
- data/bundler/lib/bundler/injector.rb +2 -2
- data/bundler/lib/bundler/inline.rb +12 -8
- data/bundler/lib/bundler/installer/standalone.rb +2 -2
- data/bundler/lib/bundler/installer.rb +4 -38
- data/bundler/lib/bundler/lazy_specification.rb +74 -26
- data/bundler/lib/bundler/lockfile_generator.rb +1 -1
- data/bundler/lib/bundler/lockfile_parser.rb +9 -1
- data/bundler/lib/bundler/man/bundle-add.1 +17 -11
- data/bundler/lib/bundler/man/bundle-add.1.ronn +16 -10
- data/bundler/lib/bundler/man/bundle-binstubs.1 +7 -4
- data/bundler/lib/bundler/man/bundle-binstubs.1.ronn +6 -3
- data/bundler/lib/bundler/man/bundle-cache.1 +30 -2
- data/bundler/lib/bundler/man/bundle-cache.1.ronn +31 -2
- data/bundler/lib/bundler/man/bundle-check.1 +3 -3
- data/bundler/lib/bundler/man/bundle-check.1.ronn +4 -2
- data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
- data/bundler/lib/bundler/man/bundle-config.1 +3 -5
- data/bundler/lib/bundler/man/bundle-config.1.ronn +2 -7
- data/bundler/lib/bundler/man/bundle-console.1 +2 -4
- data/bundler/lib/bundler/man/bundle-console.1.ronn +2 -7
- data/bundler/lib/bundler/man/bundle-doctor.1 +2 -2
- data/bundler/lib/bundler/man/bundle-doctor.1.ronn +1 -1
- data/bundler/lib/bundler/man/bundle-env.1 +9 -0
- data/bundler/lib/bundler/man/bundle-env.1.ronn +10 -0
- data/bundler/lib/bundler/man/bundle-exec.1 +5 -2
- data/bundler/lib/bundler/man/bundle-exec.1.ronn +4 -1
- data/bundler/lib/bundler/man/bundle-fund.1 +22 -0
- data/bundler/lib/bundler/man/bundle-fund.1.ronn +25 -0
- data/bundler/lib/bundler/man/bundle-gem.1 +17 -5
- data/bundler/lib/bundler/man/bundle-gem.1.ronn +27 -6
- data/bundler/lib/bundler/man/bundle-help.1 +1 -1
- data/bundler/lib/bundler/man/bundle-info.1 +5 -2
- data/bundler/lib/bundler/man/bundle-info.1.ronn +6 -2
- data/bundler/lib/bundler/man/bundle-init.1 +3 -3
- data/bundler/lib/bundler/man/bundle-init.1.ronn +3 -2
- data/bundler/lib/bundler/man/bundle-inject.1 +10 -2
- data/bundler/lib/bundler/man/bundle-inject.1.ronn +9 -1
- data/bundler/lib/bundler/man/bundle-install.1 +15 -12
- data/bundler/lib/bundler/man/bundle-install.1.ronn +22 -18
- data/bundler/lib/bundler/man/bundle-issue.1 +45 -0
- data/bundler/lib/bundler/man/bundle-issue.1.ronn +37 -0
- data/bundler/lib/bundler/man/bundle-licenses.1 +9 -0
- data/bundler/lib/bundler/man/bundle-licenses.1.ronn +10 -0
- data/bundler/lib/bundler/man/bundle-list.1 +1 -1
- data/bundler/lib/bundler/man/bundle-list.1.ronn +4 -1
- data/bundler/lib/bundler/man/bundle-lock.1 +21 -6
- data/bundler/lib/bundler/man/bundle-lock.1.ronn +25 -4
- data/bundler/lib/bundler/man/bundle-open.1 +2 -2
- data/bundler/lib/bundler/man/bundle-open.1.ronn +2 -1
- data/bundler/lib/bundler/man/bundle-outdated.1 +8 -5
- data/bundler/lib/bundler/man/bundle-outdated.1.ronn +8 -4
- data/bundler/lib/bundler/man/bundle-platform.1 +1 -1
- data/bundler/lib/bundler/man/bundle-plugin.1 +1 -1
- data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
- data/bundler/lib/bundler/man/bundle-pristine.1.ronn +1 -1
- data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
- data/bundler/lib/bundler/man/bundle-remove.1.ronn +1 -1
- data/bundler/lib/bundler/man/bundle-show.1 +5 -2
- data/bundler/lib/bundler/man/bundle-show.1.ronn +4 -0
- data/bundler/lib/bundler/man/bundle-update.1 +13 -7
- data/bundler/lib/bundler/man/bundle-update.1.ronn +14 -6
- data/bundler/lib/bundler/man/bundle-version.1 +1 -1
- data/bundler/lib/bundler/man/bundle-viz.1 +4 -4
- data/bundler/lib/bundler/man/bundle-viz.1.ronn +7 -3
- data/bundler/lib/bundler/man/bundle.1 +1 -1
- data/bundler/lib/bundler/man/gemfile.5 +1 -1
- data/bundler/lib/bundler/man/index.txt +4 -0
- data/bundler/lib/bundler/materialization.rb +59 -0
- data/bundler/lib/bundler/plugin/events.rb +24 -0
- data/bundler/lib/bundler/plugin/installer.rb +1 -1
- data/bundler/lib/bundler/plugin.rb +20 -1
- data/bundler/lib/bundler/process_lock.rb +10 -14
- data/bundler/lib/bundler/remote_specification.rb +6 -1
- data/bundler/lib/bundler/resolver/base.rb +6 -6
- data/bundler/lib/bundler/resolver/candidate.rb +2 -2
- data/bundler/lib/bundler/resolver/spec_group.rb +4 -3
- data/bundler/lib/bundler/resolver.rb +5 -5
- data/bundler/lib/bundler/rubygems_ext.rb +30 -27
- data/bundler/lib/bundler/rubygems_gem_installer.rb +3 -2
- data/bundler/lib/bundler/rubygems_integration.rb +23 -40
- data/bundler/lib/bundler/runtime.rb +27 -7
- data/bundler/lib/bundler/self_manager.rb +2 -3
- data/bundler/lib/bundler/settings.rb +6 -1
- data/bundler/lib/bundler/shared_helpers.rb +29 -17
- data/bundler/lib/bundler/source/git/git_proxy.rb +0 -6
- data/bundler/lib/bundler/source/git.rb +56 -31
- data/bundler/lib/bundler/source/metadata.rb +2 -3
- data/bundler/lib/bundler/source/path.rb +2 -2
- data/bundler/lib/bundler/source_list.rb +1 -1
- data/bundler/lib/bundler/spec_set.rb +81 -56
- data/bundler/lib/bundler/stub_specification.rb +8 -0
- data/bundler/lib/bundler/templates/newgem/Gemfile.tt +0 -3
- data/bundler/lib/bundler/templates/newgem/README.md.tt +1 -1
- data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +15 -15
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +4 -4
- data/bundler/lib/bundler/uri_credentials_filter.rb +1 -1
- data/bundler/lib/bundler/vendor/fileutils/COPYING +56 -0
- data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +15 -13
- data/bundler/lib/bundler/vendor/securerandom/COPYING +56 -0
- data/bundler/lib/bundler/vendor/securerandom/lib/securerandom.rb +5 -5
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +3 -5
- data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +11 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +1 -4
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +2 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +2 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +9 -9
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb +5 -21
- data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor.rb +11 -0
- data/bundler/lib/bundler/vendor/uri/COPYING +56 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +37 -16
- data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +3 -3
- data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +16 -26
- data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +2 -2
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +10 -3
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +26 -3
- data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri.rb +9 -9
- data/bundler/lib/bundler/vendored_securerandom.rb +0 -2
- data/bundler/lib/bundler/version.rb +1 -1
- data/bundler/lib/bundler.rb +38 -14
- data/{CONTRIBUTING.md → doc/rubygems/CONTRIBUTING.md} +9 -9
- data/{POLICIES.md → doc/rubygems/POLICIES.md} +11 -11
- data/lib/rubygems/basic_specification.rb +5 -4
- data/lib/rubygems/commands/cleanup_command.rb +2 -2
- data/lib/rubygems/commands/contents_command.rb +4 -4
- data/lib/rubygems/commands/exec_command.rb +3 -0
- data/lib/rubygems/commands/pristine_command.rb +2 -2
- data/lib/rubygems/commands/push_command.rb +29 -5
- data/lib/rubygems/commands/rdoc_command.rb +2 -2
- data/lib/rubygems/commands/rebuild_command.rb +0 -2
- data/lib/rubygems/commands/setup_command.rb +7 -16
- data/lib/rubygems/commands/unpack_command.rb +0 -6
- data/lib/rubygems/commands/update_command.rb +2 -8
- data/lib/rubygems/config_file.rb +12 -0
- data/lib/rubygems/core_ext/kernel_warn.rb +2 -6
- data/lib/rubygems/defaults.rb +1 -1
- data/lib/rubygems/exceptions.rb +0 -6
- data/lib/rubygems/ext/builder.rb +6 -4
- data/lib/rubygems/ext/cargo_builder.rb +7 -4
- data/lib/rubygems/ext/cmake_builder.rb +7 -2
- data/lib/rubygems/ext/configure_builder.rb +7 -2
- data/lib/rubygems/ext/ext_conf_builder.rb +9 -5
- data/lib/rubygems/ext/rake_builder.rb +6 -1
- data/lib/rubygems/gem_runner.rb +9 -0
- data/lib/rubygems/gemcutter_utilities.rb +8 -2
- data/lib/rubygems/install_update_options.rb +5 -0
- data/lib/rubygems/installer.rb +8 -9
- data/lib/rubygems/package/tar_header.rb +11 -0
- data/lib/rubygems/package/tar_reader/entry.rb +1 -5
- data/lib/rubygems/platform.rb +4 -3
- data/lib/rubygems/psych_tree.rb +4 -0
- data/lib/rubygems/request_set/gem_dependency_api.rb +1 -1
- data/lib/rubygems/requirement.rb +0 -4
- data/lib/rubygems/resolver/composed_set.rb +3 -3
- data/lib/rubygems/resolver/git_set.rb +0 -1
- data/lib/rubygems/resolver/index_set.rb +2 -2
- data/lib/rubygems/resolver.rb +3 -3
- data/lib/rubygems/source/git.rb +13 -10
- data/lib/rubygems/spec_fetcher.rb +46 -7
- data/lib/rubygems/specification.rb +38 -32
- data/lib/rubygems/target_rbconfig.rb +50 -0
- data/lib/rubygems/uri.rb +1 -1
- data/lib/rubygems/util/licenses.rb +10 -1
- data/lib/rubygems/vendor/net-http/COPYING +56 -0
- data/lib/rubygems/vendor/net-http/lib/net/http/header.rb +1 -1
- data/lib/rubygems/vendor/net-http/lib/net/http/requests.rb +5 -0
- data/lib/rubygems/vendor/net-http/lib/net/http.rb +120 -36
- data/lib/rubygems/vendor/optparse/lib/optparse/ac.rb +16 -0
- data/lib/rubygems/vendor/optparse/lib/optparse/kwargs.rb +8 -3
- data/lib/rubygems/vendor/optparse/lib/optparse/version.rb +9 -0
- data/lib/rubygems/vendor/optparse/lib/optparse.rb +147 -51
- data/lib/rubygems/vendor/resolv/COPYING +56 -0
- data/lib/rubygems/vendor/resolv/lib/resolv.rb +50 -37
- data/lib/rubygems/vendor/securerandom/COPYING +56 -0
- data/lib/rubygems/vendor/securerandom/lib/securerandom.rb +5 -5
- data/lib/rubygems/vendor/timeout/COPYING +56 -0
- data/lib/rubygems/vendor/timeout/lib/timeout.rb +5 -8
- data/lib/rubygems/vendor/uri/COPYING +56 -0
- data/lib/rubygems/vendor/uri/lib/uri/common.rb +37 -16
- data/lib/rubygems/vendor/uri/lib/uri/file.rb +3 -3
- data/lib/rubygems/vendor/uri/lib/uri/ftp.rb +1 -1
- data/lib/rubygems/vendor/uri/lib/uri/generic.rb +16 -26
- data/lib/rubygems/vendor/uri/lib/uri/http.rb +2 -2
- data/lib/rubygems/vendor/uri/lib/uri/rfc2396_parser.rb +10 -3
- data/lib/rubygems/vendor/uri/lib/uri/rfc3986_parser.rb +26 -3
- data/lib/rubygems/vendor/uri/lib/uri/version.rb +1 -1
- data/lib/rubygems/vendor/uri/lib/uri.rb +9 -9
- data/lib/rubygems/vendored_securerandom.rb +0 -1
- data/lib/rubygems/version.rb +0 -4
- data/lib/rubygems.rb +30 -20
- data/rubygems-update.gemspec +5 -5
- data/setup.rb +1 -1
- metadata +36 -27
- data/bundler/lib/bundler/vendor/fileutils/LICENSE.txt +0 -22
- data/bundler/lib/bundler/vendor/securerandom/LICENSE.txt +0 -22
- data/bundler/lib/bundler/vendor/securerandom/lib/random/formatter.rb +0 -373
- data/bundler/lib/bundler/vendor/uri/LICENSE.txt +0 -22
- data/lib/rubygems/vendor/net-http/LICENSE.txt +0 -22
- data/lib/rubygems/vendor/net-http/lib/net/http/backward.rb +0 -40
- data/lib/rubygems/vendor/resolv/LICENSE.txt +0 -22
- data/lib/rubygems/vendor/securerandom/LICENSE.txt +0 -22
- data/lib/rubygems/vendor/securerandom/lib/random/formatter.rb +0 -373
- data/lib/rubygems/vendor/timeout/LICENSE.txt +0 -22
- data/lib/rubygems/vendor/uri/LICENSE.txt +0 -22
- /data/{MAINTAINERS.txt → doc/MAINTAINERS.txt} +0 -0
- /data/{bundler → doc/bundler}/UPGRADING.md +0 -0
- /data/{UPGRADING.md → doc/rubygems/UPGRADING.md} +0 -0
data/bundler/lib/bundler/dsl.rb
CHANGED
@@ -66,7 +66,7 @@ module Bundler
|
|
66
66
|
development_group = opts[:development_group] || :development
|
67
67
|
expanded_path = gemfile_root.join(path)
|
68
68
|
|
69
|
-
gemspecs = Gem::Util.glob_files_in_dir("{,*}.gemspec", expanded_path).
|
69
|
+
gemspecs = Gem::Util.glob_files_in_dir("{,*}.gemspec", expanded_path).filter_map {|g| Bundler.load_gemspec(g) }
|
70
70
|
gemspecs.reject! {|s| s.name != name } if name
|
71
71
|
specs_by_name_and_version = gemspecs.group_by {|s| [s.name, s.version] }
|
72
72
|
|
@@ -110,9 +110,23 @@ module Bundler
|
|
110
110
|
if gemspec_dep
|
111
111
|
gemfile_dep = [dep, current].find(&:runtime?)
|
112
112
|
|
113
|
-
|
113
|
+
if gemfile_dep && !current_requirement_open
|
114
114
|
Bundler.ui.warn "A gemspec development dependency (#{gemspec_dep.name}, #{gemspec_dep.requirement}) is being overridden by a Gemfile dependency (#{gemfile_dep.name}, #{gemfile_dep.requirement}).\n" \
|
115
115
|
"This behaviour may change in the future. Please remove either of them, or make sure they both have the same requirement\n"
|
116
|
+
elsif gemfile_dep.nil?
|
117
|
+
require_relative "vendor/pub_grub/lib/pub_grub/version_range"
|
118
|
+
require_relative "vendor/pub_grub/lib/pub_grub/version_constraint"
|
119
|
+
require_relative "vendor/pub_grub/lib/pub_grub/version_union"
|
120
|
+
require_relative "vendor/pub_grub/lib/pub_grub/rubygems"
|
121
|
+
|
122
|
+
current_gemspec_range = PubGrub::RubyGems.requirement_to_range(current.requirement)
|
123
|
+
next_gemspec_range = PubGrub::RubyGems.requirement_to_range(dep.requirement)
|
124
|
+
|
125
|
+
if current_gemspec_range.intersects?(next_gemspec_range)
|
126
|
+
dep = Dependency.new(name, current.requirement.as_list + dep.requirement.as_list, options)
|
127
|
+
else
|
128
|
+
raise GemfileError, "Two gemspecs have conflicting requirements on the same gem: #{dep} and #{current}"
|
129
|
+
end
|
116
130
|
end
|
117
131
|
else
|
118
132
|
update_prompt = ""
|
@@ -133,20 +147,22 @@ module Bundler
|
|
133
147
|
end
|
134
148
|
end
|
135
149
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
+
unless current.gemspec_dev_dep? && dep.gemspec_dev_dep?
|
151
|
+
# Always prefer the dependency from the Gemfile
|
152
|
+
if current.gemspec_dev_dep?
|
153
|
+
@dependencies.delete(current)
|
154
|
+
elsif dep.gemspec_dev_dep?
|
155
|
+
return
|
156
|
+
elsif current.source != dep.source
|
157
|
+
raise GemfileError, "You cannot specify the same gem twice coming from different sources.\n" \
|
158
|
+
"You specified that #{dep.name} (#{dep.requirement}) should come from " \
|
159
|
+
"#{current.source || "an unspecified source"} and #{dep.source}\n"
|
160
|
+
else
|
161
|
+
Bundler.ui.warn "Your Gemfile lists the gem #{current.name} (#{current.requirement}) more than once.\n" \
|
162
|
+
"You should probably keep only one of them.\n" \
|
163
|
+
"Remove any duplicate entries and specify the gem only once.\n" \
|
164
|
+
"While it's not a problem now, it could cause errors if you change the version of one of them later."
|
165
|
+
end
|
150
166
|
end
|
151
167
|
end
|
152
168
|
|
@@ -487,18 +503,7 @@ module Bundler
|
|
487
503
|
end
|
488
504
|
|
489
505
|
def check_rubygems_source_safety
|
490
|
-
if @sources.
|
491
|
-
implicit_global_source_warning
|
492
|
-
elsif @sources.aggregate_global_source?
|
493
|
-
multiple_global_source_warning
|
494
|
-
end
|
495
|
-
end
|
496
|
-
|
497
|
-
def implicit_global_source_warning
|
498
|
-
Bundler::SharedHelpers.major_deprecation 2, "This Gemfile does not include an explicit global source. " \
|
499
|
-
"Not using an explicit global source may result in a different lockfile being generated depending on " \
|
500
|
-
"the gems you have installed locally before bundler is run. " \
|
501
|
-
"Instead, define a global source in your Gemfile like this: source \"https://rubygems.org\"."
|
506
|
+
multiple_global_source_warning if @sources.aggregate_global_source?
|
502
507
|
end
|
503
508
|
|
504
509
|
def multiple_global_source_warning
|
@@ -6,7 +6,7 @@ module Bundler
|
|
6
6
|
include MatchRemoteMetadata
|
7
7
|
|
8
8
|
attr_reader :name, :version, :platform, :checksum
|
9
|
-
attr_accessor :
|
9
|
+
attr_accessor :remote, :dependencies, :locked_platform
|
10
10
|
|
11
11
|
def initialize(name, version, platform, spec_fetcher, dependencies, metadata = nil)
|
12
12
|
super()
|
@@ -18,10 +18,15 @@ module Bundler
|
|
18
18
|
|
19
19
|
@loaded_from = nil
|
20
20
|
@remote_specification = nil
|
21
|
+
@locked_platform = nil
|
21
22
|
|
22
23
|
parse_metadata(metadata)
|
23
24
|
end
|
24
25
|
|
26
|
+
def insecurely_materialized?
|
27
|
+
@locked_platform.to_s != @platform.to_s
|
28
|
+
end
|
29
|
+
|
25
30
|
def fetch_platform
|
26
31
|
@platform
|
27
32
|
end
|
@@ -115,6 +120,10 @@ module Bundler
|
|
115
120
|
@remote_specification = spec
|
116
121
|
end
|
117
122
|
|
123
|
+
def inspect
|
124
|
+
"#<#{self.class} @name=\"#{name}\" (#{full_name.delete_prefix("#{name}-")})>"
|
125
|
+
end
|
126
|
+
|
118
127
|
private
|
119
128
|
|
120
129
|
def _remote_specification
|
@@ -246,4 +246,14 @@ module Bundler
|
|
246
246
|
end
|
247
247
|
|
248
248
|
class InvalidArgumentError < BundlerError; status_code(40); end
|
249
|
+
|
250
|
+
class IncorrectLockfileDependencies < BundlerError
|
251
|
+
attr_reader :spec
|
252
|
+
|
253
|
+
def initialize(spec)
|
254
|
+
@spec = spec
|
255
|
+
end
|
256
|
+
|
257
|
+
status_code(41)
|
258
|
+
end
|
249
259
|
end
|
@@ -33,6 +33,7 @@ module Bundler
|
|
33
33
|
settings_flag(:default_install_uses_path) { bundler_3_mode? }
|
34
34
|
settings_flag(:forget_cli_options) { bundler_3_mode? }
|
35
35
|
settings_flag(:global_gem_cache) { bundler_3_mode? }
|
36
|
+
settings_flag(:lockfile_checksums) { bundler_3_mode? }
|
36
37
|
settings_flag(:path_relative_to_cwd) { bundler_3_mode? }
|
37
38
|
settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") }
|
38
39
|
settings_flag(:print_only_version_number) { bundler_3_mode? }
|
@@ -10,7 +10,7 @@ module Bundler
|
|
10
10
|
method = instance_method(method_name)
|
11
11
|
undef_method(method_name)
|
12
12
|
define_method(method_name) do |*args, &blk|
|
13
|
-
method.
|
13
|
+
method.bind_call(self, *args, &blk)
|
14
14
|
rescue NetworkDownError, CompactIndexClient::Updater::MismatchedChecksumError => e
|
15
15
|
raise HTTPError, e.message
|
16
16
|
rescue AuthenticationRequiredError, BadAuthenticationError
|
@@ -37,8 +37,9 @@ module Bundler
|
|
37
37
|
# This is the error raised when a source is HTTPS and OpenSSL didn't load
|
38
38
|
class SSLError < HTTPError
|
39
39
|
def initialize(msg = nil)
|
40
|
-
super
|
41
|
-
|
40
|
+
super "Could not load OpenSSL.\n" \
|
41
|
+
"You must recompile Ruby with OpenSSL support.\n" \
|
42
|
+
"original error: #{msg}\n"
|
42
43
|
end
|
43
44
|
end
|
44
45
|
|
@@ -251,7 +252,13 @@ module Bundler
|
|
251
252
|
needs_ssl = remote_uri.scheme == "https" ||
|
252
253
|
Bundler.settings[:ssl_verify_mode] ||
|
253
254
|
Bundler.settings[:ssl_client_cert]
|
254
|
-
|
255
|
+
if needs_ssl
|
256
|
+
begin
|
257
|
+
require "openssl"
|
258
|
+
rescue StandardError, LoadError => e
|
259
|
+
raise SSLError.new(e.message)
|
260
|
+
end
|
261
|
+
end
|
255
262
|
|
256
263
|
con = Gem::Net::HTTP::Persistent.new name: "bundler", proxy: :ENV
|
257
264
|
if gem_proxy = Gem.configuration[:http_proxy]
|
@@ -46,7 +46,7 @@ module Bundler
|
|
46
46
|
end
|
47
47
|
module_function :platform_specificity_match
|
48
48
|
|
49
|
-
def
|
49
|
+
def select_all_platform_match(specs, platform, force_ruby: false, prefer_locked: false)
|
50
50
|
matching = if force_ruby
|
51
51
|
specs.select {|spec| spec.match_platform(Gem::Platform::RUBY) && spec.force_ruby_platform! }
|
52
52
|
else
|
@@ -58,24 +58,40 @@ module Bundler
|
|
58
58
|
return locked_originally if locked_originally.any?
|
59
59
|
end
|
60
60
|
|
61
|
-
|
61
|
+
matching
|
62
|
+
end
|
63
|
+
module_function :select_all_platform_match
|
64
|
+
|
65
|
+
def select_best_platform_match(specs, platform, force_ruby: false, prefer_locked: false)
|
66
|
+
matching = select_all_platform_match(specs, platform, force_ruby: force_ruby, prefer_locked: prefer_locked)
|
67
|
+
|
68
|
+
sort_and_filter_best_platform_match(matching, platform)
|
62
69
|
end
|
63
70
|
module_function :select_best_platform_match
|
64
71
|
|
65
72
|
def select_best_local_platform_match(specs, force_ruby: false)
|
66
|
-
|
73
|
+
matching = select_all_platform_match(specs, local_platform, force_ruby: force_ruby).filter_map(&:materialized_for_installation)
|
74
|
+
|
75
|
+
sort_best_platform_match(matching, local_platform)
|
67
76
|
end
|
68
77
|
module_function :select_best_local_platform_match
|
69
78
|
|
70
|
-
def
|
79
|
+
def sort_and_filter_best_platform_match(matching, platform)
|
80
|
+
return matching if matching.one?
|
81
|
+
|
71
82
|
exact = matching.select {|spec| spec.platform == platform }
|
72
83
|
return exact if exact.any?
|
73
84
|
|
74
|
-
sorted_matching = matching
|
85
|
+
sorted_matching = sort_best_platform_match(matching, platform)
|
75
86
|
exemplary_spec = sorted_matching.first
|
76
87
|
|
77
88
|
sorted_matching.take_while {|spec| same_specificity(platform, spec, exemplary_spec) && same_deps(spec, exemplary_spec) }
|
78
89
|
end
|
90
|
+
module_function :sort_and_filter_best_platform_match
|
91
|
+
|
92
|
+
def sort_best_platform_match(matching, platform)
|
93
|
+
matching.sort_by {|spec| platform_specificity_match(spec.platform, platform) }
|
94
|
+
end
|
79
95
|
module_function :sort_best_platform_match
|
80
96
|
|
81
97
|
class PlatformMatch
|
@@ -41,7 +41,7 @@ module Bundler
|
|
41
41
|
|
42
42
|
# resolve to see if the new deps broke anything
|
43
43
|
@definition = builder.to_definition(lockfile_path, {})
|
44
|
-
@definition.
|
44
|
+
@definition.remotely!
|
45
45
|
|
46
46
|
# since nothing broke, we can add those gems to the gemfile
|
47
47
|
append_to(gemfile_path, build_gem_lines(@options[:conservative_versioning])) if @deps.any?
|
@@ -184,7 +184,7 @@ module Bundler
|
|
184
184
|
# @param [Array] gems Array of names of gems to be removed.
|
185
185
|
# @param [Pathname] gemfile_path The Gemfile from which to remove dependencies.
|
186
186
|
def remove_gems_from_gemfile(gems, gemfile_path)
|
187
|
-
patterns = /gem\s+(['"])#{Regexp.union(gems)}\1|gem\s*\((['"])#{Regexp.union(gems)}\2
|
187
|
+
patterns = /gem\s+(['"])#{Regexp.union(gems)}\1|gem\s*\((['"])#{Regexp.union(gems)}\2.*\)/
|
188
188
|
new_gemfile = []
|
189
189
|
multiline_removal = false
|
190
190
|
File.readlines(gemfile_path).each do |line|
|
@@ -1,16 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Allows for declaring a Gemfile inline in a ruby script,
|
4
|
-
#
|
3
|
+
# Allows for declaring a Gemfile inline in a ruby script, installing any gems
|
4
|
+
# that aren't already installed on the user's system.
|
5
5
|
#
|
6
6
|
# @note Every gem that is specified in this 'Gemfile' will be `require`d, as if
|
7
7
|
# the user had manually called `Bundler.require`. To avoid a requested gem
|
8
8
|
# being automatically required, add the `:require => false` option to the
|
9
9
|
# `gem` dependency declaration.
|
10
10
|
#
|
11
|
-
# @param
|
12
|
-
#
|
13
|
-
#
|
11
|
+
# @param force_latest_compatible [Boolean] Force installing the *latest*
|
12
|
+
# compatible versions of the gems,
|
13
|
+
# even if compatible versions are
|
14
|
+
# already installed locally.
|
15
|
+
# This also logs output if the
|
16
|
+
# `:quiet` option is not set.
|
17
|
+
# Defaults to `false`.
|
14
18
|
#
|
15
19
|
# @param gemfile [Proc] a block that is evaluated as a `Gemfile`.
|
16
20
|
#
|
@@ -29,13 +33,13 @@
|
|
29
33
|
#
|
30
34
|
# puts Pod::VERSION # => "0.34.4"
|
31
35
|
#
|
32
|
-
def gemfile(
|
36
|
+
def gemfile(force_latest_compatible = false, options = {}, &gemfile)
|
33
37
|
require_relative "../bundler"
|
34
38
|
Bundler.reset!
|
35
39
|
|
36
40
|
opts = options.dup
|
37
41
|
ui = opts.delete(:ui) { Bundler::UI::Shell.new }
|
38
|
-
ui.level = "silent" if opts.delete(:quiet) || !
|
42
|
+
ui.level = "silent" if opts.delete(:quiet) || !force_latest_compatible
|
39
43
|
Bundler.ui = ui
|
40
44
|
raise ArgumentError, "Unknown options: #{opts.keys.join(", ")}" unless opts.empty?
|
41
45
|
|
@@ -55,7 +59,7 @@ def gemfile(install = false, options = {}, &gemfile)
|
|
55
59
|
definition = builder.to_definition(nil, true)
|
56
60
|
definition.validate_runtime!
|
57
61
|
|
58
|
-
if
|
62
|
+
if force_latest_compatible || definition.missing_specs?
|
59
63
|
Bundler.settings.temporary(inline: true, no_install: false) do
|
60
64
|
installer = Bundler::Installer.install(Bundler.root, definition, system: true)
|
61
65
|
installer.post_install_messages.each do |name, message|
|
@@ -28,7 +28,7 @@ module Bundler
|
|
28
28
|
private
|
29
29
|
|
30
30
|
def paths
|
31
|
-
@specs.
|
31
|
+
@specs.flat_map do |spec|
|
32
32
|
next if spec.name == "bundler"
|
33
33
|
Array(spec.require_paths).map do |path|
|
34
34
|
gem_path(path, spec).
|
@@ -36,7 +36,7 @@ module Bundler
|
|
36
36
|
sub(extensions_dir, 'extensions/\k<platform>/#{Gem.extension_api_version}')
|
37
37
|
# This is a static string intentionally. It's interpolated at a later time.
|
38
38
|
end
|
39
|
-
end.
|
39
|
+
end.compact
|
40
40
|
end
|
41
41
|
|
42
42
|
def version_dir
|
@@ -77,12 +77,9 @@ module Bundler
|
|
77
77
|
return
|
78
78
|
end
|
79
79
|
|
80
|
-
if
|
80
|
+
if @definition.setup_domain!(options)
|
81
81
|
ensure_specs_are_compatible!
|
82
|
-
load_plugins
|
83
|
-
options.delete(:jobs)
|
84
|
-
else
|
85
|
-
options[:jobs] = 1 # to avoid the overhead of Bundler::Worker
|
82
|
+
Bundler.load_plugins(@definition)
|
86
83
|
end
|
87
84
|
install(options)
|
88
85
|
|
@@ -197,18 +194,14 @@ module Bundler
|
|
197
194
|
standalone = options[:standalone]
|
198
195
|
force = options[:force]
|
199
196
|
local = options[:local]
|
200
|
-
jobs = installation_parallelization
|
197
|
+
jobs = installation_parallelization
|
201
198
|
spec_installations = ParallelInstaller.call(self, @definition.specs, jobs, standalone, force, local: local)
|
202
199
|
spec_installations.each do |installation|
|
203
200
|
post_install_messages[installation.name] = installation.post_install_message if installation.has_post_install_message?
|
204
201
|
end
|
205
202
|
end
|
206
203
|
|
207
|
-
def installation_parallelization
|
208
|
-
if jobs = options.delete(:jobs)
|
209
|
-
return jobs
|
210
|
-
end
|
211
|
-
|
204
|
+
def installation_parallelization
|
212
205
|
if jobs = Bundler.settings[:jobs]
|
213
206
|
return jobs
|
214
207
|
end
|
@@ -216,20 +209,6 @@ module Bundler
|
|
216
209
|
Bundler.settings.processor_count
|
217
210
|
end
|
218
211
|
|
219
|
-
def load_plugins
|
220
|
-
Gem.load_plugins
|
221
|
-
|
222
|
-
requested_path_gems = @definition.requested_specs.select {|s| s.source.is_a?(Source::Path) }
|
223
|
-
path_plugin_files = requested_path_gems.map do |spec|
|
224
|
-
spec.matches_for_glob("rubygems_plugin#{Bundler.rubygems.suffix_pattern}")
|
225
|
-
rescue TypeError
|
226
|
-
error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
|
227
|
-
raise Gem::InvalidSpecificationException, error_message
|
228
|
-
end.flatten
|
229
|
-
Gem.load_plugin_files(path_plugin_files)
|
230
|
-
Gem.load_env_plugins
|
231
|
-
end
|
232
|
-
|
233
212
|
def ensure_specs_are_compatible!
|
234
213
|
@definition.specs.each do |spec|
|
235
214
|
unless spec.matches_current_ruby?
|
@@ -243,19 +222,6 @@ module Bundler
|
|
243
222
|
end
|
244
223
|
end
|
245
224
|
|
246
|
-
# returns whether or not a re-resolve was needed
|
247
|
-
def resolve_if_needed(options)
|
248
|
-
@definition.prefer_local! if options[:"prefer-local"]
|
249
|
-
|
250
|
-
if options[:local] || (@definition.no_resolve_needed? && !@definition.missing_specs?)
|
251
|
-
@definition.resolve_with_cache!
|
252
|
-
false
|
253
|
-
else
|
254
|
-
@definition.resolve_remotely!
|
255
|
-
true
|
256
|
-
end
|
257
|
-
end
|
258
|
-
|
259
225
|
def lock
|
260
226
|
@definition.lock
|
261
227
|
end
|
@@ -8,14 +8,26 @@ module Bundler
|
|
8
8
|
include MatchPlatform
|
9
9
|
include ForcePlatform
|
10
10
|
|
11
|
-
attr_reader :name, :version, :platform
|
11
|
+
attr_reader :name, :version, :platform, :materialization
|
12
12
|
attr_accessor :source, :remote, :force_ruby_platform, :dependencies, :required_ruby_version, :required_rubygems_version
|
13
13
|
|
14
|
+
#
|
15
|
+
# For backwards compatibility with existing lockfiles, if the most specific
|
16
|
+
# locked platform is not a specific platform like x86_64-linux or
|
17
|
+
# universal-java-11, then we keep the previous behaviour of resolving the
|
18
|
+
# best platform variant at materiliazation time. For previous bundler
|
19
|
+
# versions (before 2.2.0) this was always the case (except when the lockfile
|
20
|
+
# only included non-ruby platforms), but we're also keeping this behaviour
|
21
|
+
# on newer bundlers unless users generate the lockfile from scratch or
|
22
|
+
# explicitly add a more specific platform.
|
23
|
+
#
|
24
|
+
attr_accessor :most_specific_locked_platform
|
25
|
+
|
14
26
|
alias_method :runtime_dependencies, :dependencies
|
15
27
|
|
16
28
|
def self.from_spec(s)
|
17
29
|
lazy_spec = new(s.name, s.version, s.platform, s.source)
|
18
|
-
lazy_spec.dependencies = s.
|
30
|
+
lazy_spec.dependencies = s.runtime_dependencies
|
19
31
|
lazy_spec.required_ruby_version = s.required_ruby_version
|
20
32
|
lazy_spec.required_rubygems_version = s.required_rubygems_version
|
21
33
|
lazy_spec
|
@@ -27,9 +39,26 @@ module Bundler
|
|
27
39
|
@dependencies = []
|
28
40
|
@required_ruby_version = Gem::Requirement.default
|
29
41
|
@required_rubygems_version = Gem::Requirement.default
|
30
|
-
@platform
|
31
|
-
|
42
|
+
@platform = platform || Gem::Platform::RUBY
|
43
|
+
|
44
|
+
@original_source = source
|
45
|
+
@source = source
|
46
|
+
|
32
47
|
@force_ruby_platform = default_force_ruby_platform
|
48
|
+
@most_specific_locked_platform = nil
|
49
|
+
@materialization = nil
|
50
|
+
end
|
51
|
+
|
52
|
+
def missing?
|
53
|
+
@materialization == self
|
54
|
+
end
|
55
|
+
|
56
|
+
def incomplete?
|
57
|
+
@materialization.nil?
|
58
|
+
end
|
59
|
+
|
60
|
+
def source_changed?
|
61
|
+
@original_source != source
|
33
62
|
end
|
34
63
|
|
35
64
|
def full_name
|
@@ -92,16 +121,31 @@ module Bundler
|
|
92
121
|
out
|
93
122
|
end
|
94
123
|
|
95
|
-
def
|
124
|
+
def materialize_strictly
|
96
125
|
source.local!
|
97
126
|
|
98
|
-
matching_specs = source.specs.search(
|
127
|
+
matching_specs = source.specs.search(self)
|
99
128
|
return self if matching_specs.empty?
|
100
129
|
|
101
|
-
|
102
|
-
|
130
|
+
__materialize__(matching_specs)
|
131
|
+
end
|
132
|
+
|
133
|
+
def materialized_for_installation
|
134
|
+
@materialization = materialize_for_installation
|
135
|
+
|
136
|
+
self unless incomplete?
|
137
|
+
end
|
138
|
+
|
139
|
+
def materialize_for_installation
|
140
|
+
source.local!
|
141
|
+
|
142
|
+
if use_exact_resolved_specifications?
|
143
|
+
materialize_strictly
|
103
144
|
else
|
104
|
-
|
145
|
+
matching_specs = source.specs.search([name, version])
|
146
|
+
return self if matching_specs.empty?
|
147
|
+
|
148
|
+
target_platform = source.is_a?(Source::Path) ? platform : local_platform
|
105
149
|
|
106
150
|
installable_candidates = GemHelpers.select_best_platform_match(matching_specs, target_platform)
|
107
151
|
|
@@ -112,10 +156,8 @@ module Bundler
|
|
112
156
|
installable_candidates = GemHelpers.select_best_platform_match(matching_specs, platform)
|
113
157
|
end
|
114
158
|
|
115
|
-
installable_candidates
|
159
|
+
__materialize__(installable_candidates)
|
116
160
|
end
|
117
|
-
|
118
|
-
__materialize__(candidates)
|
119
161
|
end
|
120
162
|
|
121
163
|
# If in frozen mode, we fallback to a non-installable candidate because by
|
@@ -129,12 +171,28 @@ module Bundler
|
|
129
171
|
end
|
130
172
|
if search.nil? && fallback_to_non_installable
|
131
173
|
search = candidates.last
|
132
|
-
|
133
|
-
|
174
|
+
elsif search && search.full_name == full_name
|
175
|
+
# We don't validate locally installed dependencies but accept what's in
|
176
|
+
# the lockfile instead for performance, since loading locally installed
|
177
|
+
# dependencies would mean evaluating all gemspecs, which would affect
|
178
|
+
# `bundler/setup` performance
|
179
|
+
if search.is_a?(StubSpecification)
|
180
|
+
search.dependencies = dependencies
|
181
|
+
else
|
182
|
+
if !source.is_a?(Source::Path) && search.runtime_dependencies.sort != dependencies.sort
|
183
|
+
raise IncorrectLockfileDependencies.new(self)
|
184
|
+
end
|
185
|
+
|
186
|
+
search.locked_platform = platform if search.instance_of?(RemoteSpecification) || search.instance_of?(EndpointSpecification)
|
187
|
+
end
|
134
188
|
end
|
135
189
|
search
|
136
190
|
end
|
137
191
|
|
192
|
+
def inspect
|
193
|
+
"#<#{self.class} @name=\"#{name}\" (#{full_name.delete_prefix("#{name}-")})>"
|
194
|
+
end
|
195
|
+
|
138
196
|
def to_s
|
139
197
|
lock_name
|
140
198
|
end
|
@@ -151,23 +209,13 @@ module Bundler
|
|
151
209
|
private
|
152
210
|
|
153
211
|
def use_exact_resolved_specifications?
|
154
|
-
|
212
|
+
!source.is_a?(Source::Path) && ruby_platform_materializes_to_ruby_platform?
|
155
213
|
end
|
156
214
|
|
157
|
-
#
|
158
|
-
# For backwards compatibility with existing lockfiles, if the most specific
|
159
|
-
# locked platform is not a specific platform like x86_64-linux or
|
160
|
-
# universal-java-11, then we keep the previous behaviour of resolving the
|
161
|
-
# best platform variant at materiliazation time. For previous bundler
|
162
|
-
# versions (before 2.2.0) this was always the case (except when the lockfile
|
163
|
-
# only included non-ruby platforms), but we're also keeping this behaviour
|
164
|
-
# on newer bundlers unless users generate the lockfile from scratch or
|
165
|
-
# explicitly add a more specific platform.
|
166
|
-
#
|
167
215
|
def ruby_platform_materializes_to_ruby_platform?
|
168
216
|
generic_platform = generic_local_platform == Gem::Platform::JAVA ? Gem::Platform::JAVA : Gem::Platform::RUBY
|
169
217
|
|
170
|
-
|
218
|
+
(most_specific_locked_platform != generic_platform) || force_ruby_platform || Bundler.settings[:force_ruby_platform]
|
171
219
|
end
|
172
220
|
end
|
173
221
|
end
|
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
module Bundler
|
4
4
|
class LockfileParser
|
5
|
+
include GemHelpers
|
6
|
+
|
5
7
|
class Position
|
6
8
|
attr_reader :line, :column
|
7
9
|
def initialize(line, column)
|
@@ -29,6 +31,7 @@ module Bundler
|
|
29
31
|
:dependencies,
|
30
32
|
:specs,
|
31
33
|
:platforms,
|
34
|
+
:most_specific_locked_platform,
|
32
35
|
:bundler_version,
|
33
36
|
:ruby_version,
|
34
37
|
:checksums,
|
@@ -136,7 +139,12 @@ module Bundler
|
|
136
139
|
end
|
137
140
|
@pos.advance!(line)
|
138
141
|
end
|
139
|
-
@
|
142
|
+
@most_specific_locked_platform = @platforms.min_by do |bundle_platform|
|
143
|
+
platform_specificity_match(bundle_platform, local_platform)
|
144
|
+
end
|
145
|
+
@specs = @specs.values.sort_by!(&:full_name).each do |spec|
|
146
|
+
spec.most_specific_locked_platform = @most_specific_locked_platform
|
147
|
+
end
|
140
148
|
rescue ArgumentError => e
|
141
149
|
Bundler.ui.debug(e)
|
142
150
|
raise LockfileError, "Your lockfile is unreadable. Run `rm #{@lockfile_path}` " \
|