Generators can be a helpful tool in writing idiomatic elixir code quickly. Why not take things a step further and make a generator for generators?
Degenerator takes a module that you give it and creates a generator for that module.
While this is in ealry stages, this will be available on github:
def deps do
[
{:degenerator, github: "baradoy/degenerator", only: :dev}
]
endOr you can install it through mix archive:
mix archive.install github baradoy/degeneratorYou can create a generator from an existing module with:
mix degenerator --module MyProject.MyModule --generator degenerator.gen.my_generatorSubsequent runs of degenerator will add to the new module template to the existing generator.
- A big refactor to organize code and reduce complexity and add tests
- Support module names with prefix or suffixes such as `MyProjectWeb.MyModuleController,
- Supoport conditional sections, i.e.
--no-schema
- The generators that are created rely on Phoenix.Mix as at least a dev dependancy.
- This might not work with umbrella projects in the slightest.
- Does not detect ProjectWeb correctly