Scaffolder

Scaffolder allows you to easily scaffold folder structure using an elixir map. It also allows you to generate a file. By default all folders or files generated by Scaffolder will be created under lib folder. Behind the scene, Scaffolder implement DFS to scaffold the folders and files.

As an example let say that you have the following map

structure = %{
  folder_one: %{
    file_one: "ex",
    file_two: "ex"
  },
  folder_two: %{
    nested_folder: %{
      file_three: "ex",
      file_four: {"ex", ""}
    }
  },
  file_five: "ex",
  file_six: {"ex", "defmodule FileSix do\n\nend"}
}

Calling scaffold/2 function

Scaffolder.scaffold(structure)

will generate the following folders and files under the lib (default) folder

lib
|__folder_one
|  |__file_one.ex
|  |__file_two.ex
|
|__folder_two
|  |__nested_folder
|     |__file_three.ex
|     |__file_four.ex
|
|__file_five.ex
|__file_six.ex

where file_six.ex will have the following code inside it

defmodule FileSix do

end

Think of scaffolder as your tool to create a standard for folder structure or code for your team. You could also utilize mix task with scaffolder to create your own sweet tool that could automatically generated your folder or code standard for your team.

Installation

If available in Hex, the package can be installed by adding scaffolder to your list of dependencies in mix.exs:

def deps do
  [
    {:scaffolder, "~> 0.1.0"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/scaffolder.