aboutsummaryrefslogtreecommitdiffstats
path: root/src/rlx_prv_overlay.erl
diff options
context:
space:
mode:
authorLuis Rascao <[email protected]>2016-09-24 00:39:07 +0100
committerLuis Rascao <[email protected]>2016-09-25 23:23:30 +0100
commit7dcfafcae37d6f58fe43b5ea2f06e67c8e8428b6 (patch)
treecb0f92bad71a2b3705d6f5aa5f1434268b1fcd1a /src/rlx_prv_overlay.erl
parentc7e6d8119037d4d4ab117381027f379de9a6a5df (diff)
downloadrelx-7dcfafcae37d6f58fe43b5ea2f06e67c8e8428b6.tar.gz
relx-7dcfafcae37d6f58fe43b5ea2f06e67c8e8428b6.tar.bz2
relx-7dcfafcae37d6f58fe43b5ea2f06e67c8e8428b6.zip
Silence dialyzer warnings
Fix/add method specs, remove unreachable branches, make rlx_util:render/2 accept both iolists and binaries.
Diffstat (limited to 'src/rlx_prv_overlay.erl')
-rw-r--r--src/rlx_prv_overlay.erl11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/rlx_prv_overlay.erl b/src/rlx_prv_overlay.erl
index becdb32..71aca97 100644
--- a/src/rlx_prv_overlay.erl
+++ b/src/rlx_prv_overlay.erl
@@ -442,8 +442,8 @@ is_directory(ToFile0, ToFile1) ->
end.
--spec render_template(proplists:proplist(), iolist()) ->
- ok | relx:error().
+-spec render_template(proplists:proplist(), binary()) ->
+ {ok, binary()} | relx:error().
render_template(OverlayVars, Data) ->
case rlx_util:render(Data, OverlayVars) of
{ok, IoData} ->
@@ -452,6 +452,8 @@ render_template(OverlayVars, Data) ->
?RLX_ERROR({unable_to_render_template, Data, Reason})
end.
+-spec write_template(proplists:proplist(), file:name(), file:name()) ->
+ ok | relx:error().
write_template(OverlayVars, FromFile, ToFile) ->
case file:read_file(FromFile) of
{ok, File} ->
@@ -477,10 +479,11 @@ write_template(OverlayVars, FromFile, ToFile) ->
?RLX_ERROR({read_template, FromFile, Error})
end.
+-spec render_string(proplists:proplist(), iolist()) ->
+ binary() | relx:error().
render_string(OverlayVars, Data) ->
case rlx_util:render(Data, OverlayVars) of
- {ok, IoList} ->
- erlang:iolist_to_binary(IoList);
+ {ok, Bin} -> Bin;
{error, Error} ->
?RLX_ERROR({render_failed, Data, Error})
end.