aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rlx_cmd_args.erl2
-rw-r--r--src/rlx_prv_release.erl3
-rw-r--r--src/rlx_util.erl13
3 files changed, 15 insertions, 3 deletions
diff --git a/src/rlx_cmd_args.erl b/src/rlx_cmd_args.erl
index b5fe8a7..1a8e7f2 100644
--- a/src/rlx_cmd_args.erl
+++ b/src/rlx_cmd_args.erl
@@ -34,7 +34,7 @@
relx:error().
args2state(Opts, Target)
when erlang:length(Target) == 0; erlang:length(Target) == 1 ->
- RelName = proplists:get_value(relname, Opts, undefined),
+ RelName = rlx_util:to_atom(proplists:get_value(relname, Opts, undefined)),
RelVsn = proplists:get_value(relvsn, Opts, undefined),
case convert_target(Target) of
{ok, AtomizedTarget} ->
diff --git a/src/rlx_prv_release.erl b/src/rlx_prv_release.erl
index 10e1eb0..ce14f4e 100644
--- a/src/rlx_prv_release.erl
+++ b/src/rlx_prv_release.erl
@@ -66,7 +66,6 @@ format_error({release_not_found, {RelName, RelVsn}}) ->
format_error({failed_solve, Error}) ->
io_lib:format("Failed to solve release:\n ~s",
[rlx_depsolver:format_error({error, Error})]).
-
%%%===================================================================
%%% Internal Functions
%%%===================================================================
@@ -158,7 +157,7 @@ solve_release(State0, DepGraph, RelName, RelVsn) ->
end
catch
throw:not_found ->
- ?RLX_ERROR({release_not_found, RelName, RelVsn})
+ ?RLX_ERROR({release_not_found, {RelName, RelVsn}})
end.
set_resolved(State, Release0, Pkgs) ->
diff --git a/src/rlx_util.erl b/src/rlx_util.erl
index c2b2081..ac6af5c 100644
--- a/src/rlx_util.erl
+++ b/src/rlx_util.erl
@@ -24,6 +24,7 @@
-export([mkdir_p/1,
to_binary/1,
to_string/1,
+ to_atom/1,
is_error/1,
error_reason/1,
indent/1,
@@ -59,6 +60,7 @@ to_binary(String) when erlang:is_list(String) ->
to_binary(Bin) when erlang:is_binary(Bin) ->
Bin.
+-spec to_string(binary() | string() | atom()) -> string().
to_string(Binary) when erlang:is_binary(Binary) ->
erlang:binary_to_list(Binary);
to_string(Atom) when erlang:is_atom(Atom) ->
@@ -66,6 +68,17 @@ to_string(Atom) when erlang:is_atom(Atom) ->
to_string(Else) when erlang:is_list(Else) ->
Else.
+-spec to_atom(atom() | string() | binary()) -> atom().
+to_atom(Binary)
+ when erlang:is_binary(Binary) ->
+ erlang:list_to_atom(to_string(Binary));
+to_atom(String)
+ when erlang:is_list(String) ->
+ erlang:list_to_atom(String);
+to_atom(Atom)
+ when erlang:is_atom(Atom) ->
+ Atom.
+
%% @doc get the reason for a particular relx error
-spec error_reason(relx:error()) -> any().
error_reason({error, {_, Reason}}) ->