Colored output for TTYs, props added
This commit is contained in:
@@ -58,6 +58,80 @@ the plugin or library has what is needed, such as checking a define or making
|
||||
sure that a method or class already exists.
|
||||
|
||||
|
||||
## Sources and Stubs
|
||||
|
||||
Source files are added in the `include` block as either a `file` or a `dir`.
|
||||
|
||||
include {
|
||||
dir "directory-to-add";
|
||||
file "file-to-add.php";
|
||||
}
|
||||
|
||||
The stub is what is invoked when the executable is called, and it is defined in
|
||||
the `phar` block, outside of the `include` block that is. The stub must however
|
||||
be added through one of the rules in the `include` block.
|
||||
|
||||
stub "src/stub.php";
|
||||
|
||||
In the future, it will also be possible to exclude files matching specific
|
||||
patterns.
|
||||
|
||||
|
||||
## Props
|
||||
|
||||
The project properties are a set of key=value items that are defined in the stub,
|
||||
and thus made available to the code in the phar. it can be read from a file, or
|
||||
generated by a script or executable. Comments should be prefixed with a hash sign
|
||||
(`#`):
|
||||
|
||||
# Comment line
|
||||
MYAPP_VERSION=1.0
|
||||
MYAPP_VARIANT=lite
|
||||
MYAPP_BUILDDATE=2017-03-14
|
||||
|
||||
To add props from a file:
|
||||
|
||||
props "app.props";
|
||||
|
||||
To evaluate props when building the archive:
|
||||
|
||||
props exec="generate-props.php";
|
||||
|
||||
## Options and Tweaks
|
||||
|
||||
Boolean options (such as `verbatim` and `library`) will have their value default
|
||||
to *true* if omitted. So these two lines will have the same effect:
|
||||
|
||||
verbatim;
|
||||
verbatim true;
|
||||
|
||||
The following options are currently available. Read the notes before using them
|
||||
tho!
|
||||
|
||||
|
||||
### library (bool)
|
||||
|
||||
If set, the created phar will be a pure library, intended to be *included* into
|
||||
other PHP projects. The library mode currently depends on composer, and it will
|
||||
use `vendor/autoload.php` as the main stub. As such, you need to add any code
|
||||
you want executed on load to `autoload/files` in your composer.json.
|
||||
|
||||
|
||||
### verbatim (bool)
|
||||
|
||||
If set, no minification will take place. Generally, the minification should not
|
||||
cause any problems but lead to a file that can be up to half a megabyte smaller
|
||||
as whitespace and comments are removed.
|
||||
|
||||
|
||||
### compress (bool)
|
||||
|
||||
Compress is a legacy option from MakePhar *mk1*, and is not yet implemented. It
|
||||
will work in a similar fashion to how it did before: The resulting .phar will
|
||||
be compressed, and the output will have a stub prepended to extract the .phar
|
||||
into a temporary directory before running. But right now **it does nothing**.
|
||||
|
||||
|
||||
## Pro Tips
|
||||
|
||||
* You can have multiple `phar` blocks in your `makephar.conf`. This lets
|
||||
@@ -65,5 +139,5 @@ sure that a method or class already exists.
|
||||
pick the rule to build tho, but rather all defined phars will be built.
|
||||
* MakePhar will minify your files using `php_strip_whitespace()` before adding
|
||||
them to the archive. This shouldn't be an issue, but if your code depends on
|
||||
a specific character index in a specific php file, you might want to use
|
||||
another tool for the time being.
|
||||
a specific character index in a specific php file, you might want to specify
|
||||
the `verbatim` option.
|
||||
|
||||
Reference in New Issue
Block a user