View Source Template Generator

Elixir project templates generation.

docs

Docs

installation

Installation

github

Github

Latest

> mix archive.install github viniciuslcpereira97/template-generator

Specific branch

> mix archive.install github viniciuslcpereira97/template-generator branch $BRANCH

Specific version

> mix archive.install github viniciuslcpereira97/template-generator tag $RELEASE_TAG

hex

Hex

> mix archive.install hex template_generator

configure

Configure

example-template-folder-structure

Example template folder structure

.
 example
     schemas
      example.ex
     services
         example.ex
         user
             user.ex

Set your templates directory's path in your config.exs.

config :generator,
  templates_dir: "./templates",
  templates: [
    my_awesome_template: "example"
  ]

templates_dir: Directory with all available templates templates: the key is an alias for your template and the value is the template folder name found at your templates_dir

usage

Usage

To create a new project based on an template you should run the following command:

> mix generator.new ./apps/my-awesome-new-folder --template=my_awesome_template

results

Results

project-folder-structure-before-running-the-task

Project folder structure before running the task

.
 generator.ex
 mix
  tasks
      generator.new.ex
 path
  adapters
   git_resolver.ex
   json_resolver.ex
   local_resolver.ex
   path_creator.ex
   path_resolver.ex
   template_directory.ex
   template_file.ex
  logic
  schemas
      template_directory.ex
      template_file.ex
 paths.ex
 project
  adapters
   project.ex
  logic
  schemas
      project.ex
 projects.ex
 template
  adapters
   template.ex
  logic
  schemas
      template.ex
 templates.ex

project-folder-structure-after-running-the-task

Project folder structure after running the task

.
 generator.ex
 mix
  tasks
      generator.new.ex
 my-awesome-new-folder
  schemas
   example.ex
  services
      example.ex
      user
          user.ex
 path
  adapters
   git_resolver.ex
   json_resolver.ex
   local_resolver.ex
   path_creator.ex
   path_resolver.ex
   template_directory.ex
   template_file.ex
  logic
  schemas
      template_directory.ex
      template_file.ex
 paths.ex
 project
  adapters
   project.ex
  logic
  schemas
      project.ex
 projects.ex
 template
  adapters
   template.ex
  logic
  schemas
      template.ex
 templates.ex