DiamondMVC / emeralD

Command-line tool for generating files from templates, scaffolding, generic shell command-passing etc.
MIT License
1 stars 1 forks source link

Real World Example #1

Open taylorh140 opened 6 years ago

taylorh140 commented 6 years ago

I just took a look at this. I'm not quite sure what kind of templating it does? (Html,D,code in general) It would be nice to have a use case shown.

bausshf commented 6 years ago

The templates are for like code snippets etc. that you can "scaffold" into your project to ex. auto generate modules, configuration files, resources etc.

If you look in templates each folder represents a type of template.

WIthin each type of templates there are files.

Each file represents a template.

The data that is "mixed" into the templates are the data that is passed to the command-line.

Then the template is simply put into the folder you're working in with the result of that.

It's basically similar to "snippets" in Atom.

https://flight-manual.atom.io/using-atom/sections/snippets/

Except emeralD templates can be used as both content snippets, but also as file snippets.

Example:

emerald d class myclass myclass MyClass

The above command will go into "d" templates" and then look for the template called "class" and then it will generate a class with the following arguments:

myclass myclass MyClass

Which corresponds to:

filename module-name class-name

The final result is a file called "myclass.d" with the following content:

module myclass;

class MyClass
{
    public:
    this()
    {
    }
}

Scaffolding is a little different than templates.

Scaffolding are basically just archives of files etc. that you can pull into your project.

An example of it would be the dub scaffolding archive, which is basically a preset for an empty dub project.

Example:

emerald --scaffold dub

The above will scaffold dub and create an empty dub project within your working directory.


Basically emeralD is a tool that can be used to ease file generation, scaffolding etc. of a project.

It's useful when you have different stacks etc. because you can integrate the thing into your build-system, deployment etc.