{"id":13509135,"url":"https://github.com/rwdaigle/exgen","last_synced_at":"2026-01-25T00:08:20.528Z","repository":{"id":140515536,"uuid":"64164628","full_name":"rwdaigle/exgen","owner":"rwdaigle","description":"A templating library for generating reusable Elixir projects","archived":false,"fork":false,"pushed_at":"2020-01-16T19:41:32.000Z","size":98,"stargazers_count":35,"open_issues_count":2,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-22T13:33:53.396Z","etag":null,"topics":["elixir","mix","template"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rwdaigle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-07-25T20:11:14.000Z","updated_at":"2024-04-22T13:33:53.397Z","dependencies_parsed_at":null,"dependency_job_id":"90fc3ddb-b63e-40c3-a715-c916170617fe","html_url":"https://github.com/rwdaigle/exgen","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwdaigle%2Fexgen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwdaigle%2Fexgen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwdaigle%2Fexgen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwdaigle%2Fexgen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rwdaigle","download_url":"https://codeload.github.com/rwdaigle/exgen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222552581,"owners_count":17002111,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","mix","template"],"created_at":"2024-08-01T02:01:03.436Z","updated_at":"2026-01-25T00:08:20.484Z","avatar_url":"https://github.com/rwdaigle.png","language":"Elixir","funding_links":[],"categories":["Templating","Tooling"],"sub_categories":[],"readme":"# Exgen\n\nQuickly generate Elixir apps from templates.\n\n```bash\n$ mix exgen.new some_app -t https://github.com/rwdaigle/exgen-plug-simple.git --app-name some_app --module SomeApp\n* creating some_app/lib/some_app.ex\n* creating some_app/lib/some_app/router.ex\n```\n\n## Overview\n\nTemplates are just [EEx](http://elixir-lang.org/docs/stable/eex/EEx.html) files that are evaluated at runtime. A simple template might be a single file with a variable substitution in EEx form:\n\n```elixir\ndefmodule \u003c%= module %\u003e.Router do\nend\n```\n\nUse Exgen's simple CLI to create a new app from this template:\n\n```bash\n$ mix exgen.new target_dir -t /path/to/template --module MyApp\n```\n\nWhich will create a single file in the `target_dir` with the following contents:\n\n```elixir\ndefmodule MyApp.Router do\nend\n```\n\n## Installation\n\nExgen is distributed as a set of Mix tasks (much like Phoenix generators). Install them via Mix:\n\n```bash\n$ mix archive.install https://github.com/rwdaigle/exgen/raw/master/archives/exgen-0.5.1.ez\n```\n\nThe tasks will then be available in Mix under the `exgen` namespace:\n\n```bash\n$ mix -h | grep \"exgen.\"\nmix exgen.new     # Generate a new project from a template\n```\n\n## Usage\n\nExgen 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](https://github.com/rwdaigle/exgen-plug-simple):\n\n```bash\n$ mix exgen.new some_app -t https://github.com/rwdaigle/exgen-plug-simple.git --app-name some_app --module SomeApp\n* creating some_app/lib/some_app.ex\n* creating some_app/lib/some_app/router.ex\n```\n\nIf you have an app template on your local filesystem you can just point to its path:\n\n```bash\n$ mix exgen.new some_app -t ~/dev/exgen-templates/exgen-plug-simple --app-name some_app --module SomeApp\n* creating some_app/lib/some_app.ex\n* creating some_app/lib/some_app/router.ex\n```\n\nAny 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).\n\n## Creating templates\n\nFor 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`.\n\nA template is just a set of EEx files with `\u003c%= variable %\u003e` statements in the file bodies (and even the file names themselves).\n\n```text\n|- \u003c%= app_name %\u003e.ex\n|- mix.exs\n|- \u003c%= app_name %\u003e\n  |- router.ex\n```\n\nThis template generated with the `--app-name my_app` switch will result in the following file structure:\n\n```text\n|- my_app.ex\n|- mix.exs\n|- my_app\n  |- router.ex\n```\n\n## Templates\n\nThe following exgen templates are available from the community:\n\n_If you would like yours listed here, edit this file and submit a PR_\n\nApp | Command w/ switches\n----|--------------------\n[Simple Plug web app](https://github.com/rwdaigle/exgen-plug-simple) | `$ mix exgen.new -t https://github.com/rwdaigle/exgen-plug-simple.git --app-name my_app --module MyApp`\n\n## Contributing\n\n### Testing\n\nRun automated tests:\n\n```bash\n$ mix test\n```\n\nYou can also manually test the tasks by installing the archive locally:\n\n```bash\n$ mix do archive.build, archive.install\n```\n\n### Release\n\nExgen is distributed as a mix archive. Build the archive with:\n\n```bash\n$ mix archive.build\n$ mv exgen-*.ez archives/\n```\n\n## Todo\n\nSome things I'd like to add include:\n\n* Support testing workflow for template authors\n* Silence git output (in tests at least)\n* Use test tags to segment tests by remote/local\n\n## Contributors\n\nCode contributors include:\n\n* [jknipp](https://github.com/jknipp)\n\n## Changelog\n\n### 0.5.2\n\n* Support dynamic switch in Elixir 1.4\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwdaigle%2Fexgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frwdaigle%2Fexgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwdaigle%2Fexgen/lists"}