lib/homebrew_automation/tap.rb
def on_formula!(formula, &block)
      name = "#{formula}.rb"
      block ||= ->(n) { n }
      Dir.chdir 'Formula' do
        File.open name, 'r' do |old_file|
          File.open "#{name}.new", 'w' do |new_file|
            new_file.write(
              block.
                call(Formula.parse_string(old_file.read)).
                to_s)
          end
        end
        File.rename "#{name}.new", name
      end
    end
# Overwrite the specified Formula file, in-place, on-disk
#
# A directory named +Formula+ is assumed to be on +Dir.pwd+.
#
# If no block is passed, then this tries to find the formula file, but then
# makes no changes to that Formula.
#
# @param formula [String] Part of the name to the file within the +Formula+
#     directory inside the Tap repo's directory, excluding the +.rb+ suffix.
# @yieldparam formula [Formula] existing Formula
# @yieldreturn [Formula] after your modifications
# @return [Formula] new Formula
Overwrite the specified Formula file, in-place, on-disk
A directory named +Formula+ is assumed to be on +Dir.pwd+.

If no block is passed, then this tries to find the formula file, but then
makes no changes to that Formula.
Overwrite the specified Formula file in - place on - disk A directory named + Formula + is assumed to be on + Dir . pwd + . If no block is passed then this tries to find the formula file but then makes no changes to that Formula .
def on_formula!(formula, &block)
      name = "#{formula}.rb"
      block ||= ->(n) { n }
      Dir.chdir 'Formula' do
        File.open name, 'r' do |old_file|
          File.open "#{name}.new", 'w' do |new_file|
            new_file.write(
              block.
                call(Formula.parse_string(old_file.read)).
                to_s)
          end
        end
        File.rename "#{name}.new", name
      end
    end
def on_formula! ( formula , & block ) name = "#{formula}.rb" block ||= -> ( n ) { n } Dir . chdir 'Formula' do File . open name , 'r' do | old_file | File . open "#{name}.new" , 'w' do | new_file | new_file . write ( block . call ( Formula . parse_string ( old_file . read ) ) . to_s ) end end File . rename "#{name}.new" , name end end
Overwrite the specified Formula file, in-place, on-disk
A directory named +Formula+ is assumed to be on +Dir.pwd+.
Overwrite the specified Formula file in - place on - disk A directory named + Formula + is assumed to be on + Dir . pwd + .
after your modifications
after your modifications
Formula
None
Formula
formula
None
block