rubygems-update 3.0.6 → 3.0.7
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 +12 -0
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/lib/rubygems.rb +1 -1
- data/lib/rubygems/commands/setup_command.rb +9 -11
- data/lib/rubygems/dependency.rb +1 -1
- data/lib/rubygems/installer.rb +7 -4
- data/lib/rubygems/resolver.rb +4 -1
- data/lib/rubygems/s3_uri_signer.rb +13 -5
- data/lib/rubygems/specification.rb +12 -13
- data/rubygems-update.gemspec +1 -1
- data/test/rubygems/test_gem.rb +34 -0
- data/test/rubygems/test_gem_commands_setup_command.rb +11 -7
- data/test/rubygems/test_gem_installer.rb +30 -2
- data/test/rubygems/test_gem_specification.rb +29 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 067ea320ef1da81eb3037d8017bd8b72398d0bf9621b8cddda0d3d12a5b53d7f
|
4
|
+
data.tar.gz: 468aa6f0452d5e93817b8266d250b17c08d4f47c9f7e597e30fd2ad5d4e69f86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02ed09ac0d47ec4b42edfa0a9ad56e1fcb931797a88cfc26af2a7b5f08695decd22e1d0cfbfc10de7eda7f7c5796da65fb1f56219d5e6eead630a184fe51a20a
|
7
|
+
data.tar.gz: 3c6c5d57a43ccde51ae86d056fe0d634aab0385daac135aad5f15a1b8e13319190fe9f5b3c3a9803dcb0c16c416059f40e7ca13bbc3666cdc3d6e21c253a2b79
|
data/.travis.yml
CHANGED
data/History.txt
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# coding: UTF-8
|
2
2
|
|
3
|
+
=== 3.0.7 / 2020-02-18
|
4
|
+
|
5
|
+
Bug fixes:
|
6
|
+
|
7
|
+
* Fix underscore version selection for bundler #2908 by David Rodríguez.
|
8
|
+
* Add missing wrapper. Pull request #2690 by David Rodríguez.
|
9
|
+
* Make Gem::Specification#ruby_code handle OpenSSL::PKey::RSA objects.
|
10
|
+
Pull request #2782 by Luis Sagastume.
|
11
|
+
* Installer.rb - fix #windows_stub_script. Pull request #2876 by MSP-Greg.
|
12
|
+
* Use IAM role to extract security-credentials for EC2 instance. Pull
|
13
|
+
request #2894 by Alexander Pakulov.
|
14
|
+
|
3
15
|
=== 3.0.6 / 2019-08-17
|
4
16
|
|
5
17
|
Bug fixes:
|
@@ -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-02-18".freeze
|
8
|
+
@git_commit_sha = "d7089abb6a".freeze
|
9
9
|
@release = false
|
10
10
|
# end ivars
|
11
11
|
|
data/lib/rubygems.rb
CHANGED
@@ -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"
|
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|
|
data/lib/rubygems/installer.rb
CHANGED
@@ -320,8 +320,11 @@ class Gem::Installer
|
|
320
320
|
build_extensions
|
321
321
|
write_build_info_file
|
322
322
|
run_post_build_hooks
|
323
|
+
end
|
324
|
+
|
325
|
+
generate_bin
|
323
326
|
|
324
|
-
|
327
|
+
unless @options[:install_as_default]
|
325
328
|
write_spec
|
326
329
|
write_cache_file
|
327
330
|
end
|
@@ -799,7 +802,7 @@ TEXT
|
|
799
802
|
# stub & ruby.exe withing same folder. Portable
|
800
803
|
<<-TEXT
|
801
804
|
@ECHO OFF
|
802
|
-
@"%~
|
805
|
+
@"%~dp0#{ruby_exe}" "%~dpn0" %*
|
803
806
|
TEXT
|
804
807
|
elsif bindir.downcase.start_with? rb_topdir.downcase
|
805
808
|
# stub within ruby folder, but not standard bin. Portable
|
@@ -809,14 +812,14 @@ TEXT
|
|
809
812
|
rel = to.relative_path_from from
|
810
813
|
<<-TEXT
|
811
814
|
@ECHO OFF
|
812
|
-
@"%~dp0#{rel}
|
815
|
+
@"%~dp0#{rel}/#{ruby_exe}" "%~dpn0" %*
|
813
816
|
TEXT
|
814
817
|
else
|
815
818
|
# outside ruby folder, maybe -user-install or bundler. Portable, but ruby
|
816
819
|
# is dependent on PATH
|
817
820
|
<<-TEXT
|
818
821
|
@ECHO OFF
|
819
|
-
|
822
|
+
@#{ruby_exe} "%~dpn0" %*
|
820
823
|
TEXT
|
821
824
|
end
|
822
825
|
end
|
data/lib/rubygems/resolver.rb
CHANGED
@@ -124,7 +124,10 @@ class Gem::Resolver
|
|
124
124
|
|
125
125
|
data = yield
|
126
126
|
$stderr.printf "%10s (%d entries)\n", stage.to_s.upcase, data.size
|
127
|
-
|
127
|
+
unless data.empty?
|
128
|
+
require 'pp'
|
129
|
+
PP.pp data, $stderr
|
130
|
+
end
|
128
131
|
end
|
129
132
|
|
130
133
|
##
|
@@ -150,16 +150,23 @@ class Gem::S3URISigner
|
|
150
150
|
require 'rubygems/request/connection_pools'
|
151
151
|
require 'json'
|
152
152
|
|
153
|
-
|
154
|
-
|
155
|
-
|
153
|
+
iam_info = ec2_metadata_request(EC2_IAM_INFO)
|
154
|
+
# Expected format: arn:aws:iam::<id>:instance-profile/<role_name>
|
155
|
+
role_name = iam_info['InstanceProfileArn'].split('/').last
|
156
|
+
ec2_metadata_request(EC2_IAM_SECURITY_CREDENTIALS + role_name)
|
157
|
+
end
|
158
|
+
|
159
|
+
def ec2_metadata_request(url)
|
160
|
+
uri = URI(url)
|
161
|
+
@request_pool ||= create_request_pool(uri)
|
162
|
+
request = Gem::Request.new(uri, Net::HTTP::Get, nil, @request_pool)
|
156
163
|
response = request.fetch
|
157
164
|
|
158
165
|
case response
|
159
166
|
when Net::HTTPOK then
|
160
167
|
JSON.parse(response.body)
|
161
168
|
else
|
162
|
-
raise InstanceProfileError.new("Unable to fetch AWS
|
169
|
+
raise InstanceProfileError.new("Unable to fetch AWS metadata from #{uri}: #{response.message} #{response.code}")
|
163
170
|
end
|
164
171
|
end
|
165
172
|
|
@@ -170,6 +177,7 @@ class Gem::S3URISigner
|
|
170
177
|
end
|
171
178
|
|
172
179
|
BASE64_URI_TRANSLATE = { "+" => "%2B", "/" => "%2F", "=" => "%3D", "\n" => "" }.freeze
|
173
|
-
|
180
|
+
EC2_IAM_INFO = "http://169.254.169.254/latest/meta-data/iam/info".freeze
|
181
|
+
EC2_IAM_SECURITY_CREDENTIALS = "http://169.254.169.254/latest/meta-data/iam/security-credentials/".freeze
|
174
182
|
|
175
183
|
end
|
@@ -2348,18 +2348,18 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2348
2348
|
|
2349
2349
|
def ruby_code(obj)
|
2350
2350
|
case obj
|
2351
|
-
when String
|
2352
|
-
when Array
|
2353
|
-
when Hash
|
2351
|
+
when String then obj.dump + ".freeze"
|
2352
|
+
when Array then '[' + obj.map { |x| ruby_code x }.join(", ") + ']'
|
2353
|
+
when Hash then
|
2354
2354
|
seg = obj.keys.sort.map { |k| "#{k.to_s.dump} => #{obj[k].to_s.dump}" }
|
2355
2355
|
"{ #{seg.join(', ')} }"
|
2356
|
-
when Gem::Version
|
2357
|
-
when DateLike
|
2358
|
-
when Time
|
2359
|
-
when Numeric
|
2360
|
-
when true, false, nil
|
2361
|
-
when Gem::Platform
|
2362
|
-
when Gem::Requirement
|
2356
|
+
when Gem::Version then obj.to_s.dump
|
2357
|
+
when DateLike then obj.strftime('%Y-%m-%d').dump
|
2358
|
+
when Time then obj.strftime('%Y-%m-%d').dump
|
2359
|
+
when Numeric then obj.inspect
|
2360
|
+
when true, false, nil then obj.inspect
|
2361
|
+
when Gem::Platform then "Gem::Platform.new(#{obj.to_a.inspect})"
|
2362
|
+
when Gem::Requirement then
|
2363
2363
|
list = obj.as_list
|
2364
2364
|
"Gem::Requirement.new(#{ruby_code(list.size == 1 ? obj.to_s : list)})"
|
2365
2365
|
else raise Gem::Exception, "ruby_code case not handled: #{obj.class}"
|
@@ -2516,9 +2516,8 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2516
2516
|
@@attributes.each do |attr_name|
|
2517
2517
|
next if handled.include? attr_name
|
2518
2518
|
current_value = self.send(attr_name)
|
2519
|
-
if current_value != default_value(attr_name)
|
2520
|
-
|
2521
|
-
result << " s.#{attr_name} = #{ruby_code current_value}"
|
2519
|
+
if current_value != default_value(attr_name) || self.class.required_attribute?(attr_name)
|
2520
|
+
result << " s.#{attr_name} = #{ruby_code current_value}" unless current_value.is_a?(OpenSSL::PKey::RSA)
|
2522
2521
|
end
|
2523
2522
|
end
|
2524
2523
|
|
data/rubygems-update.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "rubygems-update"
|
5
|
-
s.version = "3.0.
|
5
|
+
s.version = "3.0.7"
|
6
6
|
s.authors = ["Jim Weirich", "Chad Fowler", "Eric Hodel", "Luis Lavena", "Aaron Patterson", "Samuel Giddins", "André Arko", "Evan Phoenix", "Hiroshi SHIBATA"]
|
7
7
|
s.email = ["", "", "drbrain@segment7.net", "luislavena@gmail.com", "aaron@tenderlovemaking.com", "segiddins@segiddins.me", "andre@arko.net", "evan@phx.io", "hsbt@ruby-lang.org"]
|
8
8
|
|
data/test/rubygems/test_gem.rb
CHANGED
@@ -323,6 +323,40 @@ class TestGem < Gem::TestCase
|
|
323
323
|
refute_includes e.message, "can't find gem bundler (>= 0.a) with executable bundle"
|
324
324
|
end
|
325
325
|
|
326
|
+
def test_activate_bin_path_respects_underscore_selection_if_given
|
327
|
+
bundler_latest = util_spec 'bundler', '2.0.1' do |s|
|
328
|
+
s.executables = ['bundle']
|
329
|
+
end
|
330
|
+
|
331
|
+
bundler_previous = util_spec 'bundler', '1.17.3' do |s|
|
332
|
+
s.executables = ['bundle']
|
333
|
+
end
|
334
|
+
|
335
|
+
install_specs bundler_latest, bundler_previous
|
336
|
+
|
337
|
+
File.open("Gemfile.lock", "w") do |f|
|
338
|
+
f.write <<-L.gsub(/ {8}/, "")
|
339
|
+
GEM
|
340
|
+
remote: https://rubygems.org/
|
341
|
+
specs:
|
342
|
+
|
343
|
+
PLATFORMS
|
344
|
+
ruby
|
345
|
+
|
346
|
+
DEPENDENCIES
|
347
|
+
|
348
|
+
BUNDLED WITH
|
349
|
+
2.0.1
|
350
|
+
L
|
351
|
+
end
|
352
|
+
|
353
|
+
File.open("Gemfile", "w") { |f| f.puts('source "https://rubygems.org"') }
|
354
|
+
|
355
|
+
load Gem.activate_bin_path("bundler", "bundle", "= 1.17.3")
|
356
|
+
|
357
|
+
assert_equal %w(bundler-1.17.3), loaded_spec_names
|
358
|
+
end
|
359
|
+
|
326
360
|
def test_self_bin_path_no_exec_name
|
327
361
|
e = assert_raises ArgumentError do
|
328
362
|
Gem.bin_path 'a'
|
@@ -38,6 +38,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
38
38
|
FileUtils.mkdir_p 'default/gems'
|
39
39
|
|
40
40
|
gemspec = Gem::Specification.new
|
41
|
+
gemspec.author = "Us"
|
41
42
|
gemspec.name = "bundler"
|
42
43
|
gemspec.version = BUNDLER_VERS
|
43
44
|
gemspec.bindir = "exe"
|
@@ -166,16 +167,19 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
166
167
|
def test_install_default_bundler_gem
|
167
168
|
@cmd.extend FileUtils
|
168
169
|
|
169
|
-
@
|
170
|
+
bin_dir = File.join(@gemhome, 'bin')
|
171
|
+
@cmd.install_default_bundler_gem bin_dir
|
170
172
|
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
spec = Gem::Specification.load(default_spec_path)
|
173
|
+
bundler_spec = Gem::Specification.load("bundler/bundler.gemspec")
|
174
|
+
default_spec_path = File.join(Gem::Specification.default_specifications_dir, "#{bundler_spec.full_name}.gemspec")
|
175
|
+
spec = Gem::Specification.load(default_spec_path)
|
175
176
|
|
176
|
-
|
177
|
-
|
177
|
+
spec.executables.each do |e|
|
178
|
+
if Gem.win_platform?
|
179
|
+
assert_path_exists File.join(bin_dir, "#{e}.bat")
|
178
180
|
end
|
181
|
+
|
182
|
+
assert_path_exists File.join bin_dir, e
|
179
183
|
end
|
180
184
|
|
181
185
|
default_dir = Gem::Specification.default_specifications_dir
|
@@ -1822,10 +1822,10 @@ gem 'other', version
|
|
1822
1822
|
assert_predicate spec, :default_gem?
|
1823
1823
|
end
|
1824
1824
|
|
1825
|
-
def
|
1825
|
+
def test_default_gem_without_wrappers
|
1826
1826
|
FileUtils.rm_f File.join(Gem.dir, 'specifications')
|
1827
1827
|
|
1828
|
-
@installer.wrappers =
|
1828
|
+
@installer.wrappers = false
|
1829
1829
|
@installer.options[:install_as_default] = true
|
1830
1830
|
@installer.gem_dir = @spec.gem_dir
|
1831
1831
|
|
@@ -1843,6 +1843,34 @@ gem 'other', version
|
|
1843
1843
|
default_spec = eval File.read File.join(Gem.default_dir, 'specifications', 'default', 'a-2.gemspec')
|
1844
1844
|
assert_equal Gem::Version.new("2"), default_spec.version
|
1845
1845
|
assert_equal ['bin/executable'], default_spec.files
|
1846
|
+
|
1847
|
+
assert_directory_exists util_inst_bindir
|
1848
|
+
|
1849
|
+
installed_exec = File.join util_inst_bindir, 'executable'
|
1850
|
+
assert_path_exists installed_exec
|
1851
|
+
|
1852
|
+
wrapper = File.read installed_exec
|
1853
|
+
refute_match %r|generated by RubyGems|, wrapper
|
1854
|
+
end
|
1855
|
+
|
1856
|
+
def test_default_gem_with_wrappers
|
1857
|
+
FileUtils.rm_f File.join(Gem.dir, 'specifications')
|
1858
|
+
|
1859
|
+
@installer.wrappers = true
|
1860
|
+
@installer.options[:install_as_default] = true
|
1861
|
+
@installer.gem_dir = @spec.gem_dir
|
1862
|
+
|
1863
|
+
use_ui @ui do
|
1864
|
+
@installer.install
|
1865
|
+
end
|
1866
|
+
|
1867
|
+
assert_directory_exists util_inst_bindir
|
1868
|
+
|
1869
|
+
installed_exec = File.join util_inst_bindir, 'executable'
|
1870
|
+
assert_path_exists installed_exec
|
1871
|
+
|
1872
|
+
wrapper = File.read installed_exec
|
1873
|
+
assert_match %r|generated by RubyGems|, wrapper
|
1846
1874
|
end
|
1847
1875
|
|
1848
1876
|
def test_default_gem_with_exe_as_bindir
|
@@ -2419,6 +2419,35 @@ end
|
|
2419
2419
|
assert_equal @a2, same_spec
|
2420
2420
|
end
|
2421
2421
|
|
2422
|
+
def test_to_ruby_with_rsa_key
|
2423
|
+
rsa_key = OpenSSL::PKey::RSA.new(2048)
|
2424
|
+
@a2.signing_key = rsa_key
|
2425
|
+
ruby_code = @a2.to_ruby
|
2426
|
+
|
2427
|
+
expected = <<-SPEC
|
2428
|
+
# -*- encoding: utf-8 -*-
|
2429
|
+
# stub: a 2 ruby lib
|
2430
|
+
|
2431
|
+
Gem::Specification.new do |s|
|
2432
|
+
s.name = "a".freeze
|
2433
|
+
s.version = "2"
|
2434
|
+
|
2435
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
2436
|
+
s.require_paths = ["lib".freeze]
|
2437
|
+
s.authors = ["A User".freeze]
|
2438
|
+
s.date = "#{Gem::Specification::TODAY.strftime "%Y-%m-%d"}"
|
2439
|
+
s.description = "This is a test description".freeze
|
2440
|
+
s.email = "example@example.com".freeze
|
2441
|
+
s.files = ["lib/code.rb".freeze]
|
2442
|
+
s.homepage = "http://example.com".freeze
|
2443
|
+
s.rubygems_version = "#{Gem::VERSION}".freeze
|
2444
|
+
s.summary = "this is a summary".freeze
|
2445
|
+
end
|
2446
|
+
SPEC
|
2447
|
+
|
2448
|
+
assert_equal expected, ruby_code
|
2449
|
+
end
|
2450
|
+
|
2422
2451
|
def test_to_ruby_for_cache
|
2423
2452
|
@a2.add_runtime_dependency 'b', '1'
|
2424
2453
|
@a2.dependencies.first.instance_variable_set :@type, nil
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubygems-update
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Weirich
|
@@ -16,7 +16,7 @@ authors:
|
|
16
16
|
autorequire:
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
|
-
date:
|
19
|
+
date: 2020-02-18 00:00:00.000000000 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: builder
|