Current section

Files

Jump to
rebar3_lfe src rebar3_lfe_prv_clean.erl
Raw

src/rebar3_lfe_prv_clean.erl

-module(rebar3_lfe_prv_clean).
-export([init/1,
do/1,
format_error/1]).
-include("rebar3_lfe.hrl").
-define(PROVIDER, clean).
-define(DEPS, [{default, clean}]).
%% =============================================================================
%% Plugin API
%% =============================================================================
init(State) ->
Description = "Clean apps .ebin files",
Provider = providers:create([
{namespace, ?NAMESPACE},
{name, ?PROVIDER},
{module, ?MODULE},
{bare, true},
{deps, ?DEPS},
{example, "rebar3 lfe clean"},
{opts, []},
{short_desc, Description},
{desc, info(Description)}
]),
{ok, rebar_state:add_provider(State, Provider)}.
do(State) ->
rebar_paths:set_paths([deps, plugins], State),
rebar3_lfe_clean:apps_beam_files(State),
{ok, State}.
format_error(Reason) ->
io_lib:format("~p", [Reason]).
%% =============================================================================
%% Internal functions
%% =============================================================================
info(Description) ->
io_lib:format(
"~n~s~n"
"~n"
"This deletes the compiled .ebin files for a project's apps.~n",
[Description]).