[rubygems/rubygems] Refactor `set_paths!`

The method has two different concerns not straightforward to
distinguish.

One is to set a new `install_path`, which is done by setting the
`@install_path` instance variable, and invalidating the `local_specs`
memoization, so that the next time they are picked from the new
location.

The other one is to set a new `cache_path` which is done by setting the
`@cache_path` instance variable, and invalidating the `git_proxy`
memoization, so that the next git proxy uses the new cache location.

This commit splits the logic so that this is easier to understand.

https://github.com/rubygems/rubygems/commit/55904094e8
This commit is contained in:
David Rodríguez 2021-03-17 18:53:49 +01:00 коммит произвёл git
Родитель 26b1c7ed16
Коммит b1db07074b
1 изменённых файлов: 12 добавлений и 2 удалений

Просмотреть файл

@ -302,8 +302,18 @@ module Bundler
end
def set_paths!(path)
@local_specs = @git_proxy = nil
@cache_path = @install_path = path
set_cache_path!(path)
set_install_path!(path)
end
def set_cache_path!(path)
@git_proxy = nil
@cache_path = path
end
def set_install_path!(path)
@local_specs = nil
@install_path = path
end
def has_app_cache?