Teeplate

A Crystal library for generating files from templates.

Installation

Add this to your application's shard.yml:

dependencies:
  teeplate:
    github: mosop/teeplate

Features

File Tree Template

Template directory structure

Template file example

# shard.yml.ecr
name: <%= @file %>
version: 0.1.0

authors:
  - <%= @author %>

license: MIT

Template class definition

class CrystalInitTemplate < Teeplate::FileTree
  directory "/path/to/template"

  @file : String
  @class : String
  @author : String
  @year : Int32

  def initialize(out_dir, @file, @class, @author, @year)
    super out_dir
  end
end

Here we go!

CrystalInitTemplate.new("/path/to/repo", "teeplate", "Teeplate", "mosop", 2016).render

Output directory structure

Output example

# shard.yml
name: teeplate
version: 0.1.0

authors:
  - mosop

license: MIT

Usage

require "teeplate"

and see Features

Wish List

Contributing

  1. Fork it ( https://github.com/mosop/teeplate/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors