rubygems-update 3.2.26 → 3.2.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +60 -0
- data/Manifest.txt +12 -3
- data/bundler/CHANGELOG.md +50 -1
- data/bundler/README.md +1 -1
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli/check.rb +1 -1
- data/bundler/lib/bundler/cli/gem.rb +19 -2
- data/bundler/lib/bundler/cli/info.rb +11 -4
- data/bundler/lib/bundler/cli/issue.rb +4 -3
- data/bundler/lib/bundler/cli/remove.rb +1 -2
- data/bundler/lib/bundler/cli.rb +1 -0
- data/bundler/lib/bundler/compact_index_client.rb +2 -2
- data/bundler/lib/bundler/definition.rb +16 -6
- data/bundler/lib/bundler/digest.rb +71 -0
- data/bundler/lib/bundler/errors.rb +18 -2
- data/bundler/lib/bundler/fetcher.rb +2 -1
- data/bundler/lib/bundler/friendly_errors.rb +5 -30
- data/bundler/lib/bundler/gem_helper.rb +6 -17
- data/bundler/lib/bundler/installer.rb +0 -1
- data/bundler/lib/bundler/plugin/installer.rb +2 -0
- data/bundler/lib/bundler/plugin.rb +23 -6
- data/bundler/lib/bundler/rubygems_ext.rb +4 -0
- data/bundler/lib/bundler/rubygems_gem_installer.rb +20 -4
- data/bundler/lib/bundler/rubygems_integration.rb +28 -9
- data/bundler/lib/bundler/runtime.rb +1 -1
- data/bundler/lib/bundler/settings.rb +9 -1
- data/bundler/lib/bundler/source/git.rb +22 -4
- data/bundler/lib/bundler/source/rubygems.rb +43 -72
- data/bundler/lib/bundler/source.rb +2 -0
- data/bundler/lib/bundler/source_list.rb +4 -0
- data/bundler/lib/bundler/spec_set.rb +1 -1
- data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +2 -1
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
- data/bundler/lib/bundler/vendor/connection_pool/LICENSE +20 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +19 -21
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +57 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +39 -74
- data/bundler/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
- data/bundler/lib/bundler/vendor/molinillo/LICENSE +9 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
- data/bundler/lib/bundler/vendor/thor/LICENSE.md +20 -0
- data/bundler/lib/bundler/vendor/uri/LICENSE.txt +22 -0
- data/bundler/lib/bundler/version.rb +1 -1
- data/bundler/lib/bundler/worker.rb +2 -2
- data/bundler/lib/bundler.rb +13 -18
- data/lib/rubygems/command_manager.rb +3 -3
- data/lib/rubygems/commands/build_command.rb +3 -3
- data/lib/rubygems/commands/cert_command.rb +15 -8
- data/lib/rubygems/commands/check_command.rb +4 -4
- data/lib/rubygems/commands/cleanup_command.rb +3 -3
- data/lib/rubygems/commands/contents_command.rb +2 -2
- data/lib/rubygems/commands/dependency_command.rb +3 -3
- data/lib/rubygems/commands/environment_command.rb +1 -1
- data/lib/rubygems/commands/fetch_command.rb +3 -3
- data/lib/rubygems/commands/generate_index_command.rb +2 -2
- data/lib/rubygems/commands/help_command.rb +1 -1
- data/lib/rubygems/commands/info_command.rb +2 -2
- data/lib/rubygems/commands/install_command.rb +12 -11
- data/lib/rubygems/commands/list_command.rb +2 -2
- data/lib/rubygems/commands/lock_command.rb +1 -1
- data/lib/rubygems/commands/mirror_command.rb +1 -1
- data/lib/rubygems/commands/open_command.rb +2 -2
- data/lib/rubygems/commands/outdated_command.rb +4 -4
- data/lib/rubygems/commands/owner_command.rb +4 -4
- data/lib/rubygems/commands/pristine_command.rb +5 -5
- data/lib/rubygems/commands/push_command.rb +4 -4
- data/lib/rubygems/commands/query_command.rb +3 -3
- data/lib/rubygems/commands/rdoc_command.rb +3 -3
- data/lib/rubygems/commands/search_command.rb +2 -2
- data/lib/rubygems/commands/server_command.rb +3 -3
- data/lib/rubygems/commands/setup_command.rb +6 -6
- data/lib/rubygems/commands/signin_command.rb +2 -2
- data/lib/rubygems/commands/signout_command.rb +1 -1
- data/lib/rubygems/commands/sources_command.rb +4 -4
- data/lib/rubygems/commands/specification_command.rb +4 -4
- data/lib/rubygems/commands/stale_command.rb +1 -1
- data/lib/rubygems/commands/uninstall_command.rb +3 -3
- data/lib/rubygems/commands/unpack_command.rb +5 -5
- data/lib/rubygems/commands/update_command.rb +9 -9
- data/lib/rubygems/commands/which_command.rb +1 -1
- data/lib/rubygems/commands/yank_command.rb +4 -4
- data/lib/rubygems/config_file.rb +1 -1
- data/lib/rubygems/core_ext/tcpsocket_init.rb +2 -2
- data/lib/rubygems/defaults.rb +1 -1
- data/lib/rubygems/dependency_installer.rb +8 -8
- data/lib/rubygems/dependency_list.rb +1 -1
- data/lib/rubygems/doctor.rb +2 -2
- data/lib/rubygems/errors.rb +1 -2
- data/lib/rubygems/exceptions.rb +1 -1
- data/lib/rubygems/gem_runner.rb +3 -3
- data/lib/rubygems/gemcutter_utilities.rb +2 -2
- data/lib/rubygems/indexer.rb +2 -2
- data/lib/rubygems/install_default_message.rb +2 -2
- data/lib/rubygems/install_message.rb +2 -2
- data/lib/rubygems/install_update_options.rb +2 -2
- data/lib/rubygems/installer.rb +8 -8
- data/lib/rubygems/local_remote_options.rb +1 -1
- data/lib/rubygems/mock_gem_ui.rb +1 -1
- data/lib/rubygems/package/tar_reader.rb +1 -1
- data/lib/rubygems/package.rb +36 -46
- data/lib/rubygems/package_task.rb +2 -2
- data/lib/rubygems/platform.rb +2 -1
- data/lib/rubygems/query_utils.rb +4 -4
- data/lib/rubygems/rdoc.rb +1 -1
- data/lib/rubygems/remote_fetcher.rb +16 -22
- data/lib/rubygems/request/connection_pools.rb +1 -1
- data/lib/rubygems/request/http_pool.rb +1 -1
- data/lib/rubygems/request.rb +7 -5
- data/lib/rubygems/request_set/lockfile/tokenizer.rb +1 -1
- data/lib/rubygems/request_set/lockfile.rb +1 -1
- data/lib/rubygems/request_set.rb +5 -5
- data/lib/rubygems/requirement.rb +1 -1
- data/lib/rubygems/resolver/git_specification.rb +1 -1
- data/lib/rubygems/resolver/installer_set.rb +3 -3
- data/lib/rubygems/resolver/molinillo/LICENSE +9 -0
- data/lib/rubygems/resolver/molinillo.rb +1 -1
- data/lib/rubygems/resolver/set.rb +0 -1
- data/lib/rubygems/resolver/specification.rb +1 -1
- data/lib/rubygems/resolver.rb +31 -31
- data/lib/rubygems/s3_uri_signer.rb +4 -5
- data/lib/rubygems/security/policy.rb +6 -4
- data/lib/rubygems/security/signer.rb +4 -5
- data/lib/rubygems/security.rb +54 -20
- data/lib/rubygems/security_option.rb +2 -2
- data/lib/rubygems/server.rb +2 -2
- data/lib/rubygems/source/git.rb +2 -2
- data/lib/rubygems/source.rb +7 -7
- data/lib/rubygems/spec_fetcher.rb +5 -5
- data/lib/rubygems/specification.rb +12 -12
- data/lib/rubygems/specification_policy.rb +2 -2
- data/lib/rubygems/uninstaller.rb +6 -6
- data/lib/rubygems/uri.rb +111 -0
- data/lib/rubygems/user_interaction.rb +3 -3
- data/lib/rubygems/util/licenses.rb +1 -1
- data/lib/rubygems/util.rb +1 -1
- data/lib/rubygems/validator.rb +2 -2
- data/lib/rubygems/version_option.rb +1 -1
- data/lib/rubygems.rb +16 -16
- data/rubygems-update.gemspec +1 -1
- data/test/rubygems/helper.rb +4 -12
- data/test/rubygems/private_ec_key.pem +9 -0
- data/test/rubygems/test_gem.rb +59 -71
- data/test/rubygems/test_gem_commands_cert_command.rb +63 -4
- data/test/rubygems/test_gem_commands_install_command.rb +25 -0
- data/test/rubygems/test_gem_package.rb +27 -26
- data/test/rubygems/test_gem_platform.rb +1 -0
- data/test/rubygems/test_gem_remote_fetcher.rb +30 -0
- data/test/rubygems/test_gem_request.rb +35 -9
- data/test/rubygems/test_gem_resolver_installer_set.rb +18 -0
- data/test/rubygems/test_gem_security.rb +32 -4
- data/test/rubygems/test_gem_source_fetch_problem.rb +10 -0
- data/test/rubygems/test_gem_specification.rb +228 -232
- data/test/rubygems/test_gem_uri.rb +39 -0
- metadata +18 -9
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
- data/lib/rubygems/uri_parser.rb +0 -34
- data/lib/rubygems/uri_parsing.rb +0 -23
@@ -76,7 +76,7 @@ module Bundler
|
|
76
76
|
tag_version { git_push(args[:remote]) } unless already_tagged?
|
77
77
|
end
|
78
78
|
|
79
|
-
task "release:rubygem_push" do
|
79
|
+
task "release:rubygem_push" => "build" do
|
80
80
|
rubygem_push(built_gem_path) if gem_push?
|
81
81
|
end
|
82
82
|
|
@@ -98,10 +98,7 @@ module Bundler
|
|
98
98
|
built_gem_path ||= build_gem
|
99
99
|
cmd = [*gem_command, "install", built_gem_path.to_s]
|
100
100
|
cmd << "--local" if local
|
101
|
-
|
102
|
-
unless status.success?
|
103
|
-
raise "Couldn't install gem, run `gem install #{built_gem_path}' for more detailed output"
|
104
|
-
end
|
101
|
+
sh(cmd)
|
105
102
|
Bundler.ui.confirm "#{name} (#{version}) installed."
|
106
103
|
end
|
107
104
|
|
@@ -110,7 +107,7 @@ module Bundler
|
|
110
107
|
SharedHelpers.filesystem_access(File.join(base, "checksums")) {|p| FileUtils.mkdir_p(p) }
|
111
108
|
file_name = "#{File.basename(built_gem_path)}.sha512"
|
112
109
|
require "digest/sha2"
|
113
|
-
checksum = Digest::SHA512.new.hexdigest(built_gem_path.to_s)
|
110
|
+
checksum = ::Digest::SHA512.new.hexdigest(built_gem_path.to_s)
|
114
111
|
target = File.join(base, "checksums", file_name)
|
115
112
|
File.write(target, checksum)
|
116
113
|
Bundler.ui.confirm "#{name} #{version} checksum written to checksums/#{file_name}."
|
@@ -132,8 +129,8 @@ module Bundler
|
|
132
129
|
|
133
130
|
def git_push(remote = nil)
|
134
131
|
remote ||= default_remote
|
135
|
-
|
136
|
-
|
132
|
+
sh(%W[git push #{remote} refs/heads/#{current_branch}])
|
133
|
+
sh(%W[git push #{remote} refs/tags/#{version_tag}])
|
137
134
|
Bundler.ui.confirm "Pushed git commits and release tag."
|
138
135
|
end
|
139
136
|
|
@@ -161,13 +158,6 @@ module Bundler
|
|
161
158
|
allowed_push_host || env_rubygems_host || "rubygems.org"
|
162
159
|
end
|
163
160
|
|
164
|
-
def perform_git_push(options = "")
|
165
|
-
cmd = "git push #{options}"
|
166
|
-
out, status = sh_with_status(cmd.shellsplit)
|
167
|
-
return if status.success?
|
168
|
-
raise "Couldn't git push. `#{cmd}' failed with the following output:\n\n#{out}\n"
|
169
|
-
end
|
170
|
-
|
171
161
|
def already_tagged?
|
172
162
|
return false unless sh(%w[git tag]).split(/\n/).include?(version_tag)
|
173
163
|
Bundler.ui.confirm "Tag #{version_tag} has already been created."
|
@@ -218,8 +208,7 @@ module Bundler
|
|
218
208
|
def sh(cmd, &block)
|
219
209
|
out, status = sh_with_status(cmd, &block)
|
220
210
|
unless status.success?
|
221
|
-
|
222
|
-
raise(out.empty? ? "Running `#{cmd}` failed. Run this command directly for more detailed output." : out)
|
211
|
+
raise("Running `#{cmd.shelljoin}` failed with the following output:\n\n#{out}\n")
|
223
212
|
end
|
224
213
|
out
|
225
214
|
end
|
@@ -13,6 +13,7 @@ module Bundler
|
|
13
13
|
class MalformattedPlugin < PluginError; end
|
14
14
|
class UndefinedCommandError < PluginError; end
|
15
15
|
class UnknownSourceError < PluginError; end
|
16
|
+
class PluginInstallError < PluginError; end
|
16
17
|
|
17
18
|
PLUGIN_FILE_NAME = "plugins.rb".freeze
|
18
19
|
|
@@ -38,12 +39,11 @@ module Bundler
|
|
38
39
|
specs = Installer.new.install(names, options)
|
39
40
|
|
40
41
|
save_plugins names, specs
|
41
|
-
rescue PluginError
|
42
|
+
rescue PluginError
|
42
43
|
specs_to_delete = specs.select {|k, _v| names.include?(k) && !index.commands.values.include?(k) }
|
43
44
|
specs_to_delete.each_value {|spec| Bundler.rm_rf(spec.full_gem_path) }
|
44
45
|
|
45
|
-
|
46
|
-
Bundler.ui.error "Failed to install the following plugins: #{names_list}. The underlying error was: #{e.message}.\n #{e.backtrace.join("\n ")}"
|
46
|
+
raise
|
47
47
|
end
|
48
48
|
|
49
49
|
# Uninstalls plugins by the given names
|
@@ -245,10 +245,11 @@ module Bundler
|
|
245
245
|
# @param [Array<String>] names of inferred source plugins that can be ignored
|
246
246
|
def save_plugins(plugins, specs, optional_plugins = [])
|
247
247
|
plugins.each do |name|
|
248
|
+
next if index.installed?(name)
|
249
|
+
|
248
250
|
spec = specs[name]
|
249
|
-
|
250
|
-
|
251
|
-
Bundler.ui.info "Installed plugin #{name}" if installed
|
251
|
+
|
252
|
+
save_plugin(name, spec, optional_plugins.include?(name))
|
252
253
|
end
|
253
254
|
end
|
254
255
|
|
@@ -263,6 +264,22 @@ module Bundler
|
|
263
264
|
raise MalformattedPlugin, "#{PLUGIN_FILE_NAME} was not found in the plugin." unless plugin_file.file?
|
264
265
|
end
|
265
266
|
|
267
|
+
# Validates and registers a plugin.
|
268
|
+
#
|
269
|
+
# @param [String] name the name of the plugin
|
270
|
+
# @param [Specification] spec of installed plugin
|
271
|
+
# @param [Boolean] optional_plugin, removed if there is conflict with any
|
272
|
+
# other plugin (used for default source plugins)
|
273
|
+
#
|
274
|
+
# @raise [PluginInstallError] if validation or registration raises any error
|
275
|
+
def save_plugin(name, spec, optional_plugin = false)
|
276
|
+
validate_plugin! Pathname.new(spec.full_gem_path)
|
277
|
+
installed = register_plugin(name, spec, optional_plugin)
|
278
|
+
Bundler.ui.info "Installed plugin #{name}" if installed
|
279
|
+
rescue PluginError => e
|
280
|
+
raise PluginInstallError, "Failed to install plugin `#{spec.name}`, due to #{e.class} (#{e.message})"
|
281
|
+
end
|
282
|
+
|
266
283
|
# Runs the plugins.rb file in an isolated namespace, records the plugin
|
267
284
|
# actions it registers for and then passes the data to index to be stored.
|
268
285
|
#
|
@@ -16,10 +16,12 @@ module Bundler
|
|
16
16
|
spec.loaded_from = spec_file
|
17
17
|
|
18
18
|
# Completely remove any previous gem files
|
19
|
-
|
20
|
-
|
19
|
+
strict_rm_rf gem_dir
|
20
|
+
strict_rm_rf spec.extension_dir
|
21
21
|
|
22
|
-
|
22
|
+
SharedHelpers.filesystem_access(gem_dir, :create) do
|
23
|
+
FileUtils.mkdir_p gem_dir, :mode => 0o755
|
24
|
+
end
|
23
25
|
|
24
26
|
extract_files
|
25
27
|
|
@@ -31,7 +33,10 @@ module Bundler
|
|
31
33
|
generate_plugins
|
32
34
|
|
33
35
|
write_spec
|
34
|
-
|
36
|
+
|
37
|
+
SharedHelpers.filesystem_access("#{gem_home}/cache", :write) do
|
38
|
+
write_cache_file
|
39
|
+
end
|
35
40
|
|
36
41
|
say spec.post_install_message unless spec.post_install_message.nil?
|
37
42
|
|
@@ -87,6 +92,17 @@ module Bundler
|
|
87
92
|
|
88
93
|
private
|
89
94
|
|
95
|
+
def strict_rm_rf(dir)
|
96
|
+
# FileUtils.rm_rf should probably rise in case of permission issues like
|
97
|
+
# `rm -rf` does. However, it fails to delete the folder silently due to
|
98
|
+
# https://github.com/ruby/fileutils/issues/57. It should probably be fixed
|
99
|
+
# inside `fileutils` but for now I`m checking whether the folder was
|
100
|
+
# removed after it completes, and raising otherwise.
|
101
|
+
FileUtils.rm_rf dir
|
102
|
+
|
103
|
+
raise PermissionError.new(dir, :delete) if File.directory?(dir)
|
104
|
+
end
|
105
|
+
|
90
106
|
def validate_bundler_checksum(checksum)
|
91
107
|
return true if Bundler.settings[:disable_checksum_validation]
|
92
108
|
return true unless checksum
|
@@ -34,10 +34,12 @@ module Bundler
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def build_args
|
37
|
+
require "rubygems/command"
|
37
38
|
Gem::Command.build_args
|
38
39
|
end
|
39
40
|
|
40
41
|
def build_args=(args)
|
42
|
+
require "rubygems/command"
|
41
43
|
Gem::Command.build_args = args
|
42
44
|
end
|
43
45
|
|
@@ -84,16 +86,12 @@ module Bundler
|
|
84
86
|
def spec_missing_extensions?(spec, default = true)
|
85
87
|
return spec.missing_extensions? if spec.respond_to?(:missing_extensions?)
|
86
88
|
|
87
|
-
return false if
|
89
|
+
return false if spec.default_gem?
|
88
90
|
return false if spec.extensions.empty?
|
89
91
|
|
90
92
|
default
|
91
93
|
end
|
92
94
|
|
93
|
-
def spec_default_gem?(spec)
|
94
|
-
spec.respond_to?(:default_gem?) && spec.default_gem?
|
95
|
-
end
|
96
|
-
|
97
95
|
def spec_matches_for_glob(spec, glob)
|
98
96
|
return spec.matches_for_glob(glob) if spec.respond_to?(:matches_for_glob)
|
99
97
|
|
@@ -502,14 +500,15 @@ module Bundler
|
|
502
500
|
end
|
503
501
|
|
504
502
|
def fetch_specs(remote, name)
|
503
|
+
require "rubygems/remote_fetcher"
|
505
504
|
path = remote.uri.to_s + "#{name}.#{Gem.marshal_version}.gz"
|
506
505
|
fetcher = gem_remote_fetcher
|
507
506
|
fetcher.headers = { "X-Gemfile-Source" => remote.original_uri.to_s } if remote.original_uri
|
508
507
|
string = fetcher.fetch_path(path)
|
509
508
|
Bundler.load_marshal(string)
|
510
|
-
rescue Gem::RemoteFetcher::FetchError
|
509
|
+
rescue Gem::RemoteFetcher::FetchError
|
511
510
|
# it's okay for prerelease to fail
|
512
|
-
raise
|
511
|
+
raise unless name == "prerelease_specs"
|
513
512
|
end
|
514
513
|
|
515
514
|
def fetch_all_remote_specs(remote)
|
@@ -519,12 +518,32 @@ module Bundler
|
|
519
518
|
specs.concat(pres)
|
520
519
|
end
|
521
520
|
|
522
|
-
def download_gem(spec, uri,
|
521
|
+
def download_gem(spec, uri, cache_dir)
|
522
|
+
require "rubygems/remote_fetcher"
|
523
523
|
uri = Bundler.settings.mirror_for(uri)
|
524
524
|
fetcher = gem_remote_fetcher
|
525
525
|
fetcher.headers = { "X-Gemfile-Source" => spec.remote.original_uri.to_s } if spec.remote.original_uri
|
526
526
|
Bundler::Retry.new("download gem from #{uri}").attempts do
|
527
|
-
|
527
|
+
gem_file_name = spec.file_name
|
528
|
+
local_gem_path = File.join cache_dir, gem_file_name
|
529
|
+
return if File.exist? local_gem_path
|
530
|
+
|
531
|
+
begin
|
532
|
+
remote_gem_path = uri + "gems/#{gem_file_name}"
|
533
|
+
remote_gem_path = remote_gem_path.to_s if provides?("< 3.2.0.rc.1")
|
534
|
+
|
535
|
+
SharedHelpers.filesystem_access(local_gem_path) do
|
536
|
+
fetcher.cache_update_path remote_gem_path, local_gem_path
|
537
|
+
end
|
538
|
+
rescue Gem::RemoteFetcher::FetchError
|
539
|
+
raise if spec.original_platform == spec.platform
|
540
|
+
|
541
|
+
original_gem_file_name = "#{spec.original_name}.gem"
|
542
|
+
raise if gem_file_name == original_gem_file_name
|
543
|
+
|
544
|
+
gem_file_name = original_gem_file_name
|
545
|
+
retry
|
546
|
+
end
|
528
547
|
end
|
529
548
|
rescue Gem::RemoteFetcher::FetchError => e
|
530
549
|
raise Bundler::HTTPError, "Could not download gem from #{uri} due to underlying error <#{e.message}>"
|
@@ -291,7 +291,7 @@ module Bundler
|
|
291
291
|
return unless activated_spec = Bundler.rubygems.loaded_specs(spec.name)
|
292
292
|
return if activated_spec.version == spec.version
|
293
293
|
|
294
|
-
suggestion = if
|
294
|
+
suggestion = if activated_spec.default_gem?
|
295
295
|
"Since #{spec.name} is a default gem, you can either remove your dependency on it" \
|
296
296
|
" or try updating to a newer version of bundler that supports #{spec.name} as a default gem."
|
297
297
|
else
|
@@ -419,7 +419,15 @@ module Bundler
|
|
419
419
|
elsif is_credential(key)
|
420
420
|
"[REDACTED]"
|
421
421
|
elsif is_userinfo(converted)
|
422
|
-
converted.
|
422
|
+
username, pass = converted.split(":", 2)
|
423
|
+
|
424
|
+
if pass == "x-oauth-basic"
|
425
|
+
username = "[REDACTED]"
|
426
|
+
else
|
427
|
+
pass = "[REDACTED]"
|
428
|
+
end
|
429
|
+
|
430
|
+
[username, pass].join(":")
|
423
431
|
else
|
424
432
|
converted
|
425
433
|
end
|
@@ -42,7 +42,7 @@ module Bundler
|
|
42
42
|
%w[ref branch tag submodules].each do |opt|
|
43
43
|
out << " #{opt}: #{options[opt]}\n" if options[opt]
|
44
44
|
end
|
45
|
-
out << " glob: #{@glob}\n" unless
|
45
|
+
out << " glob: #{@glob}\n" unless default_glob?
|
46
46
|
out << " specs:\n"
|
47
47
|
end
|
48
48
|
|
@@ -75,12 +75,20 @@ module Bundler
|
|
75
75
|
git_proxy.branch
|
76
76
|
end
|
77
77
|
|
78
|
-
rev = "
|
78
|
+
rev = "at #{at}@#{shortref_for_display(revision)}"
|
79
79
|
rescue GitError
|
80
80
|
""
|
81
81
|
end
|
82
82
|
|
83
|
-
|
83
|
+
specifiers = [rev, glob_for_display].compact
|
84
|
+
suffix =
|
85
|
+
if specifiers.any?
|
86
|
+
" (#{specifiers.join(", ")})"
|
87
|
+
else
|
88
|
+
""
|
89
|
+
end
|
90
|
+
|
91
|
+
"#{@safe_uri}#{suffix}"
|
84
92
|
end
|
85
93
|
|
86
94
|
def name
|
@@ -282,6 +290,14 @@ module Bundler
|
|
282
290
|
ref[0..11]
|
283
291
|
end
|
284
292
|
|
293
|
+
def glob_for_display
|
294
|
+
default_glob? ? nil : "glob: #{@glob}"
|
295
|
+
end
|
296
|
+
|
297
|
+
def default_glob?
|
298
|
+
@glob == DEFAULT_GLOB
|
299
|
+
end
|
300
|
+
|
285
301
|
def uri_hash
|
286
302
|
if uri =~ %r{^\w+://(\w+@)?}
|
287
303
|
# Downcase the domain component of the URI
|
@@ -291,7 +307,9 @@ module Bundler
|
|
291
307
|
# If there is no URI scheme, assume it is an ssh/git URI
|
292
308
|
input = uri
|
293
309
|
end
|
294
|
-
|
310
|
+
# We use SHA1 here for historical reason and to preserve backward compatibility.
|
311
|
+
# But a transition to a simpler mangling algorithm would be welcome.
|
312
|
+
Bundler::Digest.sha1(input)
|
295
313
|
end
|
296
314
|
|
297
315
|
def cached_revision
|
@@ -26,6 +26,13 @@ module Bundler
|
|
26
26
|
Array(options["remotes"]).reverse_each {|r| add_remote(r) }
|
27
27
|
end
|
28
28
|
|
29
|
+
def local_only!
|
30
|
+
@specs = nil
|
31
|
+
@allow_local = true
|
32
|
+
@allow_cached = false
|
33
|
+
@allow_remote = false
|
34
|
+
end
|
35
|
+
|
29
36
|
def local!
|
30
37
|
return if @allow_local
|
31
38
|
|
@@ -128,7 +135,7 @@ module Bundler
|
|
128
135
|
force = opts[:force]
|
129
136
|
ensure_builtin_gems_cached = opts[:ensure_builtin_gems_cached]
|
130
137
|
|
131
|
-
if ensure_builtin_gems_cached &&
|
138
|
+
if ensure_builtin_gems_cached && spec.default_gem?
|
132
139
|
if !cached_path(spec)
|
133
140
|
cached_built_in_gem(spec) unless spec.remote
|
134
141
|
force = true
|
@@ -137,7 +144,7 @@ module Bundler
|
|
137
144
|
end
|
138
145
|
end
|
139
146
|
|
140
|
-
if
|
147
|
+
if installed?(spec) && !force
|
141
148
|
print_using_message "Using #{version_message(spec)}"
|
142
149
|
return nil # no post-install message
|
143
150
|
end
|
@@ -167,6 +174,7 @@ module Bundler
|
|
167
174
|
Bundler.ui.confirm message
|
168
175
|
|
169
176
|
path = cached_gem(spec)
|
177
|
+
raise GemNotFound, "Could not find #{spec.file_name} for installation" unless path
|
170
178
|
if requires_sudo?
|
171
179
|
install_path = Bundler.tmp(spec.full_name)
|
172
180
|
bin_path = install_path.join("bin")
|
@@ -226,12 +234,8 @@ module Bundler
|
|
226
234
|
end
|
227
235
|
|
228
236
|
def cache(spec, custom_path = nil)
|
229
|
-
|
230
|
-
|
231
|
-
else
|
232
|
-
cached_path = cached_gem(spec)
|
233
|
-
end
|
234
|
-
raise GemNotFound, "Missing gem file '#{spec.full_name}.gem'." unless cached_path
|
237
|
+
cached_path = cached_gem(spec)
|
238
|
+
raise GemNotFound, "Missing gem file '#{spec.file_name}'." unless cached_path
|
235
239
|
return if File.dirname(cached_path) == Bundler.app_cache.to_s
|
236
240
|
Bundler.ui.info " * #{File.basename(cached_path)}"
|
237
241
|
FileUtils.cp(cached_path, Bundler.app_cache(custom_path))
|
@@ -345,14 +349,17 @@ module Bundler
|
|
345
349
|
end
|
346
350
|
|
347
351
|
def cached_gem(spec)
|
348
|
-
|
349
|
-
|
350
|
-
|
352
|
+
if spec.default_gem?
|
353
|
+
cached_built_in_gem(spec)
|
354
|
+
else
|
355
|
+
cached_path(spec)
|
351
356
|
end
|
352
|
-
cached_gem
|
353
357
|
end
|
354
358
|
|
355
359
|
def cached_path(spec)
|
360
|
+
global_cache_path = download_cache_path(spec)
|
361
|
+
@caches << global_cache_path if global_cache_path
|
362
|
+
|
356
363
|
possibilities = @caches.map {|p| "#{p}/#{spec.file_name}" }
|
357
364
|
possibilities.find {|p| File.exist?(p) }
|
358
365
|
end
|
@@ -452,19 +459,26 @@ module Bundler
|
|
452
459
|
|
453
460
|
spec.fetch_platform
|
454
461
|
|
455
|
-
|
456
|
-
gem_path = "#{
|
462
|
+
cache_path = download_cache_path(spec) || default_cache_path_for(rubygems_dir)
|
463
|
+
gem_path = "#{cache_path}/#{spec.file_name}"
|
464
|
+
|
465
|
+
if requires_sudo?
|
466
|
+
download_path = Bundler.tmp(spec.full_name)
|
467
|
+
download_cache_path = default_cache_path_for(download_path)
|
468
|
+
else
|
469
|
+
download_cache_path = cache_path
|
470
|
+
end
|
457
471
|
|
458
|
-
SharedHelpers.filesystem_access(
|
472
|
+
SharedHelpers.filesystem_access(download_cache_path) do |p|
|
459
473
|
FileUtils.mkdir_p(p)
|
460
474
|
end
|
461
|
-
download_gem(spec,
|
475
|
+
download_gem(spec, download_cache_path)
|
462
476
|
|
463
477
|
if requires_sudo?
|
464
|
-
SharedHelpers.filesystem_access(
|
478
|
+
SharedHelpers.filesystem_access(cache_path) do |p|
|
465
479
|
Bundler.mkdir_p(p)
|
466
480
|
end
|
467
|
-
Bundler.sudo "mv #{
|
481
|
+
Bundler.sudo "mv #{download_cache_path}/#{spec.file_name} #{gem_path}"
|
468
482
|
end
|
469
483
|
|
470
484
|
gem_path
|
@@ -472,16 +486,8 @@ module Bundler
|
|
472
486
|
Bundler.rm_rf(download_path) if requires_sudo?
|
473
487
|
end
|
474
488
|
|
475
|
-
def builtin_gem?(spec)
|
476
|
-
# Ruby 2.1, where all included gems have this summary
|
477
|
-
return true if spec.summary =~ /is bundled with Ruby/
|
478
|
-
|
479
|
-
# Ruby 2.0, where gemspecs are stored in specifications/default/
|
480
|
-
spec.loaded_from && spec.loaded_from.include?("specifications/default/")
|
481
|
-
end
|
482
|
-
|
483
489
|
def installed?(spec)
|
484
|
-
installed_specs[spec].any?
|
490
|
+
installed_specs[spec].any? && !spec.deleted_gem?
|
485
491
|
end
|
486
492
|
|
487
493
|
def requires_sudo?
|
@@ -492,6 +498,10 @@ module Bundler
|
|
492
498
|
Bundler.rubygems.gem_dir
|
493
499
|
end
|
494
500
|
|
501
|
+
def default_cache_path_for(dir)
|
502
|
+
"#{dir}/cache"
|
503
|
+
end
|
504
|
+
|
495
505
|
def cache_path
|
496
506
|
Bundler.app_cache
|
497
507
|
end
|
@@ -504,52 +514,13 @@ module Bundler
|
|
504
514
|
# @param [Specification] spec
|
505
515
|
# the spec we want to download or retrieve from the cache.
|
506
516
|
#
|
507
|
-
# @param [String]
|
517
|
+
# @param [String] download_cache_path
|
508
518
|
# the local directory the .gem will end up in.
|
509
519
|
#
|
510
|
-
def download_gem(spec,
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
SharedHelpers.filesystem_access(local_path) do
|
515
|
-
FileUtils.cp(cache_path, local_path)
|
516
|
-
end
|
517
|
-
else
|
518
|
-
uri = spec.remote.uri
|
519
|
-
Bundler.ui.confirm("Fetching #{version_message(spec)}")
|
520
|
-
rubygems_local_path = Bundler.rubygems.download_gem(spec, uri, download_path)
|
521
|
-
|
522
|
-
# older rubygems return varying file:// variants depending on version
|
523
|
-
rubygems_local_path = rubygems_local_path.gsub(/\Afile:/, "") unless Bundler.rubygems.provides?(">= 3.2.0.rc.2")
|
524
|
-
rubygems_local_path = rubygems_local_path.gsub(%r{\A//}, "") if Bundler.rubygems.provides?("< 3.1.0")
|
525
|
-
|
526
|
-
if rubygems_local_path != local_path
|
527
|
-
SharedHelpers.filesystem_access(local_path) do
|
528
|
-
FileUtils.mv(rubygems_local_path, local_path)
|
529
|
-
end
|
530
|
-
end
|
531
|
-
cache_globally(spec, local_path)
|
532
|
-
end
|
533
|
-
end
|
534
|
-
|
535
|
-
# Checks if the requested spec exists in the global cache. If it does
|
536
|
-
# not, we create the relevant global cache subdirectory if it does not
|
537
|
-
# exist and copy the spec from the local cache to the global cache.
|
538
|
-
#
|
539
|
-
# @param [Specification] spec
|
540
|
-
# the spec we want to copy to the global cache.
|
541
|
-
#
|
542
|
-
# @param [String] local_cache_path
|
543
|
-
# the local directory from which we want to copy the .gem.
|
544
|
-
#
|
545
|
-
def cache_globally(spec, local_cache_path)
|
546
|
-
return unless cache_path = download_cache_path(spec)
|
547
|
-
return if cache_path.exist?
|
548
|
-
|
549
|
-
SharedHelpers.filesystem_access(cache_path.dirname, &:mkpath)
|
550
|
-
SharedHelpers.filesystem_access(cache_path) do
|
551
|
-
FileUtils.cp(local_cache_path, cache_path)
|
552
|
-
end
|
520
|
+
def download_gem(spec, download_cache_path)
|
521
|
+
uri = spec.remote.uri
|
522
|
+
Bundler.ui.confirm("Fetching #{version_message(spec)}")
|
523
|
+
Bundler.rubygems.download_gem(spec, uri, download_cache_path)
|
553
524
|
end
|
554
525
|
|
555
526
|
# Returns the global cache path of the calling Rubygems::Source object.
|
@@ -568,7 +539,7 @@ module Bundler
|
|
568
539
|
return unless remote = spec.remote
|
569
540
|
return unless cache_slug = remote.cache_slug
|
570
541
|
|
571
|
-
Bundler.user_cache.join("gems", cache_slug
|
542
|
+
Bundler.user_cache.join("gems", cache_slug)
|
572
543
|
end
|
573
544
|
|
574
545
|
def extension_cache_slug(spec)
|
@@ -24,7 +24,7 @@ module Bundler
|
|
24
24
|
|
25
25
|
specs_for_dep = spec_for_dependency(dep, match_current_platform)
|
26
26
|
if specs_for_dep.any?
|
27
|
-
specs += specs_for_dep
|
27
|
+
match_current_platform ? specs += specs_for_dep : specs |= specs_for_dep
|
28
28
|
|
29
29
|
specs_for_dep.first.dependencies.each do |d|
|
30
30
|
next if d.type == :development
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
<%- end -%>
|
17
17
|
spec.required_ruby_version = ">= <%= config[:required_ruby_version] %>"
|
18
18
|
|
19
|
-
spec.metadata["allowed_push_host"] = "TODO: Set to 'https://
|
19
|
+
spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
|
20
20
|
|
21
21
|
spec.metadata["homepage_uri"] = spec.homepage
|
22
22
|
spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Mike Perham
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|