Expose inreplace as a class method
This commit is contained in:
parent
fb7ce8c484
commit
4fd63dc4f8
@ -33,10 +33,6 @@ BOTTLE_ERB = <<-EOS
|
|||||||
EOS
|
EOS
|
||||||
|
|
||||||
module Homebrew extend self
|
module Homebrew extend self
|
||||||
class << self
|
|
||||||
include Utils::Inreplace
|
|
||||||
end
|
|
||||||
|
|
||||||
def keg_contains string, keg
|
def keg_contains string, keg
|
||||||
if not ARGV.homebrew_developer?
|
if not ARGV.homebrew_developer?
|
||||||
return quiet_system 'fgrep', '--recursive', '--quiet', '--max-count=1', string, keg
|
return quiet_system 'fgrep', '--recursive', '--quiet', '--max-count=1', string, keg
|
||||||
@ -236,7 +232,7 @@ module Homebrew extend self
|
|||||||
f = Formula.factory formula_name
|
f = Formula.factory formula_name
|
||||||
update_or_add = nil
|
update_or_add = nil
|
||||||
|
|
||||||
inreplace f.path do |s|
|
Utils::Inreplace.inreplace(f.path) do |s|
|
||||||
if s.include? 'bottle do'
|
if s.include? 'bottle do'
|
||||||
update_or_add = 'update'
|
update_or_add = 'update'
|
||||||
string = s.sub!(/ bottle do.+?end\n/m, output)
|
string = s.sub!(/ bottle do.+?end\n/m, output)
|
||||||
|
@ -20,5 +20,6 @@ module Utils
|
|||||||
Pathname(path).atomic_write(s)
|
Pathname(path).atomic_write(s)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
module_function :inreplace
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user