From 45761fac5fc9d121d53de6ceddb0ba5f1c7f8228 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Sun, 1 Dec 2019 12:45:13 +0100 Subject: [PATCH] Rename `env_version` to `source` This is usually provided as an `ENV` variable but that's completely transparent to this class. Also, this is not always a version number. I think something like "source" is a better fit. --- spec/support/rubygems_version_manager.rb | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/spec/support/rubygems_version_manager.rb b/spec/support/rubygems_version_manager.rb index ca5f0bcd6d6..59fdc38475c 100644 --- a/spec/support/rubygems_version_manager.rb +++ b/spec/support/rubygems_version_manager.rb @@ -8,8 +8,8 @@ class RubygemsVersionManager include Spec::Helpers include Spec::Path - def initialize(env_version) - @env_version = env_version + def initialize(source) + @source = source end def switch @@ -23,7 +23,7 @@ def switch private def use_system? - @env_version.nil? + @source.nil? end def unrequire_rubygems_if_needed @@ -57,7 +57,7 @@ def rubygems_unrequire_needed? end def local_copy_switch_needed? - !env_version_is_path? && target_tag != local_copy_tag + !source_is_path? && target_tag != local_copy_tag end def target_tag @@ -75,7 +75,7 @@ def local_copy_path end def resolve_local_copy_path - return expanded_env_version if env_version_is_path? + return expanded_source if source_is_path? rubygems_path = root.join("tmp/rubygems") @@ -87,17 +87,17 @@ def resolve_local_copy_path rubygems_path end - def env_version_is_path? - expanded_env_version.directory? + def source_is_path? + expanded_source.directory? end - def expanded_env_version - @expanded_env_version ||= Pathname.new(@env_version).expand_path(root) + def expanded_source + @expanded_source ||= Pathname.new(@source).expand_path(root) end def resolve_target_tag - return "v#{@env_version}" if @env_version.match(/^\d/) + return "v#{@source}" if @source.match(/^\d/) - @env_version + @source end end