From 5335ce0e060c7a2a0b01c57f8f8a64254f2658e1 Mon Sep 17 00:00:00 2001 From: hsbt Date: Wed, 21 Nov 2018 10:20:47 +0000 Subject: Merge master branch from rubygems/rubygems upstream. * Enable Style/MethodDefParentheses in Rubocop https://github.com/rubygems/rubygems/pull/2478 * Enable Style/MultilineIfThen in Rubocop https://github.com/rubygems/rubygems/pull/2479 * Fix required_ruby_version with prereleases and improve error message https://github.com/rubygems/rubygems/pull/2344 * Fix bundler rubygems binstub not properly looking for bundler https://github.com/rubygems/rubygems/pull/2426 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rubygems/server.rb | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'lib/rubygems/server.rb') diff --git a/lib/rubygems/server.rb b/lib/rubygems/server.rb index 5c65f74aa3..1453bf2323 100644 --- a/lib/rubygems/server.rb +++ b/lib/rubygems/server.rb @@ -450,7 +450,7 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; } @have_rdoc_4_plus = nil end - def add_date res + def add_date(res) res['date'] = @spec_dirs.map do |spec_dir| File.stat(spec_dir).mtime end.max @@ -462,8 +462,8 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; } end end - def doc_root gem_name - if have_rdoc_4_plus? then + def doc_root(gem_name) + if have_rdoc_4_plus? "/doc_root/#{u gem_name}/" else "/doc_root/#{u gem_name}/rdoc/index.html" @@ -491,14 +491,14 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; } specs = Marshal.dump specs - if req.path =~ /\.gz$/ then + if req.path =~ /\.gz$/ specs = Gem::Util.gzip specs res['content-type'] = 'application/x-gzip' else res['content-type'] = 'application/octet-stream' end - if req.request_method == 'HEAD' then + if req.request_method == 'HEAD' res['content-length'] = specs.length else res.body << specs @@ -509,7 +509,7 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; } # Creates server sockets based on the addresses option. If no addresses # were given a server socket for all interfaces is created. - def listen addresses = @addresses + def listen(addresses = @addresses) addresses = [nil] unless addresses listeners = 0 @@ -529,14 +529,14 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; } end end - if @server.listeners.empty? then + if @server.listeners.empty? say "Unable to start a server." say "Check for running servers or your --bind and --port arguments" terminate_interaction 1 end end - def prerelease_specs req, res + def prerelease_specs(req, res) reset_gems res['content-type'] = 'application/x-gzip' @@ -552,14 +552,14 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; } specs = Marshal.dump specs - if req.path =~ /\.gz$/ then + if req.path =~ /\.gz$/ specs = Gem::Util.gzip specs res['content-type'] = 'application/x-gzip' else res['content-type'] = 'application/octet-stream' end - if req.request_method == 'HEAD' then + if req.request_method == 'HEAD' res['content-length'] = specs.length else res.body << specs @@ -579,13 +579,13 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; } selector = full_name.inspect - if specs.empty? then + if specs.empty? res.status = 404 res.body = "No gems found matching #{selector}" - elsif specs.length > 1 then + elsif specs.length > 1 res.status = 500 res.body = "Multiple gems found matching #{selector}" - elsif marshal_format then + elsif marshal_format res['content-type'] = 'application/x-deflate' res.body << Gem.deflate(Marshal.dump(specs.first)) end @@ -818,7 +818,7 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; } '/gems' => '/cache/', } - if have_rdoc_4_plus? then + if have_rdoc_4_plus? @server.mount '/doc_root', RDoc::Servlet, '/doc_root' else file_handlers['/doc_root'] = '/doc/' @@ -851,14 +851,14 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; } specs = Marshal.dump specs - if req.path =~ /\.gz$/ then + if req.path =~ /\.gz$/ specs = Gem::Util.gzip specs res['content-type'] = 'application/x-gzip' else res['content-type'] = 'application/octet-stream' end - if req.request_method == 'HEAD' then + if req.request_method == 'HEAD' res['content-length'] = specs.length else res.body << specs -- cgit v1.2.3