Skip to main content

ScriptContext

Struct ScriptContext 

Source
pub struct ScriptContext<'a> {
    pub project_root: &'a Path,
    pub php_bin: &'a Path,
    pub bin_dir: &'a Path,
    pub base_env: Vec<(String, String)>,
    pub dev_mode: bool,
    pub timeout: Option<Duration>,
    pub callbacks: &'a CallbackRegistry,
}
Expand description

Everything dispatch needs from the host, injected by the caller so the crate stays FS/PHP-agnostic and testable.

Fields§

§project_root: &'a Path

Project root; scripts run with this as their working directory.

§php_bin: &'a Path

The project’s resolved PHP binary, used for @php entries.

§bin_dir: &'a Path

vendor/bin (or config.bin-dir). Prepended onto PATH for the dispatch so scripts find installed CLIs (phpunit, pint, …). The host may already have folded this into base_env’s PATH; the prepend is idempotent (skipped if PATH already leads with it).

§base_env: Vec<(String, String)>

Base environment overrides layered on top of the inherited process env: PATH, COMPOSER_DEV_MODE, COMPOSER_BINARY, BOUGIE_*, and any per-tenant BOUGIE_SERVICE_* vars.

§dev_mode: bool

Whether dev dependencies are in scope (COMPOSER_DEV_MODE).

§timeout: Option<Duration>

Per-process wall-clock timeout (Composer’s config.process-timeout, default 300s). Each spawned entry gets its own budget; on expiry the child is killed and the event aborts. The Composer\Config::disableProcessTimeout script callback flips it off for the rest of the dispatch. None = unlimited.

§callbacks: &'a CallbackRegistry

Native handlers for the callbacks bougie reproduces (keyed by "Class::method"). A hit runs the handler instead of warn-skipping.

Trait Implementations§

Source§

impl Debug for ScriptContext<'_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for ScriptContext<'a>

§

impl<'a> !UnwindSafe for ScriptContext<'a>

§

impl<'a> Freeze for ScriptContext<'a>

§

impl<'a> Send for ScriptContext<'a>

§

impl<'a> Sync for ScriptContext<'a>

§

impl<'a> Unpin for ScriptContext<'a>

§

impl<'a> UnsafeUnpin for ScriptContext<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.