-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Make bundle clean
clean extension directories
#6168
Conversation
Thanks! |
ping @indirect |
05483a7
to
b016599
Compare
@@ -163,13 +163,15 @@ def clean(dry_run = false) | |||
gem_dirs = Dir["#{Gem.dir}/gems/*"] | |||
gem_files = Dir["#{Gem.dir}/cache/*.gem"] | |||
gemspec_files = Dir["#{Gem.dir}/specifications/*.gemspec"] | |||
extension_dirs = Dir["#{Gem.dir}/extensions/*/*/*"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the glob pattern be "select directories recursively"?
Such as: Dir["#{Gem.dir}/extensions/*/*/*"]
=> Dir["#{Gem.dir}/extensions/**/*"]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need exactly three levels of nesting. **/*
will match the first level as well, i.e
Dir["#{Gem.dir}/extensions/**/*"]
Will match
extensions/x86_64-darwin-17
extensions/x86_64-darwin-17/2.4.0-static
extensions/x86_64-darwin-17/2.4.0-static/very_simple_binary-1.0
extensions/x86_64-darwin-17/2.4.0-static/very_simple_binary-1.0/gem_make.out
extensions/x86_64-darwin-17/2.4.0-static/very_simple_binary-1.0/gem.build_complete
extensions/x86_64-darwin-17/2.4.0-static/very_simple_binary-1.0/very_simple_binary_c.bundle
extensions/x86_64-darwin-17/2.4.0-static/simple_binary-1.0
extensions/x86_64-darwin-17/2.4.0-static/simple_binary-1.0/simple_binary_c.bundle
extensions/x86_64-darwin-17/2.4.0-static/simple_binary-1.0/gem_make.out
extensions/x86_64-darwin-17/2.4.0-static/simple_binary-1.0/gem.build_complete
Whereas
Dir["#{Gem.dir}/extensions/*/*/*"]
Will match
extensions/x86_64-darwin-17/2.4.0-static/very_simple_binary-1.0
extensions/x86_64-darwin-17/2.4.0-static/simple_binary-1.0
We don't want to remove extensions/x86_64-darwin-17
, because this directory contains all extensions of all gems.
Please refer to following line for further details:
https://github.com/akhramov/bundler/blob/b016599152bddaf303618ca148ec59f623051893/lib/bundler/runtime.rb#L198
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the levels-explanation!
`bundle clean` command doesn't remove gem extensions, because extensions reside out of gem directories. This change tweaks `Bundler::Runtime#clean` to remove extensions dirs as well.
b016599
to
f631eca
Compare
Rebased the branch to the latest master. Is there any way I can improve this PR? |
Thanks! @bundlerbot r+ |
📌 Commit f631eca has been approved by |
Make `bundle clean` clean extension directories ### What was the end-user problem that led to this PR? The problem was that `bundle clean` command doesn't remove gem extensions (#5596) ### What was your diagnosis of the problem? I've looked into `Bundler::Runtime#clean` and realized that extension dirs are not removed ### What is your fix for the problem, implemented in this PR? My fix is to tweak `Bundler::Runtime#clean` to remove extensions dirs as well. ### Why did you choose this fix out of the possible options? I chose this fix because I didn't see any other option.
☀️ Test successful - status-travis |
Make `bundle clean` clean extension directories ### What was the end-user problem that led to this PR? The problem was that `bundle clean` command doesn't remove gem extensions (#5596) ### What was your diagnosis of the problem? I've looked into `Bundler::Runtime#clean` and realized that extension dirs are not removed ### What is your fix for the problem, implemented in this PR? My fix is to tweak `Bundler::Runtime#clean` to remove extensions dirs as well. ### Why did you choose this fix out of the possible options? I chose this fix because I didn't see any other option. (cherry picked from commit 2649066)
Make `bundle clean` clean extension directories ### What was the end-user problem that led to this PR? The problem was that `bundle clean` command doesn't remove gem extensions (#5596) ### What was your diagnosis of the problem? I've looked into `Bundler::Runtime#clean` and realized that extension dirs are not removed ### What is your fix for the problem, implemented in this PR? My fix is to tweak `Bundler::Runtime#clean` to remove extensions dirs as well. ### Why did you choose this fix out of the possible options? I chose this fix because I didn't see any other option. (cherry picked from commit 2649066)
What was the end-user problem that led to this PR?
The problem was that
bundle clean
command doesn't remove gem extensions (#5596)What was your diagnosis of the problem?
I've looked into
Bundler::Runtime#clean
and realized that extension dirs are not removedWhat is your fix for the problem, implemented in this PR?
My fix is to tweak
Bundler::Runtime#clean
to remove extensions dirsas well.
Why did you choose this fix out of the possible options?
I chose this fix because I didn't see any other option.