aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils/inreplace.rb
AgeCommit message (Collapse)Author
2017-01-12InreplaceError: fix undefined method crashilovezfs
When the first parameter to inreplace was an array, and the replacement failed, InreplaceError would end up crashing with an undefined method exception because the order of operations resulted in super not being passed the value of the entire inject block.
2016-09-11utils/inreplace: fix Rubocop warnings.Mike McQuaid
2016-08-05various: eliminate the usage of `any?` (#638)Xu Cheng
`any?` is not the opposite of `empty?`. Besides the case that `[false, nil].any?` will return false, `any?`(O(n)) has much worse performance than `empty?`(O(1)).
2016-07-18inreplace: support for audit arg in non-block formilovezfs
Provides feature parity between the block and non-block forms of inreplace by creating a four-argument version of the non-block form, where the fourth argument is an optional Boolean value, defaulting to true, which specifies whether a failed inreplace should cause an InreplaceError error to be raised. The fourth argument is passed along to StringInreplaceExtension#gsub!, which already supports an optional audit_result argument. This resolves the Catch-22 that single replacements aren't permissible in the block form (in that they now cause `brew audit` to complain), but the audit_result argument is not available in the non-block form. Closes #552. Signed-off-by: ilovezfs <ilovezfs@icloud.com>
2015-08-29More API documentation.Mike McQuaid
And remove the documented stuff from the `example-formula.rb`. Closes Homebrew/homebrew#43241. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-08-03Core files style updates.BrewTestBot
Closes Homebrew/homebrew#42354. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2014-09-28Make inreplace errors fatalJack Nagel
Closes Homebrew/homebrew#32649. Closes Homebrew/homebrew#32703.
2014-06-18Expose inreplace as a class methodJack Nagel
2014-03-26Replace files atomically in inreplaceJack Nagel
2014-03-26Drop intermediate variableJack Nagel
2013-11-12inreplace: odie for Homebrew developers.Mike McQuaid
2013-09-17inreplace: Open the file as binaryShaun Jackman
Closes Homebrew/homebrew#22628. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2013-08-17let inreplace take a symbolJason Whittle
As discussed in https://github.com/mxcl/homebrew/pull/21936 Closes Homebrew/homebrew#21942. Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2013-07-12Move inreplace off of ObjectJack Nagel
Closes Homebrew/homebrew#21163.