diff --git a/Makefile b/Makefile index 3129d25a..2c16f619 100644 --- a/Makefile +++ b/Makefile @@ -52,3 +52,17 @@ distclean: .PHONY: rel rel: $(REBAR) $(REBAR) emqx_plugrel tar + +.PHONY: fmt +fmt: $(REBAR) + @find . \( -name '*.app.src' -o \ + -name '*.erl' -o \ + -name '*.hrl' -o \ + -name 'rebar.config' -o \ + -name '*.eterm' -o \ + -name '*.escript' \) \ + -not -path '*/_build/*' \ + -not -path '*/deps/*' \ + -not -path '*/_checkouts/*' \ + -type f \ + | xargs | $(REBAR) fmt --verbose -w \ No newline at end of file diff --git a/README_template.md b/README_template.md index 8c5a2562..d49243e5 100644 --- a/README_template.md +++ b/README_template.md @@ -16,5 +16,11 @@ In a shell from this plugin's working directory execute `make rel` to have the p ``` _build/default/emqx_plugrel/emqx_plugin_template-.tar.gz ``` +## Format + +Format all the files in your project by running: +``` +make fmt +``` See [EMQX documentation](https://docs.emqx.com/en/enterprise/v5.0/extensions/plugins.html) for details on how to deploy custom plugins. diff --git a/emqx-plugin.template b/emqx-plugin.template index 5060e6ad..ef620792 100644 --- a/emqx-plugin.template +++ b/emqx-plugin.template @@ -3,7 +3,7 @@ {description, "Another amazing EMQX plugin."}, {version, "1.0.0", "The release version of this plugin."}, {app_vsn, "0.1.0", "The erlang application vsn value."}, - {emqx_vsn, "v5.6.1", "EMQX version to use as a dependency."}, + {emqx_vsn, "v5.7.1", "EMQX version to use as a dependency."}, {license, "Apache-2.0", "Short identifier for license you want to distribute this plugin under."}, {author_website, "http://example.com", "A website with details about the author."}, {repo, "https://github.com/emqx/emqx-plugin-template", "Where to find the source code for this plugin."} diff --git a/rebar_template.config b/rebar_template.config index fed83f0a..c800d6bb 100644 --- a/rebar_template.config +++ b/rebar_template.config @@ -12,7 +12,8 @@ ]}. {plugins, [ - {emqx_plugrel, {git, "https://github.com/emqx/emqx_plugrel.git", {tag, "0.5.0"}}} + {emqx_plugrel, {git, "https://github.com/emqx/emqx_plugrel.git", {tag, "0.5.0"}}}, + {erlfmt, "1.3.0"} ]}. {erl_opts, [debug_info]}.