Module: Language::PHP::Shebang Private
- Extended by:
- T::Helpers
- Defined in:
- language/php.rb
Overview
This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
Helper module for replacing php
shebangs.
Constant Summary collapse
- PHP_SHEBANG_REGEX =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
A regex to match potential shebang permutations.
%r{^#! ?(?:/usr/bin/(?:env )?)?php( |$)}
- PHP_SHEBANG_MAX_LENGTH =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
The length of the longest shebang matching
SHEBANG_REGEX
. T.let("#! /usr/bin/env php ".length, Integer)
Class Method Summary collapse
Class Method Details
.detected_php_shebang(formula = T.cast(self, Formula)) ⇒ Utils::Shebang::RewriteInfo
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
34 35 36 37 38 39 40 |
# File 'language/php.rb', line 34 def detected_php_shebang(formula = T.cast(self, Formula)) php_deps = formula.deps.select(&:required?).map(&:name).grep(/^php(@.+)?$/) raise ShebangDetectionError.new("PHP", "formula does not depend on PHP") if php_deps.empty? raise ShebangDetectionError.new("PHP", "formula has multiple PHP dependencies") if php_deps.length > 1 php_shebang_rewrite_info(Formula[php_deps.first].opt_bin/"php") end |