All Projects → rwdaigle → Exgen

rwdaigle / Exgen

Licence: mit
A templating library for generating reusable Elixir projects

Programming Languages

elixir
2628 projects

Labels

Projects that are alternatives of or similar to Exgen

Iobroker.vis Template
Template for ioBroker.vis widget set.
Stars: ✭ 7 (-74.07%)
Mutual labels:  template
Heroku Wp
WordPress on Heroku
Stars: ✭ 865 (+3103.7%)
Mutual labels:  template
Laravel Tabler
Laravel Package for integrating Tabler template and this package is Laravel Mix friendly.
Stars: ✭ 20 (-25.93%)
Mutual labels:  template
Express Boilerplate
🚀 Starter project for a RESTful API in Node with Express & mongoose component-based
Stars: ✭ 9 (-66.67%)
Mutual labels:  template
Genus
A general code generation tools for Go applications
Stars: ✭ 11 (-59.26%)
Mutual labels:  template
Template Micro Service
Scaffolding out a micro-service
Stars: ✭ 12 (-55.56%)
Mutual labels:  template
C cpp project framework
CMake build system( framework) with kconfig support for C/CPP projects
Stars: ✭ 26 (-3.7%)
Mutual labels:  template
Masterportfolio
🔥 The Complete Customizable Software Developer Portfolio Template which lets you showcase your work and provides each and every detail about you as Software Developer.
Stars: ✭ 913 (+3281.48%)
Mutual labels:  template
Cookiecutter Pylibrary
Enhanced cookiecutter template for Python libraries.
Stars: ✭ 862 (+3092.59%)
Mutual labels:  template
Heroku Aiohttp Web
A project starter template for deploying an aiohttp app to Heroku
Stars: ✭ 14 (-48.15%)
Mutual labels:  template
Yii2 App Another
Yii 2 Another Project Template
Stars: ✭ 9 (-66.67%)
Mutual labels:  template
Restacey
Responsive template for Stacey
Stars: ✭ 10 (-62.96%)
Mutual labels:  template
Drl Theme Manager
Xcode File Template to generate theme manager for Swift 3+
Stars: ✭ 12 (-55.56%)
Mutual labels:  template
Latex Mimosis
A minimal & modern LaTeX template for your (bachelor's | master's | doctoral) thesis
Stars: ✭ 850 (+3048.15%)
Mutual labels:  template
Unityfx
DocFX template to create Unity-esque documentation
Stars: ✭ 21 (-22.22%)
Mutual labels:  template
Krew Plugin Template
GitHub Repository Template for creating new Kubectl plugins
Stars: ✭ 27 (+0%)
Mutual labels:  template
Modern Resume Theme
A modern static resume template and theme. Powered by Jekyll and GitHub pages.
Stars: ✭ 868 (+3114.81%)
Mutual labels:  template
Swiftproject
🏆 Generate Swift project with necessary toolings
Stars: ✭ 27 (+0%)
Mutual labels:  template
Zstemplatedlistscene
列表类应用场景模板化
Stars: ✭ 20 (-25.93%)
Mutual labels:  template
Bcf Skeleton
BigClown Firmware Skeleton (Empty Application)
Stars: ✭ 14 (-48.15%)
Mutual labels:  template

Exgen

Quickly generate Elixir apps from templates.

$ mix exgen.new some_app -t https://github.com/rwdaigle/exgen-plug-simple.git --app-name some_app --module SomeApp
* creating some_app/lib/some_app.ex
* creating some_app/lib/some_app/router.ex

Overview

Templates are just EEx files that are evaluated at runtime. A simple template might be a single file with a variable substitution in EEx form:

defmodule <%= module %>.Router do
end

Use Exgen's simple CLI to create a new app from this template:

$ mix exgen.new target_dir -t /path/to/template --module MyApp

Which will create a single file in the target_dir with the following contents:

defmodule MyApp.Router do
end

Installation

Exgen is distributed as a set of Mix tasks (much like Phoenix generators). Install them via Mix:

$ mix archive.install https://github.com/rwdaigle/exgen/raw/master/archives/exgen-0.5.1.ez

The tasks will then be available in Mix under the exgen namespace:

$ mix -h | grep "exgen."
mix exgen.new     # Generate a new project from a template

Usage

Exgen operates by fetching a templatized app from a remote git repo or a local source. For instance, to quickly generate a basic Plug web app from this template:

$ mix exgen.new some_app -t https://github.com/rwdaigle/exgen-plug-simple.git --app-name some_app --module SomeApp
* creating some_app/lib/some_app.ex
* creating some_app/lib/some_app/router.ex

If you have an app template on your local filesystem you can just point to its path:

$ mix exgen.new some_app -t ~/dev/exgen-templates/exgen-plug-simple --app-name some_app --module SomeApp
* creating some_app/lib/some_app.ex
* creating some_app/lib/some_app/router.ex

Any variables needed by the template can be passed in from the CLI using switches. So if a template requires the app_name and module variables, use the --app-name and --module switches as above (switches are automatically underscored before being exposed to the template EEx context).

Creating templates

For easy consistency and recognition, templates should be named with the following structure: exgen-category-purpose. For instance, a simple web app using only Plug is called exgen-plug-simple.

A template is just a set of EEx files with <%= variable %> statements in the file bodies (and even the file names themselves).

|- <%= app_name %>.ex
|- mix.exs
|- <%= app_name %>
  |- router.ex

This template generated with the --app-name my_app switch will result in the following file structure:

|- my_app.ex
|- mix.exs
|- my_app
  |- router.ex

Templates

The following exgen templates are available from the community:

If you would like yours listed here, edit this file and submit a PR

App Command w/ switches
Simple Plug web app $ mix exgen.new -t https://github.com/rwdaigle/exgen-plug-simple.git --app-name my_app --module MyApp

Contributing

Testing

Run automated tests:

$ mix test

You can also manually test the tasks by installing the archive locally:

$ mix do archive.build, archive.install

Release

Exgen is distributed as a mix archive. Build the archive with:

$ mix archive.build
$ mv exgen-*.ez archives/

Todo

Some things I'd like to add include:

  • Support testing workflow for template authors
  • Silence git output (in tests at least)
  • Use test tags to segment tests by remote/local

Contributors

Code contributors include:

Changelog

0.5.2

  • Support dynamic switch in Elixir 1.4
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].