Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jmdeldin/txpc

TXPC, a Textpattern plugin compiler.
https://github.com/jmdeldin/txpc

Last synced: about 1 month ago
JSON representation

TXPC, a Textpattern plugin compiler.

Awesome Lists containing this project

README

        

TXPC, a Textpattern plugin compiler.
====================================

TXPC is a compiler for Textpattern plugins that allows developers to break
their source file into multiple files. It looks for `//inc ` in the
source file and merges the contents of `file.ext` into a single PHP file to be
used by TXP's plugin cache. TXPC will then create a distributable, base64 text
file.

Features
--------

- Separate PHP from other languages like CSS and JS.
- Include external libraries without bloating the source file.
- Plugin metadata is declared in a comment at the top of the file instead of
in `$plugin` (see "Metadata format").
- `# --- BEGIN|END CODE ---` is no longer needed.
- Likewise, explicit help sections are not needed. Help text has moved to a
README.textile file in the source directory.
- Releases are automatically labeled with their version.

Usage
-----

From the command line:

php txpc.php my_plugin.php [cache_dir] [release_dir]

- `cache_dir`
The directory for the merged plugin. Defaults to current working
directory.
- `release_dir`
The directory for the base64 text file. Defaults to cwd.

Calling from Bash
~~~~~~~~~~~~~~~~~

Save the following to somewhere accessible on your PATH (e.g., ~/bin) and
`chmod +x` it:

#!/bin/env php
public,
1 => public+admin,
2 => library,
3 => admin
- `order`: 0 => first, ..., 9 => last

Suggested directory structure
-----------------------------

| plugins/
| | cache/ <-- for TXP's plugin cache
| | | jmd_example.php
| | | jmd_save.php
| | src/ <-- raw plugin files
| | | example/
| | | | example.js
| | | | example.php
| | | | Makefile
| | | | README.textile
| | | save/
| | | | Makefile
| | | | README.textile
| | | | save.js
| | | | save.php
| | | ...
| | txpc/ <-- compiler
| | | examples/
| | | | ...
| | | README.textile
| | | txpc.php
| | releases/ <-- distributable plugins
| | | jmd_example-0.1.txt
| | | jmd_save-0.1.txt

Then from the command line or in your Makefile (or Rakefile), use:

cd src/example
php ../../txpc/txpc.php ../../cache ../../releases