diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2014-11-14 17:44:19 +0000 |
---|---|---|
committer | Fred Hebert <mononcqc@ferd.ca> | 2014-11-14 17:44:19 +0000 |
commit | ad9ca0cc8644b0a89a05ea184483c1d7b8318fcd (patch) | |
tree | 4720475fc96ecdd5fb2eb87147fee7a3131c93fc | |
parent | 284a5972fab4195f4f99d655bd2fbeecf1648858 (diff) |
Built-in templates create the project directory
-rw-r--r-- | doc/plugins.md | 5 | ||||
-rw-r--r-- | doc/templates.md | 1 | ||||
-rw-r--r-- | priv/templates/app.template | 12 | ||||
-rw-r--r-- | priv/templates/lib.template | 12 | ||||
-rw-r--r-- | priv/templates/plugin.template | 12 | ||||
-rw-r--r-- | priv/templates/release.template | 20 |
6 files changed, 32 insertions, 30 deletions
diff --git a/doc/plugins.md b/doc/plugins.md index f31f96b..5ba8e65 100644 --- a/doc/plugins.md +++ b/doc/plugins.md @@ -61,10 +61,11 @@ In this tutorial, we'll show how to start from scratch, and get a basic plugin w The first step is to create a new OTP Application that will contain the plugin: - → git init - Initialized empty Git repository in /Users/ferd/code/self/rebar3-todo-plugin/.git/ → rebar3 new plugin provider_todo desc="example rebar3 plugin" ... + → cd provider_todo + → git init + Initialized empty Git repository in /Users/ferd/code/self/provider_todo/.git/ Open up the `src/provider_todo.erl` file and make sure you have the following skeleton in place: diff --git a/doc/templates.md b/doc/templates.md index 888f356..096cd37 100644 --- a/doc/templates.md +++ b/doc/templates.md @@ -73,6 +73,7 @@ Alternatively, the `name` variable is special -- if the first argument to a temp → ./rebar3 new plugin demo author_name="Fred H." ... +Then go to the directory created for the project by rebar3. ## Custom Templates ## diff --git a/priv/templates/app.template b/priv/templates/app.template index 78374af..b7bfebc 100644 --- a/priv/templates/app.template +++ b/priv/templates/app.template @@ -3,9 +3,9 @@ {name, "mylib", "Name of the OTP application"}, {desc, "An OTP application", "Short description of the app"} ]}. -{template, "app.erl.dtl", "src/{{name}}_app.erl"}. -{template, "otp_app.app.src.dtl", "src/{{name}}.app.src"}. -{template, "rebar.config.dtl", "rebar.config"}. -{template, "gitignore.dtl", ".gitignore"}. -{template, "LICENSE.dtl", "LICENSE"}. -{template, "README.md.dtl", "README.md"}. +{template, "app.erl.dtl", "{{name}}/src/{{name}}_app.erl"}. +{template, "otp_app.app.src.dtl", "{{name}}/src/{{name}}.app.src"}. +{template, "rebar.config.dtl", "{{name}}/rebar.config"}. +{template, "gitignore.dtl", "{{name}}/.gitignore"}. +{template, "LICENSE.dtl", "{{name}}/LICENSE"}. +{template, "README.md.dtl", "{{name}}/README.md"}. diff --git a/priv/templates/lib.template b/priv/templates/lib.template index 1db3b07..4b9a75d 100644 --- a/priv/templates/lib.template +++ b/priv/templates/lib.template @@ -3,9 +3,9 @@ {name, "mylib", "Name of the OTP library application"}, {desc, "An OTP library", "Short description of the app"} ]}. -{template, "mod.erl.dtl", "src/{{name}}.erl"}. -{template, "otp_lib.app.src.dtl", "src/{{name}}.app.src"}. -{template, "rebar.config.dtl", "rebar.config"}. -{template, "gitignore.dtl", ".gitignore"}. -{template, "LICENSE.dtl", "LICENSE"}. -{template, "README.md.dtl", "README.md"}. +{template, "mod.erl.dtl", "{{name}}/src/{{name}}.erl"}. +{template, "otp_lib.app.src.dtl", "{{name}}/src/{{name}}.app.src"}. +{template, "rebar.config.dtl", "{{name}}/rebar.config"}. +{template, "gitignore.dtl", "{{name}}/.gitignore"}. +{template, "LICENSE.dtl", "{{name}}/LICENSE"}. +{template, "README.md.dtl", "{{name}}/README.md"}. diff --git a/priv/templates/plugin.template b/priv/templates/plugin.template index a7e15cc..3419191 100644 --- a/priv/templates/plugin.template +++ b/priv/templates/plugin.template @@ -3,9 +3,9 @@ {name, "myplugin", "Name of the plugin"}, {desc, "A rebar plugin", "Short description of the plugin's purpose"} ]}. -{template, "plugin.erl.dtl", "src/{{name}}.erl"}. -{template, "otp_lib.app.src.dtl", "src/{{name}}.app.src"}. -{template, "rebar.config.dtl", "rebar.config"}. -{template, "gitignore.dtl", ".gitignore"}. -{template, "LICENSE.dtl", "LICENSE"}. -{template, "plugin_README.md.dtl", "README.md"}. +{template, "plugin.erl.dtl", "{{name}}/src/{{name}}.erl"}. +{template, "otp_lib.app.src.dtl", "{{name}}/src/{{name}}.app.src"}. +{template, "rebar.config.dtl", "{{name}}/rebar.config"}. +{template, "gitignore.dtl", "{{name}}/.gitignore"}. +{template, "LICENSE.dtl", "{{name}}/LICENSE"}. +{template, "plugin_README.md.dtl", "{{name}}/README.md"}. diff --git a/priv/templates/release.template b/priv/templates/release.template index 3539392..eb8e6ab 100644 --- a/priv/templates/release.template +++ b/priv/templates/release.template @@ -3,13 +3,13 @@ {name, "myapp", "Name of the OTP release. An app with this name will also be created."}, {desc, "An OTP application", "Short description of the release's main app's purpose"} ]}. -{template, "app.erl.dtl", "{{apps_dir}}/{{name}}/src/{{name}}_app.erl"}. -{template, "sup.erl.dtl", "{{apps_dir}}/{{name}}/src/{{name}}_sup.erl"}. -{template, "otp_app.app.src.dtl", "{{apps_dir}}/{{name}}/src/{{name}}.app.src"}. -{template, "rebar.config.dtl", "rebar.config"}. -{template, "relx.config.dtl", "relx.config"}. -{template, "sys.config.dtl", "config/sys.config"}. -{template, "vm.args.dtl", "config/vm.args"}. -{template, "gitignore.dtl", ".gitignore"}. -{template, "LICENSE.dtl", "LICENSE"}. -{template, "README.md.dtl", "README.md"}. +{template, "app.erl.dtl", "{{name}}/{{apps_dir}}/{{name}}/src/{{name}}_app.erl"}. +{template, "sup.erl.dtl", "{{name}}/{{apps_dir}}/{{name}}/src/{{name}}_sup.erl"}. +{template, "otp_app.app.src.dtl", "{{name}}/{{apps_dir}}/{{name}}/src/{{name}}.app.src"}. +{template, "rebar.config.dtl", "{{name}}/rebar.config"}. +{template, "relx.config.dtl", "{{name}}/relx.config"}. +{template, "sys.config.dtl", "{{name}}/config/sys.config"}. +{template, "vm.args.dtl", "{{name}}/config/vm.args"}. +{template, "gitignore.dtl", "{{name}}/.gitignore"}. +{template, "LICENSE.dtl", "{{name}}/LICENSE"}. +{template, "README.md.dtl", "{{name}}/README.md"}. |