rubygems-update 3.7.2 → 4.0.0.beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1431 -1323
- data/CODE_OF_CONDUCT.md +7 -129
- data/Manifest.txt +5 -11
- data/README.md +2 -2
- data/bundler/CHANGELOG.md +1011 -917
- data/bundler/README.md +4 -4
- data/bundler/bundler.gemspec +3 -3
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/capistrano.rb +1 -19
- data/bundler/lib/bundler/cli/cache.rb +1 -11
- data/bundler/lib/bundler/cli/common.rb +20 -3
- data/bundler/lib/bundler/cli/config.rb +1 -2
- data/bundler/lib/bundler/cli/console.rb +5 -0
- data/bundler/lib/bundler/cli/exec.rb +29 -4
- data/bundler/lib/bundler/cli/gem.rb +19 -33
- data/bundler/lib/bundler/cli/install.rb +9 -82
- data/bundler/lib/bundler/cli/issue.rb +2 -2
- data/bundler/lib/bundler/cli/list.rb +33 -2
- data/bundler/lib/bundler/cli/plugin.rb +5 -1
- data/bundler/lib/bundler/cli/show.rb +1 -1
- data/bundler/lib/bundler/cli/update.rb +3 -3
- data/bundler/lib/bundler/cli.rb +91 -85
- data/bundler/lib/bundler/compact_index_client.rb +0 -1
- data/bundler/lib/bundler/current_ruby.rb +3 -15
- data/bundler/lib/bundler/definition.rb +65 -36
- data/bundler/lib/bundler/deployment.rb +1 -64
- data/bundler/lib/bundler/digest.rb +1 -1
- data/bundler/lib/bundler/dsl.rb +26 -36
- data/bundler/lib/bundler/endpoint_specification.rb +0 -22
- data/bundler/lib/bundler/environment_preserver.rb +1 -0
- data/bundler/lib/bundler/errors.rb +1 -5
- data/bundler/lib/bundler/feature_flag.rb +0 -33
- data/bundler/lib/bundler/fetcher/compact_index.rb +1 -1
- data/bundler/lib/bundler/friendly_errors.rb +2 -2
- data/bundler/lib/bundler/index.rb +0 -7
- data/bundler/lib/bundler/inline.rb +9 -1
- data/bundler/lib/bundler/installer/gem_installer.rb +0 -11
- data/bundler/lib/bundler/installer.rb +0 -6
- data/bundler/lib/bundler/lockfile_generator.rb +1 -1
- data/bundler/lib/bundler/lockfile_parser.rb +2 -12
- data/bundler/lib/bundler/man/bundle-add.1 +1 -1
- data/bundler/lib/bundler/man/bundle-binstubs.1 +3 -6
- data/bundler/lib/bundler/man/bundle-binstubs.1.ronn +4 -6
- data/bundler/lib/bundler/man/bundle-cache.1 +2 -14
- data/bundler/lib/bundler/man/bundle-cache.1.ronn +1 -14
- data/bundler/lib/bundler/man/bundle-check.1 +2 -5
- data/bundler/lib/bundler/man/bundle-check.1.ronn +0 -5
- data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
- data/bundler/lib/bundler/man/bundle-config.1 +9 -33
- data/bundler/lib/bundler/man/bundle-config.1.ronn +24 -55
- data/bundler/lib/bundler/man/bundle-console.1 +1 -1
- data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
- data/bundler/lib/bundler/man/bundle-env.1 +1 -1
- data/bundler/lib/bundler/man/bundle-exec.1 +2 -5
- data/bundler/lib/bundler/man/bundle-exec.1.ronn +1 -5
- data/bundler/lib/bundler/man/bundle-fund.1 +1 -1
- data/bundler/lib/bundler/man/bundle-gem.1 +3 -6
- data/bundler/lib/bundler/man/bundle-gem.1.ronn +2 -5
- data/bundler/lib/bundler/man/bundle-help.1 +1 -1
- data/bundler/lib/bundler/man/bundle-info.1 +1 -1
- data/bundler/lib/bundler/man/bundle-init.1 +1 -1
- data/bundler/lib/bundler/man/bundle-install.1 +14 -57
- data/bundler/lib/bundler/man/bundle-install.1.ronn +25 -105
- data/bundler/lib/bundler/man/bundle-issue.1 +1 -1
- data/bundler/lib/bundler/man/bundle-licenses.1 +1 -1
- data/bundler/lib/bundler/man/bundle-list.1 +6 -1
- data/bundler/lib/bundler/man/bundle-list.1.ronn +5 -0
- data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
- data/bundler/lib/bundler/man/bundle-open.1 +1 -1
- data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
- data/bundler/lib/bundler/man/bundle-platform.1 +1 -1
- data/bundler/lib/bundler/man/bundle-plugin.1 +2 -9
- data/bundler/lib/bundler/man/bundle-plugin.1.ronn +0 -8
- data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
- data/bundler/lib/bundler/man/bundle-remove.1 +2 -8
- data/bundler/lib/bundler/man/bundle-remove.1.ronn +1 -8
- data/bundler/lib/bundler/man/bundle-show.1 +2 -5
- data/bundler/lib/bundler/man/bundle-show.1.ronn +0 -4
- data/bundler/lib/bundler/man/bundle-update.1 +1 -1
- data/bundler/lib/bundler/man/bundle-version.1 +1 -1
- data/bundler/lib/bundler/man/bundle.1 +1 -10
- data/bundler/lib/bundler/man/bundle.1.ronn +0 -9
- data/bundler/lib/bundler/man/gemfile.5 +32 -1
- data/bundler/lib/bundler/man/gemfile.5.ronn +28 -0
- data/bundler/lib/bundler/man/index.txt +0 -2
- data/bundler/lib/bundler/materialization.rb +1 -1
- data/bundler/lib/bundler/plugin/installer.rb +0 -10
- data/bundler/lib/bundler/plugin/source_list.rb +1 -1
- data/bundler/lib/bundler/plugin.rb +1 -1
- data/bundler/lib/bundler/resolver.rb +1 -1
- data/bundler/lib/bundler/ruby_dsl.rb +2 -0
- data/bundler/lib/bundler/ruby_version.rb +1 -3
- data/bundler/lib/bundler/rubygems_ext.rb +1 -1
- data/bundler/lib/bundler/rubygems_gem_installer.rb +1 -1
- data/bundler/lib/bundler/rubygems_integration.rb +1 -5
- data/bundler/lib/bundler/runtime.rb +5 -1
- data/bundler/lib/bundler/self_manager.rb +1 -1
- data/bundler/lib/bundler/settings.rb +8 -26
- data/bundler/lib/bundler/shared_helpers.rb +12 -20
- data/bundler/lib/bundler/source/git/git_proxy.rb +3 -11
- data/bundler/lib/bundler/source/git.rb +2 -3
- data/bundler/lib/bundler/source/path.rb +3 -7
- data/bundler/lib/bundler/source/rubygems.rb +11 -17
- data/bundler/lib/bundler/source.rb +1 -1
- data/bundler/lib/bundler/source_list.rb +4 -45
- data/bundler/lib/bundler/source_map.rb +2 -5
- data/bundler/lib/bundler/spec_set.rb +6 -15
- data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +7 -129
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +5 -0
- data/bundler/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +1 -1
- data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf-go.rb.tt +11 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/go.mod.tt +5 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem-go.c.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.go.tt +31 -0
- data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +6 -0
- data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +4 -1
- data/bundler/lib/bundler/ui/shell.rb +10 -6
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +26 -23
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +50 -6
- data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +57 -52
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +5 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +57 -15
- data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +34 -21
- data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +12 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +9 -8
- data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +2 -2
- data/bundler/lib/bundler/version.rb +1 -1
- data/bundler/lib/bundler/vlad.rb +1 -14
- data/bundler/lib/bundler.rb +6 -28
- data/doc/MAINTAINERS.txt +0 -7
- data/doc/bundler/UPGRADING.md +11 -5
- data/doc/rubygems/CONTRIBUTING.md +1 -1
- data/lib/rubygems/basic_specification.rb +3 -9
- data/lib/rubygems/bundler_version_finder.rb +38 -3
- data/lib/rubygems/command.rb +1 -1
- data/lib/rubygems/command_manager.rb +3 -4
- data/lib/rubygems/commands/build_command.rb +0 -7
- data/lib/rubygems/commands/cert_command.rb +1 -1
- data/lib/rubygems/commands/install_command.rb +1 -5
- data/lib/rubygems/commands/setup_command.rb +5 -3
- data/lib/rubygems/config_file.rb +1 -1
- data/lib/rubygems/dependency.rb +1 -1
- data/lib/rubygems/dependency_installer.rb +0 -77
- data/lib/rubygems/dependency_list.rb +1 -2
- data/lib/rubygems/deprecate.rb +74 -72
- data/lib/rubygems/doctor.rb +1 -1
- data/lib/rubygems/errors.rb +1 -1
- data/lib/rubygems/exceptions.rb +2 -3
- data/lib/rubygems/ext/builder.rb +6 -2
- data/lib/rubygems/ext/cargo_builder.rb +2 -2
- data/lib/rubygems/ext/cmake_builder.rb +97 -8
- data/lib/rubygems/ext/configure_builder.rb +2 -2
- data/lib/rubygems/ext/ext_conf_builder.rb +6 -2
- data/lib/rubygems/ext/rake_builder.rb +2 -2
- data/lib/rubygems/gem_runner.rb +0 -1
- data/lib/rubygems/install_update_options.rb +1 -2
- data/lib/rubygems/installer.rb +16 -54
- data/lib/rubygems/name_tuple.rb +7 -1
- data/lib/rubygems/package/tar_header.rb +4 -4
- data/lib/rubygems/package/tar_reader.rb +2 -0
- data/lib/rubygems/package/tar_writer.rb +1 -1
- data/lib/rubygems/package.rb +21 -12
- data/lib/rubygems/platform.rb +31 -11
- data/lib/rubygems/remote_fetcher.rb +8 -5
- data/lib/rubygems/resolver/conflict.rb +1 -1
- data/lib/rubygems/resolver.rb +1 -1
- data/lib/rubygems/security/signer.rb +1 -1
- data/lib/rubygems/source.rb +2 -2
- data/lib/rubygems/spec_fetcher.rb +4 -4
- data/lib/rubygems/specification.rb +5 -96
- data/lib/rubygems/specification_policy.rb +0 -36
- data/lib/rubygems/specification_record.rb +1 -1
- data/lib/rubygems/text.rb +1 -1
- data/lib/rubygems/uninstaller.rb +17 -6
- data/lib/rubygems/user_interaction.rb +6 -9
- data/lib/rubygems/util.rb +0 -22
- data/lib/rubygems/validator.rb +1 -1
- data/lib/rubygems/vendor/net-http/lib/net/http/generic_request.rb +25 -9
- data/lib/rubygems/vendor/net-http/lib/net/http/responses.rb +2 -2
- data/lib/rubygems/vendor/net-http/lib/net/http.rb +14 -14
- data/lib/rubygems/vendor/optparse/lib/optparse.rb +82 -41
- data/lib/rubygems/vendor/resolv/lib/resolv.rb +1 -1
- data/lib/rubygems/vendor/timeout/lib/timeout.rb +4 -1
- data/lib/rubygems/vendor/uri/lib/uri/common.rb +57 -15
- data/lib/rubygems/vendor/uri/lib/uri/file.rb +1 -1
- data/lib/rubygems/vendor/uri/lib/uri/generic.rb +34 -21
- data/lib/rubygems/vendor/uri/lib/uri/http.rb +12 -0
- data/lib/rubygems/vendor/uri/lib/uri/rfc2396_parser.rb +9 -8
- data/lib/rubygems/vendor/uri/lib/uri/version.rb +2 -2
- data/lib/rubygems/version.rb +8 -20
- data/lib/rubygems/win_platform.rb +31 -0
- data/lib/rubygems.rb +12 -40
- data/rubygems-update.gemspec +6 -4
- metadata +10 -18
- data/bundler/lib/bundler/cli/inject.rb +0 -60
- data/bundler/lib/bundler/cli/viz.rb +0 -31
- data/bundler/lib/bundler/graph.rb +0 -152
- data/bundler/lib/bundler/man/bundle-inject.1 +0 -31
- data/bundler/lib/bundler/man/bundle-inject.1.ronn +0 -32
- data/bundler/lib/bundler/man/bundle-viz.1 +0 -30
- data/bundler/lib/bundler/man/bundle-viz.1.ronn +0 -36
- data/bundler/lib/bundler/similarity_detector.rb +0 -63
- data/lib/rubygems/commands/query_command.rb +0 -43
- data/lib/rubygems/compatibility.rb +0 -41
- data/lib/rubygems/install_default_message.rb +0 -13
|
@@ -393,16 +393,18 @@ By default, this RubyGems will install gem as:
|
|
|
393
393
|
Dir.chdir("bundler") do
|
|
394
394
|
built_gem = Gem::Package.build(new_bundler_spec)
|
|
395
395
|
begin
|
|
396
|
-
Gem::Installer.at(
|
|
396
|
+
installer = Gem::Installer.at(
|
|
397
397
|
built_gem,
|
|
398
398
|
env_shebang: options[:env_shebang],
|
|
399
399
|
format_executable: options[:format_executable],
|
|
400
400
|
force: options[:force],
|
|
401
|
-
install_as_default: true,
|
|
402
401
|
bin_dir: bin_dir,
|
|
403
402
|
install_dir: default_dir,
|
|
404
403
|
wrappers: true
|
|
405
|
-
)
|
|
404
|
+
)
|
|
405
|
+
installer.install
|
|
406
|
+
File.delete installer.spec_file
|
|
407
|
+
installer.write_default_spec
|
|
406
408
|
ensure
|
|
407
409
|
FileUtils.rm_f built_gem
|
|
408
410
|
end
|
data/lib/rubygems/config_file.rb
CHANGED
|
@@ -345,7 +345,7 @@ if you believe they were disclosed to a third party.
|
|
|
345
345
|
require "fileutils"
|
|
346
346
|
FileUtils.mkdir_p(dirname)
|
|
347
347
|
|
|
348
|
-
permissions = 0o600 &
|
|
348
|
+
permissions = 0o600 & ~File.umask
|
|
349
349
|
File.open(credentials_path, "w", permissions) do |f|
|
|
350
350
|
f.write self.class.dump_with_rubygems_yaml(config)
|
|
351
351
|
end
|
data/lib/rubygems/dependency.rb
CHANGED
|
@@ -217,7 +217,7 @@ class Gem::Dependency
|
|
|
217
217
|
# NOTE: Unlike #matches_spec? this method does not return true when the
|
|
218
218
|
# version is a prerelease version unless this is a prerelease dependency.
|
|
219
219
|
|
|
220
|
-
def match?(obj, version=nil, allow_prerelease=false)
|
|
220
|
+
def match?(obj, version = nil, allow_prerelease = false)
|
|
221
221
|
if !version
|
|
222
222
|
name = obj.name
|
|
223
223
|
version = obj.version
|
|
@@ -7,14 +7,12 @@ require_relative "installer"
|
|
|
7
7
|
require_relative "spec_fetcher"
|
|
8
8
|
require_relative "user_interaction"
|
|
9
9
|
require_relative "available_set"
|
|
10
|
-
require_relative "deprecate"
|
|
11
10
|
|
|
12
11
|
##
|
|
13
12
|
# Installs a gem along with all its dependencies from local and remote gems.
|
|
14
13
|
|
|
15
14
|
class Gem::DependencyInstaller
|
|
16
15
|
include Gem::UserInteraction
|
|
17
|
-
extend Gem::Deprecate
|
|
18
16
|
|
|
19
17
|
DEFAULT_OPTIONS = { # :nodoc:
|
|
20
18
|
env_shebang: false,
|
|
@@ -28,7 +26,6 @@ class Gem::DependencyInstaller
|
|
|
28
26
|
wrappers: true,
|
|
29
27
|
build_args: nil,
|
|
30
28
|
build_docs_in_background: false,
|
|
31
|
-
install_as_default: false,
|
|
32
29
|
}.freeze
|
|
33
30
|
|
|
34
31
|
##
|
|
@@ -87,7 +84,6 @@ class Gem::DependencyInstaller
|
|
|
87
84
|
@wrappers = options[:wrappers]
|
|
88
85
|
@build_args = options[:build_args]
|
|
89
86
|
@build_docs_in_background = options[:build_docs_in_background]
|
|
90
|
-
@install_as_default = options[:install_as_default]
|
|
91
87
|
@dir_mode = options[:dir_mode]
|
|
92
88
|
@data_mode = options[:data_mode]
|
|
93
89
|
@prog_mode = options[:prog_mode]
|
|
@@ -121,78 +117,6 @@ class Gem::DependencyInstaller
|
|
|
121
117
|
@domain == :both || @domain == :remote
|
|
122
118
|
end
|
|
123
119
|
|
|
124
|
-
##
|
|
125
|
-
# Returns a list of pairs of gemspecs and source_uris that match
|
|
126
|
-
# Gem::Dependency +dep+ from both local (Dir.pwd) and remote (Gem.sources)
|
|
127
|
-
# sources. Gems are sorted with newer gems preferred over older gems, and
|
|
128
|
-
# local gems preferred over remote gems.
|
|
129
|
-
|
|
130
|
-
def find_gems_with_sources(dep, best_only=false) # :nodoc:
|
|
131
|
-
set = Gem::AvailableSet.new
|
|
132
|
-
|
|
133
|
-
if consider_local?
|
|
134
|
-
sl = Gem::Source::Local.new
|
|
135
|
-
|
|
136
|
-
if spec = sl.find_gem(dep.name)
|
|
137
|
-
if dep.matches_spec? spec
|
|
138
|
-
set.add spec, sl
|
|
139
|
-
end
|
|
140
|
-
end
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
if consider_remote?
|
|
144
|
-
begin
|
|
145
|
-
# This is pulled from #spec_for_dependency to allow
|
|
146
|
-
# us to filter tuples before fetching specs.
|
|
147
|
-
tuples, errors = Gem::SpecFetcher.fetcher.search_for_dependency dep
|
|
148
|
-
|
|
149
|
-
if best_only && !tuples.empty?
|
|
150
|
-
tuples.sort! do |a,b|
|
|
151
|
-
if b[0].version == a[0].version
|
|
152
|
-
if b[0].platform != Gem::Platform::RUBY
|
|
153
|
-
1
|
|
154
|
-
else
|
|
155
|
-
-1
|
|
156
|
-
end
|
|
157
|
-
else
|
|
158
|
-
b[0].version <=> a[0].version
|
|
159
|
-
end
|
|
160
|
-
end
|
|
161
|
-
tuples = [tuples.first]
|
|
162
|
-
end
|
|
163
|
-
|
|
164
|
-
specs = []
|
|
165
|
-
tuples.each do |tup, source|
|
|
166
|
-
spec = source.fetch_spec(tup)
|
|
167
|
-
rescue Gem::RemoteFetcher::FetchError => e
|
|
168
|
-
errors << Gem::SourceFetchProblem.new(source, e)
|
|
169
|
-
else
|
|
170
|
-
specs << [spec, source]
|
|
171
|
-
end
|
|
172
|
-
|
|
173
|
-
if @errors
|
|
174
|
-
@errors += errors
|
|
175
|
-
else
|
|
176
|
-
@errors = errors
|
|
177
|
-
end
|
|
178
|
-
|
|
179
|
-
set << specs
|
|
180
|
-
rescue Gem::RemoteFetcher::FetchError => e
|
|
181
|
-
# FIX if there is a problem talking to the network, we either need to always tell
|
|
182
|
-
# the user (no really_verbose) or fail hard, not silently tell them that we just
|
|
183
|
-
# couldn't find their requested gem.
|
|
184
|
-
verbose do
|
|
185
|
-
"Error fetching remote data:\t\t#{e.message}\n" \
|
|
186
|
-
"Falling back to local-only install"
|
|
187
|
-
end
|
|
188
|
-
@domain = :local
|
|
189
|
-
end
|
|
190
|
-
end
|
|
191
|
-
|
|
192
|
-
set
|
|
193
|
-
end
|
|
194
|
-
rubygems_deprecate :find_gems_with_sources
|
|
195
|
-
|
|
196
120
|
def in_background(what) # :nodoc:
|
|
197
121
|
fork_happened = false
|
|
198
122
|
if @build_docs_in_background && Process.respond_to?(:fork)
|
|
@@ -240,7 +164,6 @@ class Gem::DependencyInstaller
|
|
|
240
164
|
user_install: @user_install,
|
|
241
165
|
wrappers: @wrappers,
|
|
242
166
|
build_root: @build_root,
|
|
243
|
-
install_as_default: @install_as_default,
|
|
244
167
|
dir_mode: @dir_mode,
|
|
245
168
|
data_mode: @data_mode,
|
|
246
169
|
prog_mode: @prog_mode,
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
#++
|
|
8
8
|
|
|
9
9
|
require_relative "vendored_tsort"
|
|
10
|
-
require_relative "deprecate"
|
|
11
10
|
|
|
12
11
|
##
|
|
13
12
|
# Gem::DependencyList is used for installing and uninstalling gems in the
|
|
@@ -140,7 +139,7 @@ class Gem::DependencyList
|
|
|
140
139
|
# If removing the gemspec creates breaks a currently ok dependency, then it
|
|
141
140
|
# is NOT ok to remove the gemspec.
|
|
142
141
|
|
|
143
|
-
def ok_to_remove?(full_name, check_dev=true)
|
|
142
|
+
def ok_to_remove?(full_name, check_dev = true)
|
|
144
143
|
gem_to_remove = find_name full_name
|
|
145
144
|
|
|
146
145
|
# If the state is inconsistent, at least don't crash
|
data/lib/rubygems/deprecate.rb
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
##
|
|
4
|
-
# Provides 3 methods for declaring when something is going away.
|
|
5
|
-
#
|
|
6
|
-
# +deprecate(name, repl, year, month)+:
|
|
7
|
-
# Indicate something may be removed on/after a certain date.
|
|
8
|
-
#
|
|
9
|
-
# +rubygems_deprecate(name, replacement=:none)+:
|
|
10
|
-
# Indicate something will be removed in the next major RubyGems version,
|
|
11
|
-
# and (optionally) a replacement for it.
|
|
12
|
-
#
|
|
13
|
-
# +rubygems_deprecate_command+:
|
|
14
|
-
# Indicate a RubyGems command (in +lib/rubygems/commands/*.rb+) will be
|
|
15
|
-
# removed in the next RubyGems version.
|
|
16
|
-
#
|
|
17
|
-
# Also provides +skip_during+ for temporarily turning off deprecation warnings.
|
|
18
|
-
# This is intended to be used in the test suite, so deprecation warnings
|
|
19
|
-
# don't cause test failures if you need to make sure stderr is otherwise empty.
|
|
20
|
-
#
|
|
21
|
-
#
|
|
22
|
-
# Example usage of +deprecate+ and +rubygems_deprecate+:
|
|
23
|
-
#
|
|
24
|
-
# class Legacy
|
|
25
|
-
# def self.some_class_method
|
|
26
|
-
# # ...
|
|
27
|
-
# end
|
|
28
|
-
#
|
|
29
|
-
# def some_instance_method
|
|
30
|
-
# # ...
|
|
31
|
-
# end
|
|
32
|
-
#
|
|
33
|
-
# def some_old_method
|
|
34
|
-
# # ...
|
|
35
|
-
# end
|
|
36
|
-
#
|
|
37
|
-
# extend Gem::Deprecate
|
|
38
|
-
# deprecate :some_instance_method, "X.z", 2011, 4
|
|
39
|
-
# rubygems_deprecate :some_old_method, "Modern#some_new_method"
|
|
40
|
-
#
|
|
41
|
-
# class << self
|
|
42
|
-
# extend Gem::Deprecate
|
|
43
|
-
# deprecate :some_class_method, :none, 2011, 4
|
|
44
|
-
# end
|
|
45
|
-
# end
|
|
46
|
-
#
|
|
47
|
-
#
|
|
48
|
-
# Example usage of +rubygems_deprecate_command+:
|
|
49
|
-
#
|
|
50
|
-
# class Gem::Commands::QueryCommand < Gem::Command
|
|
51
|
-
# extend Gem::Deprecate
|
|
52
|
-
# rubygems_deprecate_command
|
|
53
|
-
#
|
|
54
|
-
# # ...
|
|
55
|
-
# end
|
|
56
|
-
#
|
|
57
|
-
#
|
|
58
|
-
# Example usage of +skip_during+:
|
|
59
|
-
#
|
|
60
|
-
# class TestSomething < Gem::Testcase
|
|
61
|
-
# def test_some_thing_with_deprecations
|
|
62
|
-
# Gem::Deprecate.skip_during do
|
|
63
|
-
# actual_stdout, actual_stderr = capture_output do
|
|
64
|
-
# Gem.something_deprecated
|
|
65
|
-
# end
|
|
66
|
-
# assert_empty actual_stdout
|
|
67
|
-
# assert_equal(expected, actual_stderr)
|
|
68
|
-
# end
|
|
69
|
-
# end
|
|
70
|
-
# end
|
|
71
|
-
|
|
72
3
|
module Gem
|
|
4
|
+
##
|
|
5
|
+
# Provides 3 methods for declaring when something is going away.
|
|
6
|
+
#
|
|
7
|
+
# <tt>deprecate(name, repl, year, month)</tt>:
|
|
8
|
+
# Indicate something may be removed on/after a certain date.
|
|
9
|
+
#
|
|
10
|
+
# <tt>rubygems_deprecate(name, replacement=:none)</tt>:
|
|
11
|
+
# Indicate something will be removed in the next major RubyGems version,
|
|
12
|
+
# and (optionally) a replacement for it.
|
|
13
|
+
#
|
|
14
|
+
# +rubygems_deprecate_command+:
|
|
15
|
+
# Indicate a RubyGems command (in +lib/rubygems/commands/*.rb+) will be
|
|
16
|
+
# removed in the next RubyGems version.
|
|
17
|
+
#
|
|
18
|
+
# Also provides +skip_during+ for temporarily turning off deprecation warnings.
|
|
19
|
+
# This is intended to be used in the test suite, so deprecation warnings
|
|
20
|
+
# don't cause test failures if you need to make sure stderr is otherwise empty.
|
|
21
|
+
#
|
|
22
|
+
#
|
|
23
|
+
# Example usage of +deprecate+ and +rubygems_deprecate+:
|
|
24
|
+
#
|
|
25
|
+
# class Legacy
|
|
26
|
+
# def self.some_class_method
|
|
27
|
+
# # ...
|
|
28
|
+
# end
|
|
29
|
+
#
|
|
30
|
+
# def some_instance_method
|
|
31
|
+
# # ...
|
|
32
|
+
# end
|
|
33
|
+
#
|
|
34
|
+
# def some_old_method
|
|
35
|
+
# # ...
|
|
36
|
+
# end
|
|
37
|
+
#
|
|
38
|
+
# extend Gem::Deprecate
|
|
39
|
+
# deprecate :some_instance_method, "X.z", 2011, 4
|
|
40
|
+
# rubygems_deprecate :some_old_method, "Modern#some_new_method"
|
|
41
|
+
#
|
|
42
|
+
# class << self
|
|
43
|
+
# extend Gem::Deprecate
|
|
44
|
+
# deprecate :some_class_method, :none, 2011, 4
|
|
45
|
+
# end
|
|
46
|
+
# end
|
|
47
|
+
#
|
|
48
|
+
#
|
|
49
|
+
# Example usage of +rubygems_deprecate_command+:
|
|
50
|
+
#
|
|
51
|
+
# class Gem::Commands::QueryCommand < Gem::Command
|
|
52
|
+
# extend Gem::Deprecate
|
|
53
|
+
# rubygems_deprecate_command
|
|
54
|
+
#
|
|
55
|
+
# # ...
|
|
56
|
+
# end
|
|
57
|
+
#
|
|
58
|
+
#
|
|
59
|
+
# Example usage of +skip_during+:
|
|
60
|
+
#
|
|
61
|
+
# class TestSomething < Gem::Testcase
|
|
62
|
+
# def test_some_thing_with_deprecations
|
|
63
|
+
# Gem::Deprecate.skip_during do
|
|
64
|
+
# actual_stdout, actual_stderr = capture_output do
|
|
65
|
+
# Gem.something_deprecated
|
|
66
|
+
# end
|
|
67
|
+
# assert_empty actual_stdout
|
|
68
|
+
# assert_equal(expected, actual_stderr)
|
|
69
|
+
# end
|
|
70
|
+
# end
|
|
71
|
+
# end
|
|
72
|
+
|
|
73
73
|
module Deprecate
|
|
74
74
|
def self.skip # :nodoc:
|
|
75
75
|
@skip ||= false
|
|
@@ -126,17 +126,18 @@ module Gem
|
|
|
126
126
|
# telling the user of +repl+ (unless +repl+ is :none) and the
|
|
127
127
|
# Rubygems version that it is planned to go away.
|
|
128
128
|
|
|
129
|
-
def rubygems_deprecate(name, replacement
|
|
129
|
+
def rubygems_deprecate(name, replacement = :none, version = nil)
|
|
130
130
|
class_eval do
|
|
131
131
|
old = "_deprecated_#{name}"
|
|
132
132
|
alias_method old, name
|
|
133
133
|
define_method name do |*args, &block|
|
|
134
134
|
klass = is_a? Module
|
|
135
135
|
target = klass ? "#{self}." : "#{self.class}#"
|
|
136
|
+
version ||= Gem::Deprecate.next_rubygems_major_version
|
|
136
137
|
msg = [
|
|
137
138
|
"NOTE: #{target}#{name} is deprecated",
|
|
138
139
|
replacement == :none ? " with no replacement" : "; use #{replacement} instead",
|
|
139
|
-
". It will be removed in Rubygems #{
|
|
140
|
+
". It will be removed in Rubygems #{version}",
|
|
140
141
|
"\n#{target}#{name} called from #{Gem.location_of_caller.join(":")}",
|
|
141
142
|
]
|
|
142
143
|
warn "#{msg.join}." unless Gem::Deprecate.skip
|
|
@@ -147,13 +148,14 @@ module Gem
|
|
|
147
148
|
end
|
|
148
149
|
|
|
149
150
|
# Deprecation method to deprecate Rubygems commands
|
|
150
|
-
def rubygems_deprecate_command(version =
|
|
151
|
+
def rubygems_deprecate_command(version = nil)
|
|
151
152
|
class_eval do
|
|
152
153
|
define_method "deprecated?" do
|
|
153
154
|
true
|
|
154
155
|
end
|
|
155
156
|
|
|
156
157
|
define_method "deprecation_warning" do
|
|
158
|
+
version ||= Gem::Deprecate.next_rubygems_major_version
|
|
157
159
|
msg = [
|
|
158
160
|
"#{command} command is deprecated",
|
|
159
161
|
". It will be removed in Rubygems #{version}.\n",
|
data/lib/rubygems/doctor.rb
CHANGED
|
@@ -113,7 +113,7 @@ class Gem::Doctor
|
|
|
113
113
|
next if installed_specs.include? basename
|
|
114
114
|
next if /^rubygems-\d/.match?(basename)
|
|
115
115
|
next if sub_directory == "specifications" && basename == "default"
|
|
116
|
-
next if sub_directory == "plugins" && Gem.plugin_suffix_regexp =~
|
|
116
|
+
next if sub_directory == "plugins" && Gem.plugin_suffix_regexp =~ basename
|
|
117
117
|
|
|
118
118
|
type = File.directory?(child) ? "directory" : "file"
|
|
119
119
|
|
data/lib/rubygems/errors.rb
CHANGED
|
@@ -26,7 +26,7 @@ module Gem
|
|
|
26
26
|
# system. Instead of rescuing from this class, make sure to rescue from the
|
|
27
27
|
# superclass Gem::LoadError to catch all types of load errors.
|
|
28
28
|
class MissingSpecError < Gem::LoadError
|
|
29
|
-
def initialize(name, requirement, extra_message=nil)
|
|
29
|
+
def initialize(name, requirement, extra_message = nil)
|
|
30
30
|
@name = name
|
|
31
31
|
@requirement = requirement
|
|
32
32
|
@extra_message = extra_message
|
data/lib/rubygems/exceptions.rb
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative "deprecate"
|
|
4
3
|
require_relative "unknown_command_spell_checker"
|
|
5
4
|
|
|
6
5
|
##
|
|
@@ -101,7 +100,7 @@ class Gem::SpecificGemNotFoundException < Gem::GemNotFoundException
|
|
|
101
100
|
# and +version+. Any +errors+ encountered when attempting to find the gem
|
|
102
101
|
# are also stored.
|
|
103
102
|
|
|
104
|
-
def initialize(name, version, errors=nil)
|
|
103
|
+
def initialize(name, version, errors = nil)
|
|
105
104
|
super "Could not find a valid gem '#{name}' (#{version}) locally or in a repository"
|
|
106
105
|
|
|
107
106
|
@name = name
|
|
@@ -252,7 +251,7 @@ class Gem::UnsatisfiableDependencyError < Gem::DependencyError
|
|
|
252
251
|
# Creates a new UnsatisfiableDependencyError for the unsatisfiable
|
|
253
252
|
# Gem::Resolver::DependencyRequest +dep+
|
|
254
253
|
|
|
255
|
-
def initialize(dep, platform_mismatch=nil)
|
|
254
|
+
def initialize(dep, platform_mismatch = nil)
|
|
256
255
|
if platform_mismatch && !platform_mismatch.empty?
|
|
257
256
|
plats = platform_mismatch.map {|x| x.platform.to_s }.sort.uniq
|
|
258
257
|
super "Unable to resolve dependency: No match for '#{dep}' on this platform. Found: #{plats.join(", ")}"
|
data/lib/rubygems/ext/builder.rb
CHANGED
|
@@ -11,6 +11,9 @@ require_relative "../user_interaction"
|
|
|
11
11
|
class Gem::Ext::Builder
|
|
12
12
|
include Gem::UserInteraction
|
|
13
13
|
|
|
14
|
+
class NoMakefileError < Gem::InstallError
|
|
15
|
+
end
|
|
16
|
+
|
|
14
17
|
attr_accessor :build_args # :nodoc:
|
|
15
18
|
|
|
16
19
|
def self.class_name
|
|
@@ -21,7 +24,8 @@ class Gem::Ext::Builder
|
|
|
21
24
|
def self.make(dest_path, results, make_dir = Dir.pwd, sitedir = nil, targets = ["clean", "", "install"],
|
|
22
25
|
target_rbconfig: Gem.target_rbconfig)
|
|
23
26
|
unless File.exist? File.join(make_dir, "Makefile")
|
|
24
|
-
|
|
27
|
+
# No makefile exists, nothing to do.
|
|
28
|
+
raise NoMakefileError, "No Makefile found in #{make_dir}"
|
|
25
29
|
end
|
|
26
30
|
|
|
27
31
|
# try to find make program from Ruby configure arguments first
|
|
@@ -165,7 +169,7 @@ class Gem::Ext::Builder
|
|
|
165
169
|
@ran_rake = true
|
|
166
170
|
Gem::Ext::RakeBuilder
|
|
167
171
|
when /CMakeLists.txt/ then
|
|
168
|
-
Gem::Ext::CmakeBuilder
|
|
172
|
+
Gem::Ext::CmakeBuilder.new
|
|
169
173
|
when /Cargo.toml/ then
|
|
170
174
|
Gem::Ext::CargoBuilder.new
|
|
171
175
|
else
|
|
@@ -15,7 +15,7 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def build(extension, dest_path, results, args = [], lib_dir = nil, cargo_dir = Dir.pwd,
|
|
18
|
-
target_rbconfig=Gem.target_rbconfig)
|
|
18
|
+
target_rbconfig = Gem.target_rbconfig)
|
|
19
19
|
require "tempfile"
|
|
20
20
|
require "fileutils"
|
|
21
21
|
|
|
@@ -159,7 +159,7 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
|
|
|
159
159
|
def linker_args
|
|
160
160
|
cc_flag = self.class.shellsplit(makefile_config("CC"))
|
|
161
161
|
# Avoid to ccache like tool from Rust build
|
|
162
|
-
# see https://github.com/
|
|
162
|
+
# see https://github.com/ruby/rubygems/pull/8521#issuecomment-2689854359
|
|
163
163
|
# ex. CC="ccache gcc" or CC="sccache clang --any --args"
|
|
164
164
|
cc_flag.shift if cc_flag.size >= 2 && !cc_flag[1].start_with?("-")
|
|
165
165
|
linker = cc_flag.shift
|
|
@@ -1,21 +1,110 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
# This builder creates extensions defined using CMake. Its is invoked if a Gem's spec file
|
|
4
|
+
# sets the `extension` property to a string that contains `CMakeLists.txt`.
|
|
5
|
+
#
|
|
6
|
+
# In general, CMake projects are built in two steps:
|
|
7
|
+
#
|
|
8
|
+
# * configure
|
|
9
|
+
# * build
|
|
10
|
+
#
|
|
11
|
+
# The builder follow this convention. First it runs a configuration step and then it runs a build step.
|
|
12
|
+
#
|
|
13
|
+
# CMake projects can be quite configurable - it is likely you will want to specify options when
|
|
14
|
+
# installing a gem. To pass options to CMake specify them after `--` in the gem install command. For example:
|
|
15
|
+
#
|
|
16
|
+
# gem install <gem_name> -- --preset <preset_name>
|
|
17
|
+
#
|
|
18
|
+
# Note that options are ONLY sent to the configure step - it is not currently possible to specify
|
|
19
|
+
# options for the build step. If this becomes and issue then the CMake builder can be updated to
|
|
20
|
+
# support build options.
|
|
21
|
+
#
|
|
22
|
+
# Useful options to know are:
|
|
23
|
+
#
|
|
24
|
+
# -G to specify a generator (-G Ninja is recommended)
|
|
25
|
+
# -D<CMAKE_VARIABLE> to set a CMake variable (for example -DCMAKE_BUILD_TYPE=Release)
|
|
26
|
+
# --preset <preset_name> to use a preset
|
|
27
|
+
#
|
|
28
|
+
# If the Gem author provides presets, via CMakePresets.json file, you will likely want to use one of them.
|
|
29
|
+
# If not, you may wish to specify a generator. Ninja is recommended because it can build projects in parallel
|
|
30
|
+
# and thus much faster than building them serially like Make does.
|
|
31
|
+
|
|
3
32
|
class Gem::Ext::CmakeBuilder < Gem::Ext::Builder
|
|
4
|
-
|
|
5
|
-
|
|
33
|
+
attr_accessor :runner, :profile
|
|
34
|
+
def initialize
|
|
35
|
+
@runner = self.class.method(:run)
|
|
36
|
+
@profile = :release
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def build(extension, dest_path, results, args = [], lib_dir = nil, cmake_dir = Dir.pwd,
|
|
40
|
+
target_rbconfig = Gem.target_rbconfig)
|
|
6
41
|
if target_rbconfig.path
|
|
7
42
|
warn "--target-rbconfig is not yet supported for CMake extensions. Ignoring"
|
|
8
43
|
end
|
|
9
44
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
cmd = ["cmake", ".", "-DCMAKE_INSTALL_PREFIX=#{dest_path}", *Gem::Command.build_args]
|
|
45
|
+
# Figure the build dir
|
|
46
|
+
build_dir = File.join(cmake_dir, "build")
|
|
13
47
|
|
|
14
|
-
|
|
15
|
-
|
|
48
|
+
# Check if the gem defined presets
|
|
49
|
+
check_presets(cmake_dir, args, results)
|
|
50
|
+
|
|
51
|
+
# Configure
|
|
52
|
+
configure(cmake_dir, build_dir, dest_path, args, results)
|
|
16
53
|
|
|
17
|
-
|
|
54
|
+
# Compile
|
|
55
|
+
compile(cmake_dir, build_dir, args, results)
|
|
18
56
|
|
|
19
57
|
results
|
|
20
58
|
end
|
|
59
|
+
|
|
60
|
+
def configure(cmake_dir, build_dir, install_dir, args, results)
|
|
61
|
+
cmd = ["cmake",
|
|
62
|
+
cmake_dir,
|
|
63
|
+
"-B",
|
|
64
|
+
build_dir,
|
|
65
|
+
"-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=#{install_dir}", # Windows
|
|
66
|
+
"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=#{install_dir}", # Not Windows
|
|
67
|
+
*Gem::Command.build_args,
|
|
68
|
+
*args]
|
|
69
|
+
|
|
70
|
+
runner.call(cmd, results, "cmake_configure", cmake_dir)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def compile(cmake_dir, build_dir, args, results)
|
|
74
|
+
cmd = ["cmake",
|
|
75
|
+
"--build",
|
|
76
|
+
build_dir.to_s,
|
|
77
|
+
"--config",
|
|
78
|
+
@profile.to_s]
|
|
79
|
+
|
|
80
|
+
runner.call(cmd, results, "cmake_compile", cmake_dir)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
private
|
|
84
|
+
|
|
85
|
+
def check_presets(cmake_dir, args, results)
|
|
86
|
+
# Return if the user specified a preset
|
|
87
|
+
return unless args.grep(/--preset/i).empty?
|
|
88
|
+
|
|
89
|
+
cmd = ["cmake",
|
|
90
|
+
"--list-presets"]
|
|
91
|
+
|
|
92
|
+
presets = Array.new
|
|
93
|
+
begin
|
|
94
|
+
runner.call(cmd, presets, "cmake_presets", cmake_dir)
|
|
95
|
+
|
|
96
|
+
# Remove the first two lines of the array which is the current_directory and the command
|
|
97
|
+
# that was run
|
|
98
|
+
presets = presets[2..].join
|
|
99
|
+
results << <<~EOS
|
|
100
|
+
The gem author provided a list of presets that can be used to build the gem. To use a preset specify it on the command line:
|
|
101
|
+
|
|
102
|
+
gem install <gem_name> -- --preset <preset_name>
|
|
103
|
+
|
|
104
|
+
#{presets}
|
|
105
|
+
EOS
|
|
106
|
+
rescue Gem::InstallError
|
|
107
|
+
# Do nothing, CMakePresets.json was not included in the Gem
|
|
108
|
+
end
|
|
109
|
+
end
|
|
21
110
|
end
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
#++
|
|
8
8
|
|
|
9
9
|
class Gem::Ext::ConfigureBuilder < Gem::Ext::Builder
|
|
10
|
-
def self.build(extension, dest_path, results, args=[], lib_dir=nil, configure_dir=Dir.pwd,
|
|
11
|
-
target_rbconfig=Gem.target_rbconfig)
|
|
10
|
+
def self.build(extension, dest_path, results, args = [], lib_dir = nil, configure_dir = Dir.pwd,
|
|
11
|
+
target_rbconfig = Gem.target_rbconfig)
|
|
12
12
|
if target_rbconfig.path
|
|
13
13
|
warn "--target-rbconfig is not yet supported for configure-based extensions. Ignoring"
|
|
14
14
|
end
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
#++
|
|
8
8
|
|
|
9
9
|
class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
|
|
10
|
-
def self.build(extension, dest_path, results, args=[], lib_dir=nil, extension_dir=Dir.pwd,
|
|
11
|
-
target_rbconfig=Gem.target_rbconfig)
|
|
10
|
+
def self.build(extension, dest_path, results, args = [], lib_dir = nil, extension_dir = Dir.pwd,
|
|
11
|
+
target_rbconfig = Gem.target_rbconfig)
|
|
12
12
|
require "fileutils"
|
|
13
13
|
require "tempfile"
|
|
14
14
|
|
|
@@ -66,6 +66,10 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
|
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
results
|
|
69
|
+
rescue Gem::Ext::Builder::NoMakefileError => error
|
|
70
|
+
results << error.message
|
|
71
|
+
results << "Skipping make for #{extension} as no Makefile was found."
|
|
72
|
+
# We are good, do not re-raise the error.
|
|
69
73
|
ensure
|
|
70
74
|
FileUtils.rm_rf tmp_dest if tmp_dest
|
|
71
75
|
end
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
#++
|
|
8
8
|
|
|
9
9
|
class Gem::Ext::RakeBuilder < Gem::Ext::Builder
|
|
10
|
-
def self.build(extension, dest_path, results, args=[], lib_dir=nil, extension_dir=Dir.pwd,
|
|
11
|
-
target_rbconfig=Gem.target_rbconfig)
|
|
10
|
+
def self.build(extension, dest_path, results, args = [], lib_dir = nil, extension_dir = Dir.pwd,
|
|
11
|
+
target_rbconfig = Gem.target_rbconfig)
|
|
12
12
|
if target_rbconfig.path
|
|
13
13
|
warn "--target-rbconfig is not yet supported for Rake extensions. Ignoring"
|
|
14
14
|
end
|
data/lib/rubygems/gem_runner.rb
CHANGED
|
@@ -158,10 +158,9 @@ module Gem::InstallUpdateOptions
|
|
|
158
158
|
options[:without_groups].concat v.map(&:intern)
|
|
159
159
|
end
|
|
160
160
|
|
|
161
|
-
add_option(:
|
|
161
|
+
add_option(:Deprecated, "--default",
|
|
162
162
|
"Add the gem's full specification to",
|
|
163
163
|
"specifications/default and extract only its bin") do |v,_o|
|
|
164
|
-
options[:install_as_default] = v
|
|
165
164
|
end
|
|
166
165
|
|
|
167
166
|
add_option(:"Install/Update", "--explain",
|