diff options
Diffstat (limited to 'priv')
-rw-r--r-- | priv/shell-completion/bash/rebar3 | 27 | ||||
-rw-r--r-- | priv/shell-completion/zsh/_rebar3 | 42 | ||||
-rw-r--r-- | priv/templates/gitignore | 1 | ||||
-rw-r--r-- | priv/templates/otp_app.app.src | 6 | ||||
-rw-r--r-- | priv/templates/otp_lib.app.src | 6 | ||||
-rw-r--r-- | priv/templates/plugin.erl | 31 | ||||
-rw-r--r-- | priv/templates/plugin.template | 1 | ||||
-rw-r--r-- | priv/templates/provider.erl | 32 |
8 files changed, 115 insertions, 31 deletions
diff --git a/priv/shell-completion/bash/rebar3 b/priv/shell-completion/bash/rebar3 index cb6f69d..4e28d3d 100644 --- a/priv/shell-completion/bash/rebar3 +++ b/priv/shell-completion/bash/rebar3 @@ -23,10 +23,13 @@ _rebar3() help \ new \ pkgs \ + plugins \ release \ + relup \ report \ shell \ tar \ + unlock \ update \ upgrade \ version \ @@ -93,6 +96,8 @@ _rebar3() lopts="--force" elif [[ ${prev} == pkgs ]] ; then : + elif [[ ${prev} == plugins ]] ; then + : elif [[ ${prev} == release ]] ; then sopts="-n -v -g -u -o -h -l -p -V -d -i -a -c -r" lopts="--relname \ @@ -115,6 +120,28 @@ _rebar3() --system_libs \ --version \ --root" + elif [[ ${prev} == relup ]] ; then + sopts="-n -v -g -u -o -h -l -p -V -d -i -a -c -r" + lopts="--relname \ + --relvsn \ + --goal \ + --upfrom \ + --output-dir \ + --help \ + --lib-dir \ + --path \ + --default-libs \ + --verbose \ + --dev-mode \ + --include-erts \ + --override \ + --config \ + --overlay_vars \ + --vm_args \ + --sys_config \ + --system_libs \ + --version \ + --root" elif [[ ${prev} == report ]] ; then : elif [[ ${prev} == shell ]] ; then diff --git a/priv/shell-completion/zsh/_rebar3 b/priv/shell-completion/zsh/_rebar3 index 6950688..b03b7c9 100644 --- a/priv/shell-completion/zsh/_rebar3 +++ b/priv/shell-completion/zsh/_rebar3 @@ -72,6 +72,9 @@ _rebar3 () { '(-v --verbose)'{-v,--verbose}'[Print coverage analysis]' \ && ret=0 ;; + (deps) + _message 'no more arguments' && ret=0 + ;; (dialyzer) _arguments \ '(-u --update-plt)'{-u, --update-plt}'[Enable updating the PLT.]' \ @@ -100,7 +103,7 @@ _rebar3 () { ;; (new) _arguments \ - '1:type:(app lib release plugin)' \ + '1:type:(app cmake escript lib plugin release)' \ '2:name:' \ '(-f --force)'{-f,--force}'[ overwrite existing files]' \ && ret=0 @@ -108,6 +111,11 @@ _rebar3 () { (pkgs) _message 'List available packages.' && ret=0 ;; + (plugins) + _arguments \ + '1:type:(list upgrade)' \ + && ret=0 + ;; (release) _arguments \ '(-n --relname)'{-n,--relname}'[Specify the name for the release that will be generated.]:relname' \ @@ -131,6 +139,29 @@ _rebar3 () { '(-r --root)'{-r,--root}'[The project root directory]:system libs:_files -/' \ && ret=0 ;; + (relup) + _arguments \ + '(-n --relname)'{-n,--relname}'[Specify the name for the release that will be generated.]:relname' \ + '(-v --relvsn)'{-n,--relname}'[Specify the version for the release.]:relvsn' \ + '(-g --goal)'{-g,--goal}'[Specify a target constraint on the system. These are usually the OTP.]:goal' \ + '(-u --upfrom)'{-u,--upfrom}'[Only valid with relup target, specify the release to upgrade from.]:upfrom' \ + '(-o --output-dir)'{-o,--output-dir}'[The output directory for the release. This is ./ by default.]:out directory:_files -/' \ + '(-l --lib-dir)'{-l,--output-dir}'[Additional dir that should be searched for OTP Apps]:lib directory:_files -/' \ + '(-p --path)'{-p,--path}'[Additional dir to add to the code path]:path directory:_files -/' \ + '(--default-libs)--default-libs[Whether to use the default system added lib dirs]:default libs:(true false)' \ + '(-V --verbose)'{-V,--verbose}'[Verbosity level, maybe between 0 and 3 ,default: 2]:verbosity level:(0 1 2 3)' \ + '(-d --dev-mode)'{-d,--dev-mode}'[Symlink the applications and configuration into the release instead of copying]' \ + '(-i --include-erts)'{-i,--dev-mode}'[If true include a copy of erts used to build with, if a path include erts at that path. If false, do not include erts]' \ + '(-a --override)'{-a,--override}'[Provide an app name and a directory to override in the form <appname>:<app directory>]:override' \ + '(-c --config)'{-c,--config}'[The path to a config file]:config file:_files ' \ + '(--overlay_vars)--overlay_vars[Path to a file of overlay variables]:overlay variables file:_files' \ + '(--vm_args)--vm_args[Path to a file to use for vm.args]:vm args file:_files' \ + '(--sys_config)--sys_config[Path to a file to use for sys.config]:sys config file:_files' \ + '(--system_libs)--system_libs[Path to dir of Erlang system libs]:system libs:_files -/' \ + '(--version)--version[Print relx version]' \ + '(-r --root)'{-r,--root}'[The project root directory]:system libs:_files -/' \ + && ret=0 + ;; (report) _arguments '1: :_rebar3_tasks' && ret=0 ;; @@ -160,6 +191,11 @@ _rebar3 () { '(-r --root)'{-r,--root}'[The project root directory]:system libs:_files -/' \ && ret=0 ;; + (unlock) + _arguments \ + '*: :_rebar3_list_deps' \ + && ret=0 + ;; (update) _message 'rebar update' && ret=0 ;; @@ -185,6 +221,7 @@ _rebar3_tasks() { 'compile:Compile apps .app.src and .erl files.' 'cover:Perform coverage analysis.' 'ct:Run Common Tests.' + 'deps:List dependencies.' 'dialyzer:Run the Dialyzer analyzer on the project.' 'do:Higher order provider for running multiple tasks in a sequence.' 'edoc:Generate documentation using edoc.' @@ -193,10 +230,13 @@ _rebar3_tasks() { 'help:Display a list of tasks or help for a given task or subtask.' 'new:Create new project from templates.' 'pkgs:List available packages.' + 'plugins:List or upgrade plugins.' 'release:Build release of project.' + 'relup:Create relup from 2 releases.' 'report:Provide a crash report to be sent to the rebar3 issues page.' 'shell:Run shell with project apps and deps in path.' 'tar:Tar archive of release built of project.' + 'unlock:Unlock dependencies.' 'update:Update package index.' 'upgrade:Upgrade dependencies.' 'version:Print version for rebar and current Erlang.' diff --git a/priv/templates/gitignore b/priv/templates/gitignore index 40a1d4f..a939dce 100644 --- a/priv/templates/gitignore +++ b/priv/templates/gitignore @@ -16,3 +16,4 @@ _deps _plugins _tdeps logs +_build
\ No newline at end of file diff --git a/priv/templates/otp_app.app.src b/priv/templates/otp_app.app.src index 9ad7478..09e4a48 100644 --- a/priv/templates/otp_app.app.src +++ b/priv/templates/otp_app.app.src @@ -8,5 +8,9 @@ stdlib ]}, {env,[]}, - {modules, []} + {modules, []}, + + {contributors, []}, + {licenses, []}, + {links, []} ]}. diff --git a/priv/templates/otp_lib.app.src b/priv/templates/otp_lib.app.src index 3f4b56b..f07293e 100644 --- a/priv/templates/otp_lib.app.src +++ b/priv/templates/otp_lib.app.src @@ -7,5 +7,9 @@ stdlib ]}, {env,[]}, - {modules, []} + {modules, []}, + + {contributors, []}, + {licenses, []}, + {links, []} ]}. diff --git a/priv/templates/plugin.erl b/priv/templates/plugin.erl index 018dd0e..c6e5e40 100644 --- a/priv/templates/plugin.erl +++ b/priv/templates/plugin.erl @@ -1,33 +1,8 @@ -module('{{name}}'). --behaviour(provider). --export([init/1, do/1, format_error/1]). +-export([init/1]). --define(PROVIDER, '{{name}}'). --define(DEPS, [app_discovery]). - -%% =================================================================== -%% Public API -%% =================================================================== -spec init(rebar_state:t()) -> {ok, rebar_state:t()}. init(State) -> - Provider = providers:create([ - {name, ?PROVIDER}, % The 'user friendly' name of the task - {module, ?MODULE}, % The module implementation of the task - {bare, true}, % The task can be run by the user, always true - {deps, ?DEPS}, % The list of dependencies - {example, "rebar3 {{name}}"}, % How to use the plugin - {opts, []}, % list of options understood by the plugin - {short_desc, "{{desc}}"}, - {desc, "{{desc}}"} - ]), - {ok, rebar_state:add_provider(State, Provider)}. - - --spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. -do(State) -> - {ok, State}. - --spec format_error(any()) -> iolist(). -format_error(Reason) -> - io_lib:format("~p", [Reason]). + {ok, State1} = '{{name}}_prv':init(State), + {ok, State1}. diff --git a/priv/templates/plugin.template b/priv/templates/plugin.template index 811be0b..c0e36de 100644 --- a/priv/templates/plugin.template +++ b/priv/templates/plugin.template @@ -4,6 +4,7 @@ {desc, "A rebar plugin", "Short description of the plugin's purpose"} ]}. {template, "plugin.erl", "{{name}}/src/{{name}}.erl"}. +{template, "provider.erl", "{{name}}/src/prv_{{name}}_prv.erl"}. {template, "otp_lib.app.src", "{{name}}/src/{{name}}.app.src"}. {template, "rebar.config", "{{name}}/rebar.config"}. {template, "gitignore", "{{name}}/.gitignore"}. diff --git a/priv/templates/provider.erl b/priv/templates/provider.erl new file mode 100644 index 0000000..669df83 --- /dev/null +++ b/priv/templates/provider.erl @@ -0,0 +1,32 @@ +-module('{{name}}_prv'). + +-export([init/1, do/1, format_error/1]). + +-define(PROVIDER, '{{name}}'). +-define(DEPS, [app_discovery]). + +%% =================================================================== +%% Public API +%% =================================================================== +-spec init(rebar_state:t()) -> {ok, rebar_state:t()}. +init(State) -> + Provider = providers:create([ + {name, ?PROVIDER}, % The 'user friendly' name of the task + {module, ?MODULE}, % The module implementation of the task + {bare, true}, % The task can be run by the user, always true + {deps, ?DEPS}, % The list of dependencies + {example, "rebar3 {{name}}"}, % How to use the plugin + {opts, []}, % list of options understood by the plugin + {short_desc, "{{desc}}"}, + {desc, "{{desc}}"} + ]), + {ok, rebar_state:add_provider(State, Provider)}. + + +-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. +do(State) -> + {ok, State}. + +-spec format_error(any()) -> iolist(). +format_error(Reason) -> + io_lib:format("~p", [Reason]). |