extend/pathname: import rmtree again.
The separate file is no longer required now that https://github.com/sorbet/sorbet/pull/7895 was merged.
This commit is contained in:
parent
b0af3c6983
commit
a92e6fc1c8
@ -284,7 +284,6 @@ Sorbet/TrueSigil:
|
|||||||
- "/**/{Formula,Casks}/**/*.rb"
|
- "/**/{Formula,Casks}/**/*.rb"
|
||||||
- "**/{Formula,Casks}/**/*.rb"
|
- "**/{Formula,Casks}/**/*.rb"
|
||||||
- "Homebrew/test/**/*.rb"
|
- "Homebrew/test/**/*.rb"
|
||||||
- "Homebrew/extend/pathname/rmtree.rb"
|
|
||||||
|
|
||||||
# Require &&/|| instead of and/or
|
# Require &&/|| instead of and/or
|
||||||
Style/AndOr:
|
Style/AndOr:
|
||||||
|
@ -33,7 +33,6 @@ Style/Documentation:
|
|||||||
- extend/ENV/super.rb
|
- extend/ENV/super.rb
|
||||||
- extend/kernel.rb
|
- extend/kernel.rb
|
||||||
- extend/pathname.rb
|
- extend/pathname.rb
|
||||||
- extend/pathname/rmtree.rb
|
|
||||||
- formula.rb
|
- formula.rb
|
||||||
- formula_assertions.rb
|
- formula_assertions.rb
|
||||||
- formula_free_port.rb
|
- formula_free_port.rb
|
||||||
|
@ -498,6 +498,21 @@ class Pathname
|
|||||||
.encode(Encoding::UTF_8, invalid: :replace)
|
.encode(Encoding::UTF_8, invalid: :replace)
|
||||||
.split("\n")
|
.split("\n")
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
require "extend/os/pathname"
|
require "extend/os/pathname"
|
||||||
@ -584,5 +599,3 @@ module ObserverPathnameExtension
|
|||||||
puts "uninfo #{self}" if ObserverPathnameExtension.verbose?
|
puts "uninfo #{self}" if ObserverPathnameExtension.verbose?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
require "extend/pathname/rmtree"
|
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
# typed: false
|
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class Pathname
|
|
||||||
# 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
|
|
Loading…
x
Reference in New Issue
Block a user