/gen_ex

An Elixir generator.

Apache License 2.0Apache-2.0

gen_ex

A generic Elixir generator that doesn't require Phoenix.

I essentially want to create an Elixir tool similar to:

Concepts / Goals

  • EEx Templates

    • Put custom templates in priv/templates.
    • Run mix gen <template_slug> <args> to generate files.
    • Each file in priv/templates represents a template that will generate a single file.
      • priv/templates/new_thing.ex can be used by running mix gen new_thing <args>.
    • Each subdirectory in priv/templates represents a set of templates that will generate multiple files
      • priv/templates/new_things/ can be used by running mix gen new_things <args>.
      • If a directory shares the name of a single-file template, the single-file template will be used. If there are subdirectories, the generated code will match the same directory structure.
  • Tag metadata

    • The generator will tag generated files/modules with some sort of trackable metadata and version (similar to a Mix project).
    • It should allow manual editing of everything except the metadata tags.
    • You can get a list of all template usages and versions with mix gen.list <template_slug>
    • The generator will attempt to update old versions of templates via something like mix gen.update <template_slug> <new_version>.
      • If it can't, it will display code that needs to be manually added.

Links

Generic Elixir generators:

Phoenix generators:

Code modification: