diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-21 10:20:47 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-21 10:20:47 +0000 |
commit | 5335ce0e060c7a2a0b01c57f8f8a64254f2658e1 (patch) | |
tree | c63321cb7c7c5c15454a79d81123c7188be2c51e /lib/rubygems/source | |
parent | 2f023c5dbaadede9ceac3eb9ac0e73f3050e5ada (diff) | |
download | ruby-5335ce0e060c7a2a0b01c57f8f8a64254f2658e1.tar.gz |
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
Diffstat (limited to 'lib/rubygems/source')
-rw-r--r-- | lib/rubygems/source/git.rb | 19 | ||||
-rw-r--r-- | lib/rubygems/source/installed.rb | 7 | ||||
-rw-r--r-- | lib/rubygems/source/local.rb | 14 | ||||
-rw-r--r-- | lib/rubygems/source/lock.rb | 8 | ||||
-rw-r--r-- | lib/rubygems/source/specific_file.rb | 10 | ||||
-rw-r--r-- | lib/rubygems/source/vendor.rb | 5 |
6 files changed, 30 insertions, 33 deletions
diff --git a/lib/rubygems/source/git.rb b/lib/rubygems/source/git.rb index 23f8928a4e..0b8a4339cc 100644 --- a/lib/rubygems/source/git.rb +++ b/lib/rubygems/source/git.rb @@ -50,7 +50,7 @@ class Gem::Source::Git < Gem::Source # repository may contain multiple gems. If +submodules+ is true, submodules # will be checked out when the gem is installed. - def initialize name, repository, reference, submodules = false + def initialize(name, repository, reference, submodules = false) super repository @name = name @@ -63,7 +63,7 @@ class Gem::Source::Git < Gem::Source @git = ENV['git'] || 'git' end - def <=> other + def <=>(other) case other when Gem::Source::Git then 0 @@ -77,7 +77,7 @@ class Gem::Source::Git < Gem::Source end end - def == other # :nodoc: + def ==(other) # :nodoc: super and @name == other.name and @repository == other.repository and @@ -93,7 +93,7 @@ class Gem::Source::Git < Gem::Source return false unless File.exist? repo_cache_dir - unless File.exist? install_dir then + unless File.exist? install_dir system @git, 'clone', '--quiet', '--no-checkout', repo_cache_dir, install_dir end @@ -117,7 +117,7 @@ class Gem::Source::Git < Gem::Source def cache # :nodoc: return unless @remote - if File.exist? repo_cache_dir then + if File.exist? repo_cache_dir Dir.chdir repo_cache_dir do system @git, 'fetch', '--quiet', '--force', '--tags', @repository, 'refs/heads/*:refs/heads/*' @@ -145,7 +145,7 @@ class Gem::Source::Git < Gem::Source ## # Nothing to download for git gems - def download full_spec, path # :nodoc: + def download(full_spec, path) # :nodoc: end ## @@ -157,7 +157,7 @@ class Gem::Source::Git < Gem::Source File.join base_dir, 'gems', "#{@name}-#{dir_shortref}" end - def pretty_print q # :nodoc: + def pretty_print(q) # :nodoc: q.group 2, '[Git: ', ']' do q.breakable q.text @repository @@ -206,7 +206,7 @@ class Gem::Source::Git < Gem::Source Dir.chdir directory do spec = Gem::Specification.load file - if spec then + if spec spec.base_dir = base_dir spec.extension_dir = @@ -228,7 +228,7 @@ class Gem::Source::Git < Gem::Source require 'digest' # required here to avoid deadlocking in Gem.activate_bin_path (because digest is a gem on 2.5+) normalized = - if @repository =~ %r%^\w+://(\w+@)?% then + if @repository =~ %r%^\w+://(\w+@)?% uri = URI(@repository).normalize.to_s.sub %r%/$%,'' uri.sub(/\A(\w+)/) { $1.downcase } else @@ -239,4 +239,3 @@ class Gem::Source::Git < Gem::Source end end - diff --git a/lib/rubygems/source/installed.rb b/lib/rubygems/source/installed.rb index 300491e467..8e20cbd76d 100644 --- a/lib/rubygems/source/installed.rb +++ b/lib/rubygems/source/installed.rb @@ -11,7 +11,7 @@ class Gem::Source::Installed < Gem::Source ## # Installed sources sort before all other sources - def <=> other + def <=>(other) case other when Gem::Source::Git, Gem::Source::Lock, @@ -29,13 +29,12 @@ class Gem::Source::Installed < Gem::Source ## # We don't need to download an installed gem - def download spec, path + def download(spec, path) nil end - def pretty_print q # :nodoc: + def pretty_print(q) # :nodoc: q.text '[Installed]' end end - diff --git a/lib/rubygems/source/local.rb b/lib/rubygems/source/local.rb index 5ab7a467b5..875e992d85 100644 --- a/lib/rubygems/source/local.rb +++ b/lib/rubygems/source/local.rb @@ -15,7 +15,7 @@ class Gem::Source::Local < Gem::Source ## # Local sorts before Gem::Source and after Gem::Source::Installed - def <=> other + def <=>(other) case other when Gem::Source::Installed, Gem::Source::Lock then @@ -34,7 +34,7 @@ class Gem::Source::Local < Gem::Source "#<%s specs: %p>" % [self.class, keys] end - def load_specs type # :nodoc: + def load_specs(type) # :nodoc: @load_specs_names[type] ||= begin names = [] @@ -78,8 +78,8 @@ class Gem::Source::Local < Gem::Source end end - def find_gem gem_name, version = Gem::Requirement.default, # :nodoc: - prerelease = false + def find_gem(gem_name, version = Gem::Requirement.default, # :nodoc: + prerelease = false) load_specs :complete found = [] @@ -101,7 +101,7 @@ class Gem::Source::Local < Gem::Source found.max_by { |s| s.version } end - def fetch_spec name # :nodoc: + def fetch_spec(name) # :nodoc: load_specs :complete if data = @specs[name] @@ -111,7 +111,7 @@ class Gem::Source::Local < Gem::Source end end - def download spec, cache_dir = nil # :nodoc: + def download(spec, cache_dir = nil) # :nodoc: load_specs :complete @specs.each do |name, data| @@ -121,7 +121,7 @@ class Gem::Source::Local < Gem::Source raise Gem::Exception, "Unable to find file for '#{spec.full_name}'" end - def pretty_print q # :nodoc: + def pretty_print(q) # :nodoc: q.group 2, '[Local gems:', ']' do q.breakable q.seplist @specs.keys do |v| diff --git a/lib/rubygems/source/lock.rb b/lib/rubygems/source/lock.rb index 59717be2c0..3b3f491750 100644 --- a/lib/rubygems/source/lock.rb +++ b/lib/rubygems/source/lock.rb @@ -15,11 +15,11 @@ class Gem::Source::Lock < Gem::Source # Creates a new Lock source that wraps +source+ and moves it earlier in the # sort list. - def initialize source + def initialize(source) @wrapped = source end - def <=> other # :nodoc: + def <=>(other) # :nodoc: case other when Gem::Source::Lock then @wrapped <=> other.wrapped @@ -30,7 +30,7 @@ class Gem::Source::Lock < Gem::Source end end - def == other # :nodoc: + def ==(other) # :nodoc: 0 == (self <=> other) end @@ -41,7 +41,7 @@ class Gem::Source::Lock < Gem::Source ## # Delegates to the wrapped source's fetch_spec method. - def fetch_spec name_tuple + def fetch_spec(name_tuple) @wrapped.fetch_spec name_tuple end diff --git a/lib/rubygems/source/specific_file.rb b/lib/rubygems/source/specific_file.rb index 459c803e1a..a22772b9c0 100644 --- a/lib/rubygems/source/specific_file.rb +++ b/lib/rubygems/source/specific_file.rb @@ -27,22 +27,22 @@ class Gem::Source::SpecificFile < Gem::Source attr_reader :spec - def load_specs *a # :nodoc: + def load_specs(*a) # :nodoc: [@name] end - def fetch_spec name # :nodoc: + def fetch_spec(name) # :nodoc: return @spec if name == @name raise Gem::Exception, "Unable to find '#{name}'" @spec end - def download spec, dir = nil # :nodoc: + def download(spec, dir = nil) # :nodoc: return @path if spec == @spec raise Gem::Exception, "Unable to download '#{spec.full_name}'" end - def pretty_print q # :nodoc: + def pretty_print(q) # :nodoc: q.group 2, '[SpecificFile:', ']' do q.breakable q.text @path @@ -59,7 +59,7 @@ class Gem::Source::SpecificFile < Gem::Source # # Otherwise Gem::Source#<=> is used. - def <=> other + def <=>(other) case other when Gem::Source::SpecificFile then return nil if @spec.name != other.spec.name diff --git a/lib/rubygems/source/vendor.rb b/lib/rubygems/source/vendor.rb index e1b3698607..a87fa63331 100644 --- a/lib/rubygems/source/vendor.rb +++ b/lib/rubygems/source/vendor.rb @@ -7,11 +7,11 @@ class Gem::Source::Vendor < Gem::Source::Installed ## # Creates a new Vendor source for a gem that was unpacked at +path+. - def initialize path + def initialize(path) @uri = path end - def <=> other + def <=>(other) case other when Gem::Source::Lock then -1 @@ -25,4 +25,3 @@ class Gem::Source::Vendor < Gem::Source::Installed end end - |