templater summary

Plugin Name: templater
Version: 0.0.13
Author: @melezhik
Realease Date: 2018-06-06 17:04:46
Short Description: Simple templater
Category: sparrowdo
Plugin web page: https://github.com/melezhik/templater
 
Download link: templater-v0.000013.tar.gz
Latest version link: https://sparrowhub.org/info/templater

# 0.0.13

changed outthentic messages ( concise )

# 0.0.12

add message when file is updated

# 0.0.11

on_change hook - use Bash eval

# 0.0.9-10

* Support triggers ( `on_change` parameter  )

# 0.0.8

* Use `chown :group` to set group, to make this works when `chrgp` is not available ( f.e. at Minoca OS)

templater documentation

SYNOPSIS

Simple templater based on Template-Toolkit engine.

INSTALL

  $ sparrow plg install templater

USAGE

Via sparrowdo

  $ cat sparrowfile

  task-run 'greetings file', 'templater', %(
    variables => %(
      name => 'sparrowdo',
      language => 'perl6'
    ),
    target  => '/etc/greetings.out',
    owner   => 'user',
    group   => 'user'
    mode    => '644',
    source  => slurp 'templates/greetings.tmpl'
  );


  $ cat templates/greetings.tmp

  Hello, my name is [% name %]!
  I speak [% language %]

Parameters

variables

A list of variables get passed into template. No default value. Optional.

target

A file path to write a rendered template to. No default value. Should be set.

owner

Sets a target ownership to owner. No default value. Optional.

group

Sets a target group to group. No default value. Optional.

on_change

Sets the command to be executed when file changes:

  task-run 'populate config', 'templater', %(
    variables => %(
      name => 'sparrowdo ...',
      language => 'perl6'
    ),
    on_change => "echo trigger run",
    target  => '/tmp/out.txt',
    source  => slurp 'examples/foo.tmpl'
  );

Author

Alexey Melezhik

See also

Template-Toolkit