Skip to content

Commit 6a187a0

Browse files
committed
Honor concurrent_downloads from gemrc
1 parent d3e6248 commit 6a187a0

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

lib/rubygems/config_file.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ def initialize(args)
220220
@hash.transform_keys! do |k|
221221
# gemhome and gempath are not working with symbol keys
222222
if %w[backtrace bulk_threshold verbose update_sources cert_expiration_length_days
223-
install_extension_in_lib ipv4_fallback_enabled global_gem_cache sources
223+
concurrent_downloads install_extension_in_lib ipv4_fallback_enabled
224+
global_gem_cache sources
224225
disable_default_gem_server ssl_verify_mode ssl_ca_cert ssl_client_cert].include?(k)
225226
k.to_sym
226227
else
@@ -233,7 +234,7 @@ def initialize(args)
233234
@bulk_threshold = @hash[:bulk_threshold] if @hash.key? :bulk_threshold
234235
@verbose = @hash[:verbose] if @hash.key? :verbose
235236
@update_sources = @hash[:update_sources] if @hash.key? :update_sources
236-
# TODO: We should handle concurrent_downloads same as other options
237+
@concurrent_downloads = @hash[:concurrent_downloads] if @hash.key? :concurrent_downloads
237238
@cert_expiration_length_days = @hash[:cert_expiration_length_days] if @hash.key? :cert_expiration_length_days
238239
@install_extension_in_lib = @hash[:install_extension_in_lib] if @hash.key? :install_extension_in_lib
239240
@ipv4_fallback_enabled = @hash[:ipv4_fallback_enabled] if @hash.key? :ipv4_fallback_enabled

test/rubygems/test_gem_config_file.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,16 @@ def test_initialize_global_gem_cache_gemrc
113113
assert_equal true, @cfg.global_gem_cache
114114
end
115115

116+
def test_initialize_concurrent_downloads
117+
File.open @temp_conf, "w" do |fp|
118+
fp.puts "concurrent_downloads: 2"
119+
end
120+
121+
util_config_file %W[--config-file #{@temp_conf}]
122+
123+
assert_equal 2, @cfg.concurrent_downloads
124+
end
125+
116126
def test_initialize_handle_arguments_config_file
117127
util_config_file %W[--config-file #{@temp_conf}]
118128

0 commit comments

Comments
 (0)