phrep

Artifact [c3d769648d]
Login

Artifact c3d769648ded50eaf093cbfc9ac08c5257a61c7e:

Wiki page [composer-plugin] by mario 2015-02-27 22:56:52.
D 2015-02-27T22:56:52.831
L composer-plugin
N text/x-markdown
P 0b35d7ace149ecac03bed3fb98e695b6ba13614d
U mario
W 1502
There isn't an integrated composer-plugin yet.

There is however [**composer-phrep.sh**](dir/examples/make/) [[→d25c328d8](artifact/d25c328d8aa7fc2d)],<br>
usable per <kbd>post-install-cmd</kbd>:

    "scripts": {
        "post-install-cmd": ["./composer-phrep.sh"],
        "post-update-cmd":  ["./composer-phrep.sh"]
    }

Current behaviour:

  * It searches for packages containing a <b>`composer.ph`</b> alongside each
    `composer.json`. If there isn't one, the package won't be preprocessed.

  * Rewrites all `*.src` files into `*.php` scripts.

  * Looks for a primary `composer.ph` or `vendor/composer.ph` to read
    predefined/overriden constants from.


A full phrep composer-plugin would of course integrate more nicely,
run faster than a shell script, and likely provide a few more options:

  * For example a `#pragma rewriterule src=php` to define which files to
    preprocess to which target filenames.

  * Intersect the primary `composer.ph` defines with those from per-pkg
    `vnd/*/*/composer.ph` includes.

  * Or perhaps even read out `"extras": { "defines": { ... } }` - (though
    that might just dilute the configuration scheme, be less manageable).


However, there's no rush. There aren't any such packages yet. So feature
scope and rewriting scheme are still experimental. And the shell wrapper
is more flexible for testing anyway.

Foremost it also can be run independently from composer updates. For example
after changing #defines in the primary `composer.ph`.



Z 55b0aa048b755ff2319b8569c0769085