Skip to content

Commit

Permalink
Merge pull request #17329 from Homebrew/rmtree
Browse files Browse the repository at this point in the history
extend/pathname: import rmtree again.
  • Loading branch information
MikeMcQuaid authored May 20, 2024
2 parents 91b58f0 + a92e6fc commit ea05828
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 23 deletions.
1 change: 0 additions & 1 deletion Library/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ Sorbet/TrueSigil:
- "/**/{Formula,Casks}/**/*.rb"
- "**/{Formula,Casks}/**/*.rb"
- "Homebrew/test/**/*.rb"
- "Homebrew/extend/pathname/rmtree.rb"

# Require &&/|| instead of and/or
Style/AndOr:
Expand Down
1 change: 0 additions & 1 deletion Library/Homebrew/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Style/Documentation:
- extend/ENV/super.rb
- extend/kernel.rb
- extend/pathname.rb
- extend/pathname/rmtree.rb
- formula.rb
- formula_assertions.rb
- formula_free_port.rb
Expand Down
17 changes: 15 additions & 2 deletions Library/Homebrew/extend/pathname.rb
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,21 @@ def zipinfo
.encode(Encoding::UTF_8, invalid: :replace)
.split("\n")
end

# Like regular `rmtree`, except it never ignores errors.
#
# This was the default behaviour in Ruby 3.1 and earlier.
#
# @api public
def rmtree(noop: nil, verbose: nil, secure: nil)
# Ideally we'd odeprecate this but probably can't given gems so let's
# create a RuboCop autocorrect instead soon.
# This is why monkeypatching is non-ideal (but right solution to get
# Ruby 3.3 over the line).
# odeprecated "rmtree", "FileUtils#rm_r"
FileUtils.rm_r(@path, noop:, verbose:, secure:)
nil
end
end

require "extend/os/pathname"
Expand Down Expand Up @@ -584,5 +599,3 @@ def uninstall_info
puts "uninfo #{self}" if ObserverPathnameExtension.verbose?
end
end

require "extend/pathname/rmtree"
19 changes: 0 additions & 19 deletions Library/Homebrew/extend/pathname/rmtree.rb

This file was deleted.

0 comments on commit ea05828

Please sign in to comment.