PHP Class Bolt\Composer\ScriptHandler

Show file Open project: bolt/bolt

Public Methods

Method Description
configureProject ( Composer\Script\Event $event ) Configures installation's directory structure.
installAssets ( Composer\Script\Event $event, boolean $checkForCreateProject = true ) Install Bolt's assets.
installThemesAndFiles ( Composer\Script\Event $event ) Install Bolt's default themes and files.

Protected Methods

Method Description
configureDir ( Composer\Script\Event $event, $name, $defaultInSkeleton, $prefix = '', $chmod = true )
configureDirMode ( Composer\Script\Event $event ) : number Gets the directory mode value, sets umask with it, and returns it.
configureGitIgnore ( Composer\Script\Event $event ) Optionally copy in Bolt's .gitignore file.
getApp ( Composer\Script\Event $event ) : Silex\Application Loads the application once from bootstrap file (which is configured with .bolt.yml/.bolt.php file).
getDir ( Composer\Script\Event $event, string $name, string | null $default = null ) : string Gets the directory requested either from configured application or composer's extra section/environment variable.
getOption ( Composer\Script\Event $event, string $key, mixed $default = null ) : mixed Get an option from environment variable or composer's extra section.
getWebDir ( Composer\Script\Event $event ) : string | null Gets the web directory either from configured application or composer's extra section/environment variable.

Method Details

configureDir() protected static method

protected static configureDir ( Composer\Script\Event $event, $name, $defaultInSkeleton, $prefix = '', $chmod = true )
$event Composer\Script\Event

configureDirMode() protected static method

Gets the directory mode value, sets umask with it, and returns it.
protected static configureDirMode ( Composer\Script\Event $event ) : number
$event Composer\Script\Event
return number

configureGitIgnore() protected static method

Optionally copy in Bolt's .gitignore file.
protected static configureGitIgnore ( Composer\Script\Event $event )
$event Composer\Script\Event

configureProject() public static method

The configured paths are written to .bolt.yml and the skeleton structure is modified accordingly.
public static configureProject ( Composer\Script\Event $event )
$event Composer\Script\Event

getApp() protected static method

NOTE: This only works on the "post-autoload-dump" command as the autoload.php file has not been generated before that point.
protected static getApp ( Composer\Script\Event $event ) : Silex\Application
$event Composer\Script\Event
return Silex\Application

getDir() protected static method

Gets the directory requested either from configured application or composer's extra section/environment variable.
protected static getDir ( Composer\Script\Event $event, string $name, string | null $default = null ) : string
$event Composer\Script\Event
$name string
$default string | null
return string

getOption() protected static method

Example: With key "dir-mode" it checks for "BOLT_DIR_MODE" environment variable, then "bolt-dir-mode" in composer's extra section, then returns given default value.
protected static getOption ( Composer\Script\Event $event, string $key, mixed $default = null ) : mixed
$event Composer\Script\Event
$key string
$default mixed
return mixed

getWebDir() protected static method

If the web directory doesn't exist an error is emitted and null is returned.
protected static getWebDir ( Composer\Script\Event $event ) : string | null
$event Composer\Script\Event
return string | null

installAssets() public static method

This should be ran on "post-install-cmd" and "post-update-cmd" events.
public static installAssets ( Composer\Script\Event $event, boolean $checkForCreateProject = true )
$event Composer\Script\Event
$checkForCreateProject boolean

installThemesAndFiles() public static method

This should be ran on "post-create-project-cmd" event.
public static installThemesAndFiles ( Composer\Script\Event $event )
$event Composer\Script\Event