diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2021-03-17 18:53:49 +0100 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2024-07-23 20:15:09 +0000 |
commit | b1db07074b9002f6ef46539023342cc53c3b9fee (patch) | |
tree | 6de822c160c87608cd47db78ce813723a0d7f764 /lib | |
parent | 26b1c7ed16fc6136d3b497dc6999bc619b122058 (diff) | |
download | ruby-b1db07074b9002f6ef46539023342cc53c3b9fee.tar.gz |
[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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/source/git.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb index 95a78a904c..64b5af62aa 100644 --- a/lib/bundler/source/git.rb +++ b/lib/bundler/source/git.rb @@ -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? |