Methods summary
public
|
#
__construct( string $stageDir, string $projectRoot = null )
Parameters
- $stageDir
Staging base directory where your packaging
takes place. This folder will be created for
you if it does not exist. If it exists, it
will be deleted and recreated to start fresh.
- $projectRoot
- Root directory of the project.
Throws
InvalidArgumentException
RuntimeException
|
public
|
#
__destruct( )
Cleanup if the last section was not already closed.
Cleanup if the last section was not already closed.
|
public
|
#
startSection( string $section )
Call this method when starting a specific section of the packager.
Call this method when starting a specific section of the packager.
This makes the debug messages used in your script more meaningful and
adds context when things go wrong. Be sure to call endSection() when
you have finished a section of your packaging script.
Parameters
- $section
- Part of the packager that is running
|
public
|
#
endSection( )
Call this method when leaving the last pushed section of the packager.
Call this method when leaving the last pushed section of the packager.
|
public
|
#
debug( string $message )
Prints a debug message to STDERR bound to the current section.
Prints a debug message to STDERR bound to the current section.
Parameters
- $message
- Message to echo to STDERR
|
public
|
#
deepCopy( string $from, string $to )
Copies a file and creates the destination directory if needed.
Copies a file and creates the destination directory if needed.
Parameters
- $from
- File to copy
- $to
Destination to copy the file to, relative to the
base staging directory.
Throws
InvalidArgumentException if the file cannot be found
RuntimeException if the directory cannot be created.
RuntimeException if the file cannot be copied.
|
public
|
#
recursiveCopy( string $sourceDir, string $destDir, array $extensions = array('php') )
Recursively copy one folder to another.
Recursively copy one folder to another.
Any LICENSE file is automatically copied.
Parameters
- $sourceDir
- Source directory to copy from
- $destDir
Directory to copy the files to that is relative
to the the stage base directory.
- $extensions
File extensions to copy from the $sourceDir.
Defaults to "php" files only (e.g., ['php']).
Throws
InvalidArgumentException if the source directory is invalid.
|
public
string
|
#
exec( string $command )
Execute a command and throw an exception if the return code is not 0.
Execute a command and throw an exception if the return code is not 0.
Parameters
- $command
- Command to execute
Returns
string Returns the output of the command as a string
Throws
RuntimeException on error.
|
public
|
#
createAutoloader( array $files = array(), string $filename = 'autoloader.php' )
Creates a class-map autoloader to the staging directory in a file
named autoloader.php
Creates a class-map autoloader to the staging directory in a file
named autoloader.php
Parameters
- $files
Files to explicitly require in the autoloader. This
is similar to Composer's "files" "autoload" section.
- $filename
- Name of the autoloader file.
Throws
RuntimeException if the file cannot be written
|
public
|
#
createPhar( string $dest, string|boolean|null $stub = null, string $autoloaderFilename = 'autoloader.php' )
Creates a phar that automatically registers an autoloader.
Creates a phar that automatically registers an autoloader.
Call this only after your staging directory is built.
Parameters
- $dest
Where to save the file. The basename of the file
is also used as the alias name in the phar
(e.g., /path/to/guzzle.phar => guzzle.phar).
- $stub
The path to the phar stub file. Pass or
leave null to automatically have one created for you. Pass false
to no use a stub in the generated phar.
- $autoloaderFilename
- Name of the autolaoder filename.
|
public
|
#
createZip( string $dest )
Creates a zip file containing the staged files of your project.
Creates a zip file containing the staged files of your project.
Call this only after your staging directory is built.
Parameters
- $dest
- Where to save the zip file
|