diff --git a/Library/Homebrew/.rubocop_todo.yml b/Library/Homebrew/.rubocop_todo.yml index 8029d48cffe1907ce94746060ba0aefeeb8a471f..5bf56b989d838838fb84d22258ba1f0c227f453b 100644 --- a/Library/Homebrew/.rubocop_todo.yml +++ b/Library/Homebrew/.rubocop_todo.yml @@ -22,7 +22,6 @@ Style/Documentation: - 'utils/gems.rb' - 'utils/notability.rb' - 'utils/popen.rb' - - 'utils/shebang.rb' - 'utils/shell.rb' - 'utils/livecheck_formula.rb' - 'version.rb' diff --git a/Library/Homebrew/utils/shebang.rb b/Library/Homebrew/utils/shebang.rb index eda6eec190fd0f5abdc589fdbe8272b961bf55a9..3e126746916da3609df9f0c198a2f5278bba8bd5 100644 --- a/Library/Homebrew/utils/shebang.rb +++ b/Library/Homebrew/utils/shebang.rb @@ -1,9 +1,15 @@ # frozen_string_literal: true module Utils + # Helper functions for manipulating shebang lines. + # + # @api private module Shebang module_function + # Specification on how to rewrite a given shebang. + # + # @api private class RewriteInfo attr_reader :regex, :max_length, :replacement @@ -14,6 +20,12 @@ module Utils end end + # Rewrite shebang for the given `paths` using the given `rewrite_info`. + # + # @example + # rewrite_shebang detected_python_shebang, bin/"script.py" + # + # @api public def rewrite_shebang(rewrite_info, *paths) paths.each do |f| f = Pathname(f)