Module: Utils::Shebang Private
- Included in:
- Formula
- Defined in:
- Library/Homebrew/utils/shebang.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Helper functions for manipulating shebang lines.
Defined Under Namespace
Classes: RewriteInfo
Class Method Summary collapse
-
.rewrite_shebang(rewrite_info, *paths) ⇒ Object
Rewrite shebang for the given
paths
using the givenrewrite_info
.
Class Method Details
.rewrite_shebang(rewrite_info, *paths) ⇒ Object
Rewrite shebang for the given paths
using the given rewrite_info
.
30 31 32 33 34 35 36 37 38 |
# File 'Library/Homebrew/utils/shebang.rb', line 30 def rewrite_shebang(rewrite_info, *paths) paths.each do |f| f = Pathname(f) next unless f.file? next unless rewrite_info.regex.match?(f.read(rewrite_info.max_length)) Utils::Inreplace.inreplace f.to_s, rewrite_info.regex, "#!#{rewrite_info.replacement}" end end |