summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeru Ohta <phjgt308@gmail.com>2015-09-08 04:07:30 +0900
committerTakeru Ohta <phjgt308@gmail.com>2015-09-08 04:30:22 +0900
commit4ff78b4d7785e567f682a9642772620043af788e (patch)
tree122c1280e053d4ee970c0ea9decc7fbbcd4f4f10
parentfa462e9dba1e3e94f6d74e36c99e25b80d4f524a (diff)
Add rebar_localfs_resource module for testing purposes
-rw-r--r--test/rebar_localfs_resource.erl38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/rebar_localfs_resource.erl b/test/rebar_localfs_resource.erl
new file mode 100644
index 0000000..d60421e
--- /dev/null
+++ b/test/rebar_localfs_resource.erl
@@ -0,0 +1,38 @@
+%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*-
+%% ex: ts=4 sw=4 et
+%%
+%% @doc A localfs custom resource (for testing purposes only)
+%%
+%% ```
+%% {deps, [
+%% %% Application files are copied from "/path/to/app_name"
+%% {app_name, {localfs, "/path/to/app_name", undefined}}
+%% ]}.
+%% '''
+-module(rebar_localfs_resource).
+
+-behaviour(rebar_resource).
+
+-export([lock/2
+ ,download/3
+ ,needs_update/2
+ ,make_vsn/1]).
+
+-include_lib("eunit/include/eunit.hrl").
+
+lock(AppDir, {localfs, Path, _Ref}) ->
+ lock(AppDir, {localfs, Path});
+lock(_AppDir, {localfs, Path}) ->
+ {localfs, Path, undefined}.
+
+needs_update(_AppDir, _Resource) ->
+ false.
+
+download(AppDir, {localfs, Path, _Ref}, State) ->
+ download(AppDir, {localfs, Path}, State);
+download(AppDir, {localfs, Path}, _State) ->
+ ok = rebar_file_utils:cp_r(filelib:wildcard(Path ++ "/*"), AppDir),
+ {ok, undefined}.
+
+make_vsn(_AppDir) ->
+ {plain, "undefined"}.