ProductPromotion
Logo

Elixir

made by https://0x3d.site

GitHub - rwdaigle/exgen: A templating library for generating reusable Elixir projects
A templating library for generating reusable Elixir projects - rwdaigle/exgen
Visit Site

GitHub - rwdaigle/exgen: A templating library for generating reusable Elixir projects

GitHub - rwdaigle/exgen: A templating library for generating reusable Elixir projects

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

Articles
to learn more about the elixir concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about Elixir.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory