您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

44 行
1.1 KiB

  1. %% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*-
  2. %% ex: ts=4 sw=4 et
  3. %%
  4. %% @doc A localfs custom resource (for testing purposes only)
  5. %% implementing the deprecated rebar_resource instead of v2
  6. %%
  7. %% ```
  8. %% {deps, [
  9. %% %% Application files are copied from "/path/to/app_name"
  10. %% {app_name, {localfs, "/path/to/app_name", undefined}}
  11. %% ]}.
  12. %% '''
  13. -module(rebar_localfs_resource).
  14. -behaviour(rebar_resource).
  15. -export([init/1
  16. ,lock/2
  17. ,download/3
  18. ,needs_update/2
  19. ,make_vsn/1]).
  20. -include_lib("eunit/include/eunit.hrl").
  21. -spec init(rebar_state:t()) -> {ok, term()}.
  22. init(_State) ->
  23. {ok, #{}}.
  24. lock(AppDir, {localfs, Path, _Ref}) ->
  25. lock(AppDir, {localfs, Path});
  26. lock(_AppDir, {localfs, Path}) ->
  27. {localfs, Path, undefined}.
  28. needs_update(_AppDir, _Resource) ->
  29. false.
  30. download(AppDir, {localfs, Path, _Ref}, State) ->
  31. download(AppDir, {localfs, Path}, State);
  32. download(AppDir, {localfs, Path}, _State) ->
  33. ok = rebar_file_utils:cp_r(filelib:wildcard(Path ++ "/*"), AppDir),
  34. {ok, undefined}.
  35. make_vsn(_AppDir) ->
  36. {plain, "undefined"}.