fabpot/Pirum — pull request #43 by llaville (2012-02-16 17:38:37+00:00)
Title: customize look and feel by templating system

Hello Fabien,

Because I used myself a template that is different from the default on my PEAR Bartlett channel (http://bartlett.laurent-laville.org/), I wanted to separate logic from design.

Today I've changed a bit the presentation and found that I missed something in previous version ( dependencies rows ). This is the reason I forked your project and present now this request.

In summary :
- externalize *index.html* and *pirum.css* files in a customizable templates directory
- add a new theme easily by just create a sub-dir to main templates dir with the two files *index.html* and *pirum.css*

Command line with optional swith --theme :

Pirum 1.0.6 by Fabien Potencier
Available commands:
pirum build target_dir [--theme=THEME]
pirum add target_dir Pirum-1.0.0.tgz [--theme=THEME]
pirum remove target_dir Pirum-1.0.0.tgz [--theme=THEME]

Defaults are :

template directory = where pirum script is
theme = default

Errors are catch either if template directory or index.html / pirum.css files does not exists

I provided as a separate commit the theme I used for my Bartlett channel (new version released today)

Example 1 :

pirum build target_dir --theme=default
same as
pirum build target_dir

Example 2 :

pirum build target_dir --theme=bartlett
pirum add target_dir Pirum-1.0.0.tgz --theme=pear2
pirum remove target_dir Pirum-1.0.0.tgz --theme=pear2

What is NOT provide by this patch :

- an example of INI configuration file that should be in directory @cfg_dir@/pirum/ , where @cfg_dir@ should be replace at packaging by the pear cfg_dir config set

[templates]
dir=C:\UwAmp\bin\php\php-5.2.17\templates
theme=default

Config file is optional.

Hope you'll like it, and merge it to your repository

Laurent Laville