aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/script/script_events.rs
blob: a80240623c14cb2c3ef551e85f312dd65b3e767b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//! ref: composer/src/Composer/Script/ScriptEvents.php

pub struct ScriptEvents;

impl ScriptEvents {
    pub const PRE_INSTALL_CMD: &'static str = "pre-install-cmd";
    pub const POST_INSTALL_CMD: &'static str = "post-install-cmd";
    pub const PRE_UPDATE_CMD: &'static str = "pre-update-cmd";
    pub const POST_UPDATE_CMD: &'static str = "post-update-cmd";
    pub const PRE_STATUS_CMD: &'static str = "pre-status-cmd";
    pub const POST_STATUS_CMD: &'static str = "post-status-cmd";
    pub const PRE_AUTOLOAD_DUMP: &'static str = "pre-autoload-dump";
    pub const POST_AUTOLOAD_DUMP: &'static str = "post-autoload-dump";
    pub const POST_ROOT_PACKAGE_INSTALL: &'static str = "post-root-package-install";
    pub const POST_CREATE_PROJECT_CMD: &'static str = "post-create-project-cmd";
    pub const PRE_ARCHIVE_CMD: &'static str = "pre-archive-cmd";
    pub const POST_ARCHIVE_CMD: &'static str = "post-archive-cmd";

    pub fn is_defined(const_name: &str) -> bool {
        matches!(
            const_name,
            "PRE_INSTALL_CMD"
                | "POST_INSTALL_CMD"
                | "PRE_UPDATE_CMD"
                | "POST_UPDATE_CMD"
                | "PRE_STATUS_CMD"
                | "POST_STATUS_CMD"
                | "PRE_AUTOLOAD_DUMP"
                | "POST_AUTOLOAD_DUMP"
                | "POST_ROOT_PACKAGE_INSTALL"
                | "POST_CREATE_PROJECT_CMD"
                | "PRE_ARCHIVE_CMD"
                | "POST_ARCHIVE_CMD"
        )
    }
}