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/request_set.rb | 48 ++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'lib/rubygems/request_set.rb') diff --git a/lib/rubygems/request_set.rb b/lib/rubygems/request_set.rb index c68e40ee9e..6017d15d13 100644 --- a/lib/rubygems/request_set.rb +++ b/lib/rubygems/request_set.rb @@ -91,7 +91,7 @@ class Gem::RequestSet # # set = Gem::RequestSet.new nokogiri, pg - def initialize *deps + def initialize(*deps) @dependencies = deps @always_install = [] @@ -119,8 +119,8 @@ class Gem::RequestSet ## # Declare that a gem of name +name+ with +reqs+ requirements is needed. - def gem name, *reqs - if dep = @dependency_names[name] then + def gem(name, *reqs) + if dep = @dependency_names[name] dep.requirement.concat reqs else dep = Gem::Dependency.new name, *reqs @@ -132,7 +132,7 @@ class Gem::RequestSet ## # Add +deps+ Gem::Dependency objects to the set. - def import deps + def import(deps) @dependencies.concat deps end @@ -143,7 +143,7 @@ class Gem::RequestSet # The +installer+ will be +nil+ if a gem matching the request was already # installed. - def install options, &block # :yields: request, installer + def install(options, &block) # :yields: request, installer if dir = options[:install_dir] requests = install_into dir, false, options, &block return requests @@ -181,10 +181,10 @@ class Gem::RequestSet # Install requested gems after they have been downloaded sorted_requests.each do |req| - if req.installed? then + if req.installed? req.spec.spec.build_extensions - if @always_install.none? { |spec| spec == req.spec.spec } then + if @always_install.none? { |spec| spec == req.spec.spec } yield req, nil if block_given? next end @@ -230,7 +230,7 @@ class Gem::RequestSet # If +:without_groups+ is given in the +options+, those groups in the gem # dependencies file are not used. See Gem::Installer for other +options+. - def install_from_gemdeps options, &block + def install_from_gemdeps(options, &block) gemdeps = options[:gemdeps] @install_dir = options[:install_dir] || Gem.dir @@ -255,7 +255,7 @@ class Gem::RequestSet else installed = install options, &block - if options.fetch :lock, true then + if options.fetch :lock, true lockfile = Gem::RequestSet::Lockfile.build self, gemdeps, gem_deps_api.dependencies lockfile.write @@ -265,7 +265,7 @@ class Gem::RequestSet end end - def install_into dir, force = true, options = {} + def install_into(dir, force = true, options = {}) gem_home, ENV['GEM_HOME'] = ENV['GEM_HOME'], dir existing = force ? [] : specs_in(dir) @@ -283,7 +283,7 @@ class Gem::RequestSet sorted_requests.each do |request| spec = request.spec - if existing.find { |s| s.full_name == spec.full_name } then + if existing.find { |s| s.full_name == spec.full_name } yield request, nil if block_given? next end @@ -305,7 +305,7 @@ class Gem::RequestSet ## # Call hooks on installed gems - def install_hooks requests, options + def install_hooks(requests, options) specs = requests.map do |request| case request when Gem::Resolver::ActivationRequest then @@ -327,7 +327,7 @@ class Gem::RequestSet ## # Load a dependency management file. - def load_gemdeps path, without_groups = [], installing = false + def load_gemdeps(path, without_groups = [], installing = false) @git_set = Gem::Resolver::GitSet.new @vendor_set = Gem::Resolver::VendorSet.new @source_set = Gem::Resolver::SourceSet.new @@ -348,29 +348,29 @@ class Gem::RequestSet gf.load end - def pretty_print q # :nodoc: + def pretty_print(q) # :nodoc: q.group 2, '[RequestSet:', ']' do q.breakable - if @remote then + if @remote q.text 'remote' q.breakable end - if @prerelease then + if @prerelease q.text 'prerelease' q.breakable end - if @development_shallow then + if @development_shallow q.text 'shallow development' q.breakable - elsif @development then + elsif @development q.text 'development' q.breakable end - if @soft_missing then + if @soft_missing q.text 'soft missing' end @@ -394,7 +394,7 @@ class Gem::RequestSet # Resolve the requested dependencies and return an Array of Specification # objects to be activated. - def resolve set = Gem::Resolver::BestSet.new + def resolve(set = Gem::Resolver::BestSet.new) @sets << set @sets << @git_set @sets << @vendor_set @@ -443,17 +443,17 @@ class Gem::RequestSet @specs ||= @requests.map { |r| r.full_spec } end - def specs_in dir + def specs_in(dir) Gem::Util.glob_files_in_dir("*.gemspec", File.join(dir, "specifications")).map do |g| Gem::Specification.load g end end - def tsort_each_node &block # :nodoc: + def tsort_each_node(&block) # :nodoc: @requests.each(&block) end - def tsort_each_child node # :nodoc: + def tsort_each_child(node) # :nodoc: node.spec.dependencies.each do |dep| next if dep.type == :development and not @development @@ -461,7 +461,7 @@ class Gem::RequestSet dep.match? r.spec.name, r.spec.version, @prerelease } - unless match then + unless match next if dep.type == :development and @development_shallow next if @soft_missing raise Gem::DependencyError, -- cgit v1.2.3