зеркало из https://github.com/github/ruby.git
[rubygems/rubygems] Onboard Rubocop Naming/MemoizedInstanceVariableName rule to Bundler.
https://github.com/rubygems/rubygems/commit/d768be0c65
This commit is contained in:
Родитель
4d4743f7e3
Коммит
9cfd8330ca
|
@ -90,7 +90,7 @@ module Bundler
|
|||
|
||||
class << self
|
||||
def configure
|
||||
@configured ||= configure_gem_home_and_path
|
||||
@configure ||= configure_gem_home_and_path
|
||||
end
|
||||
|
||||
def ui
|
||||
|
@ -582,7 +582,7 @@ EOF
|
|||
@bin_path = nil
|
||||
@bundler_major_version = nil
|
||||
@bundle_path = nil
|
||||
@configured = nil
|
||||
@configure = nil
|
||||
@configured_bundle_path = nil
|
||||
@definition = nil
|
||||
@load = nil
|
||||
|
|
|
@ -122,7 +122,7 @@ module Bundler
|
|||
end
|
||||
|
||||
def to_s
|
||||
@__to_s ||= if platform == Gem::Platform::RUBY
|
||||
@to_s ||= if platform == Gem::Platform::RUBY
|
||||
"#{name} (#{version})"
|
||||
else
|
||||
"#{name} (#{version}-#{platform})"
|
||||
|
|
|
@ -107,7 +107,7 @@ module Bundler
|
|||
ruby_engine_version = RUBY_ENGINE == "ruby" ? ruby_version : RUBY_ENGINE_VERSION.dup
|
||||
patchlevel = RUBY_PATCHLEVEL.to_s
|
||||
|
||||
@ruby_version ||= RubyVersion.new(ruby_version, patchlevel, ruby_engine, ruby_engine_version)
|
||||
@system ||= RubyVersion.new(ruby_version, patchlevel, ruby_engine, ruby_engine_version)
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -66,7 +66,9 @@ module Gem
|
|||
|
||||
alias_method :rg_extension_dir, :extension_dir
|
||||
def extension_dir
|
||||
@bundler_extension_dir ||= if source.respond_to?(:extension_dir_name)
|
||||
# following instance variable is already used in original method
|
||||
# and that is the reason to prefix it with bundler_ and add rubocop exception
|
||||
@bundler_extension_dir ||= if source.respond_to?(:extension_dir_name) # rubocop:disable Naming/MemoizedInstanceVariableName
|
||||
unique_extension_dir = [source.extension_dir_name, File.basename(full_gem_path)].uniq.join("-")
|
||||
File.expand_path(File.join(extensions_dir, unique_extension_dir))
|
||||
else
|
||||
|
@ -221,9 +223,9 @@ module Gem
|
|||
protected
|
||||
|
||||
def _requirements_sorted?
|
||||
return @_are_requirements_sorted if defined?(@_are_requirements_sorted)
|
||||
return @_requirements_sorted if defined?(@_requirements_sorted)
|
||||
strings = as_list
|
||||
@_are_requirements_sorted = strings == strings.sort
|
||||
@_requirements_sorted = strings == strings.sort
|
||||
end
|
||||
|
||||
def _with_sorted_requirements
|
||||
|
|
|
@ -400,19 +400,19 @@ RSpec.describe "Bundler::RubyVersion and its subclasses" do
|
|||
let(:bundler_system_ruby_version) { subject }
|
||||
|
||||
around do |example|
|
||||
if Bundler::RubyVersion.instance_variable_defined?("@ruby_version")
|
||||
if Bundler::RubyVersion.instance_variable_defined?("@system")
|
||||
begin
|
||||
old_ruby_version = Bundler::RubyVersion.instance_variable_get("@ruby_version")
|
||||
Bundler::RubyVersion.remove_instance_variable("@ruby_version")
|
||||
old_ruby_version = Bundler::RubyVersion.instance_variable_get("@system")
|
||||
Bundler::RubyVersion.remove_instance_variable("@system")
|
||||
example.run
|
||||
ensure
|
||||
Bundler::RubyVersion.instance_variable_set("@ruby_version", old_ruby_version)
|
||||
Bundler::RubyVersion.instance_variable_set("@system", old_ruby_version)
|
||||
end
|
||||
else
|
||||
begin
|
||||
example.run
|
||||
ensure
|
||||
Bundler::RubyVersion.remove_instance_variable("@ruby_version")
|
||||
Bundler::RubyVersion.remove_instance_variable("@system")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче