rubygems-update 3.0.4 → 3.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/History.txt +85 -0
- data/Manifest.txt +5 -3
- data/Rakefile +8 -6
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/lib/rubygems.rb +6 -12
- data/lib/rubygems/commands/push_command.rb +2 -0
- data/lib/rubygems/commands/setup_command.rb +9 -11
- data/lib/rubygems/commands/uninstall_command.rb +16 -6
- data/lib/rubygems/commands/which_command.rb +1 -3
- data/lib/rubygems/defaults.rb +1 -8
- data/lib/rubygems/dependency.rb +1 -1
- data/lib/rubygems/dependency_installer.rb +1 -2
- data/lib/rubygems/exceptions.rb +0 -4
- data/lib/rubygems/gemcutter_utilities.rb +9 -5
- data/lib/rubygems/installer.rb +8 -5
- data/lib/rubygems/installer_test_case.rb +2 -2
- data/lib/rubygems/package/tar_header.rb +11 -2
- data/lib/rubygems/remote_fetcher.rb +15 -54
- data/lib/rubygems/request.rb +1 -1
- data/lib/rubygems/request_set/gem_dependency_api.rb +3 -5
- data/lib/rubygems/resolver.rb +4 -1
- data/lib/rubygems/s3_uri_signer.rb +183 -0
- data/lib/rubygems/security_option.rb +0 -1
- data/lib/rubygems/specification.rb +13 -14
- data/lib/rubygems/ssl_certs/{index.rubygems.org → rubygems.org}/GlobalSignRootCA.pem +0 -0
- data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +21 -0
- data/lib/rubygems/stub_specification.rb +1 -2
- data/lib/rubygems/test_case.rb +8 -4
- data/lib/rubygems/util.rb +12 -0
- data/rubygems-update.gemspec +1 -1
- data/test/rubygems/test_bundled_ca.rb +7 -4
- data/test/rubygems/test_gem.rb +40 -3
- data/test/rubygems/test_gem_commands_push_command.rb +15 -0
- data/test/rubygems/test_gem_commands_setup_command.rb +11 -7
- data/test/rubygems/test_gem_commands_uninstall_command.rb +80 -1
- data/test/rubygems/test_gem_indexer.rb +8 -8
- data/test/rubygems/test_gem_installer.rb +78 -19
- data/test/rubygems/test_gem_package_tar_header.rb +41 -0
- data/test/rubygems/test_gem_remote_fetcher.rb +133 -14
- data/test/rubygems/test_gem_request.rb +4 -4
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +20 -30
- data/test/rubygems/test_gem_specification.rb +29 -0
- data/test/rubygems/test_gem_util.rb +8 -0
- data/util/cops/deprecations.rb +52 -0
- data/util/create_certs.sh +27 -0
- data/util/update_bundled_ca_certificates.rb +1 -3
- metadata +12 -9
- data/lib/rubygems/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e1fcd26ebdb712316751bc03f488cc9d81bec96aa3e2a05be9744daea7a0c9f
|
4
|
+
data.tar.gz: d54a3231c23976e9c5d1fe04ffeb2f0924706c4d5aebfa0f5d367fd8c94a805b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9603fa015ec2c7a56aa30512366bbb3d16246d12084ae01424b94505b41c71886d3676055d81ecb3bc3b3a4c39fa2e330e00117a457cdeb957cb4e0877d67970
|
7
|
+
data.tar.gz: 796d607c5e7b69cd9f7e3886c2d1705e9d4df0ded3bf24f0648c2cd29cf52d9f4a284721abd74a62a2598e7a67b055b8d58c096db574ee6ba271d6adfba5d196
|
data/.travis.yml
CHANGED
data/History.txt
CHANGED
@@ -1,5 +1,90 @@
|
|
1
1
|
# coding: UTF-8
|
2
2
|
|
3
|
+
=== 3.0.9 / 2020-12-09
|
4
|
+
|
5
|
+
Minor enhancements:
|
6
|
+
|
7
|
+
* Add GlobalSign Root CA - R3 cert and remove outdated certs. Pull request #4100
|
8
|
+
by Aditya Prakash.
|
9
|
+
|
10
|
+
=== 3.0.8 / 2020-02-19
|
11
|
+
|
12
|
+
Bug fixes:
|
13
|
+
|
14
|
+
* Gem::Specification#to_ruby needs OpenSSL. Pull request #2937 by
|
15
|
+
Nobuyoshi Nakada.
|
16
|
+
|
17
|
+
=== 3.0.7 / 2020-02-18
|
18
|
+
|
19
|
+
Bug fixes:
|
20
|
+
|
21
|
+
* Fix underscore version selection for bundler #2908 by David Rodríguez.
|
22
|
+
* Add missing wrapper. Pull request #2690 by David Rodríguez.
|
23
|
+
* Make Gem::Specification#ruby_code handle OpenSSL::PKey::RSA objects.
|
24
|
+
Pull request #2782 by Luis Sagastume.
|
25
|
+
* Installer.rb - fix #windows_stub_script. Pull request #2876 by MSP-Greg.
|
26
|
+
* Use IAM role to extract security-credentials for EC2 instance. Pull
|
27
|
+
request #2894 by Alexander Pakulov.
|
28
|
+
|
29
|
+
=== 3.0.6 / 2019-08-17
|
30
|
+
|
31
|
+
Bug fixes:
|
32
|
+
|
33
|
+
* Revert #2813. It broke the compatibility with 3.0.x versions.
|
34
|
+
|
35
|
+
=== 3.0.5 / 2019-08-16
|
36
|
+
|
37
|
+
Minor enhancements:
|
38
|
+
|
39
|
+
* Use env var to configure api key on push. Pull request #2559 by Luis
|
40
|
+
Sagastume.
|
41
|
+
* Unswallow uninstall error. Pull request #2707 by David Rodríguez.
|
42
|
+
* Expose windows path normalization utility. Pull request #2767 by David
|
43
|
+
Rodríguez.
|
44
|
+
* Clean which command. Pull request #2801 by Luis Sagastume.
|
45
|
+
* Upgrading S3 source signature to AWS SigV4. Pull request #2807 by
|
46
|
+
Alexander Pakulov.
|
47
|
+
* Remove missleading comment, no reason to move Gem.host to Gem::Util.
|
48
|
+
Pull request #2811 by Luis Sagastume.
|
49
|
+
* Drop support for 'gem env packageversion'. Pull request #2813 by Luis
|
50
|
+
Sagastume.
|
51
|
+
* Take into account just git tracked files in update_manifest rake task.
|
52
|
+
Pull request #2816 by Luis Sagastume.
|
53
|
+
* Remove TODO comment, there's no Gem::Dirs constant. Pull request #2819
|
54
|
+
by Luis Sagastume.
|
55
|
+
* Remove unused 'raise' from test_case. Pull request #2820 by Luis
|
56
|
+
Sagastume.
|
57
|
+
* Move TODO comment to an information comment. Pull request #2821 by Luis
|
58
|
+
Sagastume.
|
59
|
+
* Use File#open instead of Kernel#open in stub_specification.rb. Pull
|
60
|
+
request #2834 by Luis Sagastume.
|
61
|
+
* Make error code a gemcutter_utilities a constant. Pull request #2844 by
|
62
|
+
Luis Sagastume.
|
63
|
+
* Remove FIXME comment related to PathSupport. Pull request #2854 by Luis
|
64
|
+
Sagastume.
|
65
|
+
* Use gsub with Hash. Pull request #2860 by Kazuhiro NISHIYAMA.
|
66
|
+
* Use the standard RUBY_ENGINE_VERSION instead of JRUBY_VERSION. Pull
|
67
|
+
request #2864 by Benoit Daloze.
|
68
|
+
* Do not mutate uri.query during s3 signature creation. Pull request #2874
|
69
|
+
by Alexander Pakulov.
|
70
|
+
* Fixup #2844. Pull request #2878 by SHIBATA Hiroshi.
|
71
|
+
|
72
|
+
Bug fixes:
|
73
|
+
|
74
|
+
* Fix intermittent test error on Appveyor & Travis. Pull request #2568 by
|
75
|
+
MSP-Greg.
|
76
|
+
* Extend timeout on assert_self_install_permissions. Pull request #2605 by
|
77
|
+
SHIBATA Hiroshi.
|
78
|
+
* Better folder assertions. Pull request #2644 by David Rodríguez.
|
79
|
+
* Fix default gem executable installation when folder is not `bin/`. Pull
|
80
|
+
request #2649 by David Rodríguez.
|
81
|
+
* Fix gem uninstall behavior. Pull request #2663 by Luis Sagastume.
|
82
|
+
* Fix for large values in UID/GID fields in tar archives. Pull request
|
83
|
+
#2780 by Alexey Shein.
|
84
|
+
* Fixed task order for release. Pull request #2792 by SHIBATA Hiroshi.
|
85
|
+
* Ignore GEMRC variable for test suite. Pull request #2837 by SHIBATA
|
86
|
+
Hiroshi.
|
87
|
+
|
3
88
|
=== 3.0.4 / 2019-06-14
|
4
89
|
|
5
90
|
Minor enhancements:
|
data/Manifest.txt
CHANGED
@@ -413,6 +413,7 @@ lib/rubygems/resolver/specification.rb
|
|
413
413
|
lib/rubygems/resolver/stats.rb
|
414
414
|
lib/rubygems/resolver/vendor_set.rb
|
415
415
|
lib/rubygems/resolver/vendor_specification.rb
|
416
|
+
lib/rubygems/s3_uri_signer.rb
|
416
417
|
lib/rubygems/safe_yaml.rb
|
417
418
|
lib/rubygems/security.rb
|
418
419
|
lib/rubygems/security/policies.rb
|
@@ -435,9 +436,8 @@ lib/rubygems/spec_fetcher.rb
|
|
435
436
|
lib/rubygems/specification.rb
|
436
437
|
lib/rubygems/specification_policy.rb
|
437
438
|
lib/rubygems/ssl_certs/.document
|
438
|
-
lib/rubygems/ssl_certs/
|
439
|
-
lib/rubygems/ssl_certs/rubygems.
|
440
|
-
lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem
|
439
|
+
lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA.pem
|
440
|
+
lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem
|
441
441
|
lib/rubygems/stub_specification.rb
|
442
442
|
lib/rubygems/syck_hack.rb
|
443
443
|
lib/rubygems/test_case.rb
|
@@ -639,7 +639,9 @@ test/rubygems/wrong_key_cert.pem
|
|
639
639
|
test/rubygems/wrong_key_cert_32.pem
|
640
640
|
util/CL2notes
|
641
641
|
util/ci
|
642
|
+
util/cops/deprecations.rb
|
642
643
|
util/create_certs.rb
|
644
|
+
util/create_certs.sh
|
643
645
|
util/create_encrypted_key.rb
|
644
646
|
util/generate_spdx_license_list.rb
|
645
647
|
util/patch_with_prs.rb
|
data/Rakefile
CHANGED
@@ -79,7 +79,7 @@ end
|
|
79
79
|
# --------------------------------------------------------------------
|
80
80
|
# Creating a release
|
81
81
|
|
82
|
-
task :prerelease => %w[clobber test bundler:build_metadata check_deprecations
|
82
|
+
task :prerelease => %w[clobber test bundler:build_metadata check_deprecations]
|
83
83
|
task :postrelease => %w[bundler:build_metadata:clean upload guides:publish blog:publish]
|
84
84
|
|
85
85
|
desc "Check for deprecated methods with expired deprecation horizon"
|
@@ -93,9 +93,10 @@ end
|
|
93
93
|
|
94
94
|
desc "Release rubygems-#{v}"
|
95
95
|
task :release => :prerelease do
|
96
|
+
Rake::Task["package"].invoke
|
96
97
|
sh "gem push pkg/rubygems-update-#{v}.gem"
|
98
|
+
Rake::Task["postrelease"].invoke
|
97
99
|
end
|
98
|
-
Rake::Task["release"].enhance(["postrelease"])
|
99
100
|
|
100
101
|
Gem::PackageTask.new(spec) {}
|
101
102
|
|
@@ -128,7 +129,7 @@ end
|
|
128
129
|
|
129
130
|
file "pkg/rubygems-#{v}.tgz" => "pkg/rubygems-#{v}" do
|
130
131
|
cd 'pkg' do
|
131
|
-
sh "tar -czf rubygems-#{v}.tgz rubygems-#{v}"
|
132
|
+
sh "tar -czf rubygems-#{v}.tgz --owner=rubygems:0 --group=rubygems:0 rubygems-#{v}"
|
132
133
|
end
|
133
134
|
end
|
134
135
|
|
@@ -362,9 +363,10 @@ end
|
|
362
363
|
desc "Update the manifest to reflect what's on disk"
|
363
364
|
task :update_manifest do
|
364
365
|
files = []
|
365
|
-
|
366
|
-
|
367
|
-
|
366
|
+
exclude = %r[\.git|\./bundler/(?!lib|man|exe|[^/]+\.md|bundler.gemspec)]ox
|
367
|
+
tracked_files = `git ls-files --recurse-submodules`.split("\n").map {|f| "./#{f}" }
|
368
|
+
|
369
|
+
tracked_files.each do |path|
|
368
370
|
next unless File.file?(path)
|
369
371
|
next if path =~ exclude
|
370
372
|
files << path[2..-1]
|
@@ -4,8 +4,8 @@ module Bundler
|
|
4
4
|
# Represents metadata from when the Bundler gem was built.
|
5
5
|
module BuildMetadata
|
6
6
|
# begin ivars
|
7
|
-
@built_at = "
|
8
|
-
@git_commit_sha = "
|
7
|
+
@built_at = "2020-12-09".freeze
|
8
|
+
@git_commit_sha = "d7089abb6a".freeze
|
9
9
|
@release = false
|
10
10
|
# end ivars
|
11
11
|
|
data/lib/rubygems.rb
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
require 'rbconfig'
|
10
10
|
|
11
11
|
module Gem
|
12
|
-
VERSION = "3.0.
|
12
|
+
VERSION = "3.0.9".freeze
|
13
13
|
end
|
14
14
|
|
15
15
|
# Must be first since it unloads the prelude from 1.9.2
|
@@ -568,8 +568,6 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
|
|
568
568
|
#++
|
569
569
|
#--
|
570
570
|
#
|
571
|
-
# FIXME move to pathsupport
|
572
|
-
#
|
573
571
|
#++
|
574
572
|
|
575
573
|
def self.find_home
|
@@ -642,14 +640,12 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
|
|
642
640
|
# <tt>https://rubygems.org</tt>.
|
643
641
|
|
644
642
|
def self.host
|
645
|
-
# TODO: move to utils
|
646
643
|
@host ||= Gem::DEFAULT_HOST
|
647
644
|
end
|
648
645
|
|
649
646
|
## Set the default RubyGems API host.
|
650
647
|
|
651
648
|
def self.host=(host)
|
652
|
-
# TODO: move to utils
|
653
649
|
@host = host
|
654
650
|
end
|
655
651
|
|
@@ -1377,14 +1373,12 @@ begin
|
|
1377
1373
|
rescue LoadError
|
1378
1374
|
end
|
1379
1375
|
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
# Defaults the Ruby implementation wants to provide for RubyGems
|
1376
|
+
begin
|
1377
|
+
##
|
1378
|
+
# Defaults the Ruby implementation wants to provide for RubyGems
|
1384
1379
|
|
1385
|
-
|
1386
|
-
|
1387
|
-
end
|
1380
|
+
require "rubygems/defaults/#{RUBY_ENGINE}"
|
1381
|
+
rescue LoadError
|
1388
1382
|
end
|
1389
1383
|
|
1390
1384
|
##
|
@@ -15,6 +15,8 @@ https://rubygems.org) and adds it to the index.
|
|
15
15
|
|
16
16
|
The gem can be removed from the index and deleted from the server using the yank
|
17
17
|
command. For further discussion see the help for the yank command.
|
18
|
+
|
19
|
+
The push command will use ~/.gem/credentials to authenticate to a server, but you can use the RubyGems environment variable GEM_HOST_API_KEY to set the api key to authenticate.
|
18
20
|
EOF
|
19
21
|
end
|
20
22
|
|
@@ -128,7 +128,7 @@ By default, this RubyGems will install gem as:
|
|
128
128
|
end
|
129
129
|
|
130
130
|
module MakeDirs
|
131
|
-
def mkdir_p(path,
|
131
|
+
def mkdir_p(path, **opts)
|
132
132
|
super
|
133
133
|
(@mkdirs ||= []) << path
|
134
134
|
end
|
@@ -164,7 +164,7 @@ By default, this RubyGems will install gem as:
|
|
164
164
|
|
165
165
|
remove_old_lib_files lib_dir
|
166
166
|
|
167
|
-
install_default_bundler_gem
|
167
|
+
install_default_bundler_gem bin_dir
|
168
168
|
|
169
169
|
if mode = options[:dir_mode]
|
170
170
|
@mkdirs.uniq!
|
@@ -240,14 +240,13 @@ By default, this RubyGems will install gem as:
|
|
240
240
|
prog_mode = options[:prog_mode] || 0755
|
241
241
|
|
242
242
|
executables = { 'gem' => 'bin' }
|
243
|
-
executables['bundler'] = 'bundler/exe' if Gem::USE_BUNDLER_FOR_GEMDEPS
|
244
243
|
executables.each do |tool, path|
|
245
244
|
say "Installing #{tool} executable" if @verbose
|
246
245
|
|
247
246
|
Dir.chdir path do
|
248
247
|
bin_files = Dir['*']
|
249
248
|
|
250
|
-
bin_files -= %w[update_rubygems
|
249
|
+
bin_files -= %w[update_rubygems]
|
251
250
|
|
252
251
|
bin_files.each do |bin_file|
|
253
252
|
bin_file_formatted = if options[:format_executable]
|
@@ -382,7 +381,7 @@ By default, this RubyGems will install gem as:
|
|
382
381
|
return false
|
383
382
|
end
|
384
383
|
|
385
|
-
def install_default_bundler_gem
|
384
|
+
def install_default_bundler_gem(bin_dir)
|
386
385
|
return unless Gem::USE_BUNDLER_FOR_GEMDEPS
|
387
386
|
|
388
387
|
specs_dir = Gem::Specification.default_specifications_dir
|
@@ -427,13 +426,12 @@ By default, this RubyGems will install gem as:
|
|
427
426
|
cp File.join("bundler", bundler_spec.bindir, e), File.join(bundler_bin_dir, e)
|
428
427
|
end
|
429
428
|
|
430
|
-
|
431
|
-
require 'rubygems/installer'
|
429
|
+
require 'rubygems/installer'
|
432
430
|
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
431
|
+
Dir.chdir("bundler") do
|
432
|
+
built_gem = Gem::Package.build(bundler_spec)
|
433
|
+
installer = Gem::Installer.at(built_gem, env_shebang: options[:env_shebang], install_as_default: true, bin_dir: bin_dir, wrappers: true)
|
434
|
+
installer.install
|
437
435
|
end
|
438
436
|
|
439
437
|
say "Bundler #{bundler_spec.version} installed"
|
@@ -148,10 +148,13 @@ that is a dependency of an existing gem. You can use the
|
|
148
148
|
|
149
149
|
def uninstall_specific
|
150
150
|
deplist = Gem::DependencyList.new
|
151
|
+
original_gem_version = {}
|
151
152
|
|
152
153
|
get_all_gem_names_and_versions.each do |name, version|
|
153
|
-
|
154
|
-
|
154
|
+
original_gem_version[name] = version || options[:version]
|
155
|
+
|
156
|
+
gem_specs = Gem::Specification.find_all_by_name(name, original_gem_version[name])
|
157
|
+
|
155
158
|
say("Gem '#{name}' is not installed") if gem_specs.empty?
|
156
159
|
gem_specs.each do |spec|
|
157
160
|
deplist.add spec
|
@@ -160,16 +163,23 @@ that is a dependency of an existing gem. You can use the
|
|
160
163
|
|
161
164
|
deps = deplist.strongly_connected_components.flatten.reverse
|
162
165
|
|
166
|
+
gems_to_uninstall = {}
|
167
|
+
|
163
168
|
deps.each do |dep|
|
164
|
-
|
165
|
-
|
169
|
+
unless gems_to_uninstall[dep.name]
|
170
|
+
gems_to_uninstall[dep.name] = true
|
171
|
+
|
172
|
+
unless original_gem_version[dep.name] == Gem::Requirement.default
|
173
|
+
options[:version] = dep.version
|
174
|
+
end
|
175
|
+
|
176
|
+
uninstall_gem(dep.name)
|
177
|
+
end
|
166
178
|
end
|
167
179
|
end
|
168
180
|
|
169
181
|
def uninstall_gem(gem_name)
|
170
182
|
uninstall(gem_name)
|
171
|
-
rescue Gem::InstallError
|
172
|
-
nil
|
173
183
|
rescue Gem::GemNotInHomeException => e
|
174
184
|
spec = e.spec
|
175
185
|
alert("In order to remove #{spec.name}, please execute:\n" +
|
@@ -52,13 +52,11 @@ requiring to see why it does not behave as you expect.
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
# TODO: this is totally redundant and stupid
|
56
55
|
paths = find_paths arg, dirs
|
57
56
|
|
58
57
|
if paths.empty?
|
59
58
|
alert_error "Can't find Ruby library file or shared library #{arg}"
|
60
|
-
|
61
|
-
found &&= false
|
59
|
+
found = false
|
62
60
|
else
|
63
61
|
say paths
|
64
62
|
end
|
data/lib/rubygems/defaults.rb
CHANGED
@@ -122,15 +122,8 @@ module Gem
|
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
125
|
-
##
|
126
|
-
# A wrapper around RUBY_ENGINE const that may not be defined
|
127
|
-
|
128
125
|
def self.ruby_engine
|
129
|
-
|
130
|
-
RUBY_ENGINE
|
131
|
-
else
|
132
|
-
'ruby'
|
133
|
-
end
|
126
|
+
RUBY_ENGINE
|
134
127
|
end
|
135
128
|
|
136
129
|
##
|
data/lib/rubygems/dependency.rb
CHANGED
@@ -281,7 +281,7 @@ class Gem::Dependency
|
|
281
281
|
requirement.satisfied_by?(spec.version) && env_req.satisfied_by?(spec.version)
|
282
282
|
}.map(&:to_spec)
|
283
283
|
|
284
|
-
Gem::BundlerVersionFinder.filter!(matches) if name == "bundler".freeze
|
284
|
+
Gem::BundlerVersionFinder.filter!(matches) if name == "bundler".freeze && !requirement.specific?
|
285
285
|
|
286
286
|
if platform_only
|
287
287
|
matches.reject! { |spec|
|
@@ -213,9 +213,8 @@ class Gem::DependencyInstaller
|
|
213
213
|
|
214
214
|
if consider_remote?
|
215
215
|
begin
|
216
|
-
#
|
216
|
+
# This is pulled from #spec_for_dependency to allow
|
217
217
|
# us to filter tuples before fetching specs.
|
218
|
-
#
|
219
218
|
tuples, errors = Gem::SpecFetcher.fetcher.search_for_dependency dep
|
220
219
|
|
221
220
|
if best_only && !tuples.empty?
|
data/lib/rubygems/exceptions.rb
CHANGED
@@ -7,6 +7,8 @@ require 'rubygems/text'
|
|
7
7
|
|
8
8
|
module Gem::GemcutterUtilities
|
9
9
|
|
10
|
+
ERROR_CODE = 1
|
11
|
+
|
10
12
|
include Gem::Text
|
11
13
|
|
12
14
|
# TODO: move to Gem::Command
|
@@ -41,7 +43,9 @@ module Gem::GemcutterUtilities
|
|
41
43
|
# The API key from the command options or from the user's configuration.
|
42
44
|
|
43
45
|
def api_key
|
44
|
-
if
|
46
|
+
if ENV["GEM_HOST_API_KEY"]
|
47
|
+
ENV["GEM_HOST_API_KEY"]
|
48
|
+
elsif options[:key]
|
45
49
|
verify_api_key options[:key]
|
46
50
|
elsif Gem.configuration.api_keys.key?(host)
|
47
51
|
Gem.configuration.api_keys[host]
|
@@ -79,7 +83,7 @@ module Gem::GemcutterUtilities
|
|
79
83
|
self.host = host if host
|
80
84
|
unless self.host
|
81
85
|
alert_error "You must specify a gem server"
|
82
|
-
terminate_interaction
|
86
|
+
terminate_interaction(ERROR_CODE)
|
83
87
|
end
|
84
88
|
|
85
89
|
if allowed_push_host
|
@@ -88,7 +92,7 @@ module Gem::GemcutterUtilities
|
|
88
92
|
|
89
93
|
unless (host_uri.scheme == allowed_host_uri.scheme) && (host_uri.host == allowed_host_uri.host)
|
90
94
|
alert_error "#{self.host.inspect} is not allowed by the gemspec, which only allows #{allowed_push_host.inspect}"
|
91
|
-
terminate_interaction
|
95
|
+
terminate_interaction(ERROR_CODE)
|
92
96
|
end
|
93
97
|
end
|
94
98
|
|
@@ -148,7 +152,7 @@ module Gem::GemcutterUtilities
|
|
148
152
|
Gem.configuration.api_keys[key]
|
149
153
|
else
|
150
154
|
alert_error "No such API key. Please add it to your configuration (done automatically on initial `gem push`)."
|
151
|
-
terminate_interaction
|
155
|
+
terminate_interaction(ERROR_CODE)
|
152
156
|
end
|
153
157
|
end
|
154
158
|
|
@@ -172,7 +176,7 @@ module Gem::GemcutterUtilities
|
|
172
176
|
message = "#{error_prefix}: #{message}" if error_prefix
|
173
177
|
|
174
178
|
say clean_text(message)
|
175
|
-
terminate_interaction
|
179
|
+
terminate_interaction(ERROR_CODE)
|
176
180
|
end
|
177
181
|
end
|
178
182
|
|