Code

Using teepee will be difficult without getting the code… here’s a few hints on what you can do.

  1. Installation
  2. Hacking
    1. Dependencies
    2. Bundle Generation

Installation

If you just want to use teepee, the suggested way is to download the bundled version, set the execution bit and put it somewhere in the PATH, like this:

curl -LO https://github.com/polettix/teepee/raw/master/bundle/teepee
#   wget https://github.com/polettix/teepee/raw/master/bundle/teepee
chmod +x teepee
sudo mv teepee /usr/local/bin

Your mileage may vary with the last command, ranging from whether you actually want to install in /usr/local/bin to whether you’re allowed to do that. You can choose any directory in the PATH of course, or use any other trick.

As an alternative, you can just get the code and take care to install support modules by yourself, like this:

# Install a few pre-requisite modules
cpanm Cpanel::JSON::XS YAML::XS Data::Crumbr Template::Perlish

curl -LO https://github.com/polettix/teepee/raw/master/teepee
#   wget https://github.com/polettix/teepee/raw/master/teepee
chmod +x teepee
sudo mv teepee /usr/local/bin

teepee is capable of using different modules for JSON and YAML, if you’re installing them yourself I’d just suggest to use the best around.

Hacking

The main repository is hosted on GitHub and is there to be forked! It is licensed under The Artistic License 2.0 so it should be pretty easy for you to do whatever you want with it.

The main script is teepee and it is located in the root directory of the project. There is also a bundled version available at bundle/teepee, including all dependencies inside the file itself and ready for installing around.

Dependencies

You will need to install dependencies, which are the following modules:

  • something to deal with JSON. Any of the following will do, although I’d suggest to go for the first one if possible:
  • something to deal with YAML. Any of the following will do, although I’d suggest to go for the first one if possible:
  • Data::Crumbr
  • Template::Perlish

If you’re planning on re-generating the bundled version, you should install YAML::Tiny and JSON::PP, as they are the ones used in the bundling process.

The dependencies might be installed with the Perl you are using, or locally using any mechanism (e.g. a local::lib of some sort). I usually install dependencies for bundling using epan with the following command:

mkdir _local
cd _local
epan add Data::Crumbr Template::Perlish YAML::Tiny JSON::PP
cd ..

Bundle Generation

The script update.sh will update the bundled version stored at bundle/teepee. It requires the dependencies to be available, see previous section for them.

The bundling script used mobundle from deployable. You can get it directly like this:

# mobundle has its own dependencies too...
cpanm File::Slurp Template::Perlish Path::Class

curl -LO http://repo.or.cz/w/deployable.git/blob_plain/HEAD:/mobundle
#   wget http://repo.or.cz/w/deployable.git/blob_plain/HEAD:/mobundle
chmod +x mobundle
sudo mv mobundle /usr/local/bin

Think of mobundle as a fatpacker that exists since 2007…

If you installed your dependency modules for teepee in a place where Perl does not normally look for, you have a few options. One, of course, is to fiddle with environment variable PERL5LIB. If you feel more like something less invasive for your environment, you can set up some localization via file _local/update-local.sh. For example, after I set up the local modules with epan as described in the previous section, I use the following localization script:

__update_local__() {
    declare ME=$(readlink -f "${BASH_SOURCE[0]}")
    declare MD=$(dirname "$ME")
    printf -v BASEDIR '%q' "$MD"
    MOBUNDLE_LOCAL_PARAMETERS="-I $BASEDIR/epan/local/lib/perl5"
}
__update_local__
unset -f __update_local__

It takes care to properly set environment variable MOBUNDLE_LOCAL_PARAMETERS, that is eventually used by update.sh when calling mobundle. You can find a commented version of the above script inside eg/update-local.sh, so if you’re following the hints on using epan you can just copy this file in _local.