소스 검색

code cleanup

pull/3/head
Tristan Sloughter 10 년 전
부모
커밋
da75d73b2f
1개의 변경된 파일15개의 추가작업 그리고 22개의 파일을 삭제
  1. +15
    -22
      src/rebar_prv_install_deps.erl

+ 15
- 22
src/rebar_prv_install_deps.erl 파일 보기

@ -136,7 +136,6 @@ handle_deps(State, Deps, Update) ->
%% Internal functions %% Internal functions
%% =================================================================== %% ===================================================================
%-spec package_to_app(any(), ) -> []. % [rebar_app_info:t()].
package_to_app(DepsDir, Packages, Pkg={_, Vsn}) -> package_to_app(DepsDir, Packages, Pkg={_, Vsn}) ->
Name = ec_cnv:to_binary(rlx_depsolver:dep_pkg(Pkg)), Name = ec_cnv:to_binary(rlx_depsolver:dep_pkg(Pkg)),
FmtVsn = iolist_to_binary(rlx_depsolver:format_version(Vsn)), FmtVsn = iolist_to_binary(rlx_depsolver:format_version(Vsn)),
@ -263,27 +262,23 @@ parse_deps(DepsDir, Deps) ->
(Name, {SrcDepsAcc, PkgDepsAcc}) when is_atom(Name) -> (Name, {SrcDepsAcc, PkgDepsAcc}) when is_atom(Name) ->
{SrcDepsAcc, [ec_cnv:to_binary(Name) | PkgDepsAcc]}; {SrcDepsAcc, [ec_cnv:to_binary(Name) | PkgDepsAcc]};
({Name, Vsn, Source}, {SrcDepsAcc, PkgDepsAcc}) when is_tuple (Source) -> ({Name, Vsn, Source}, {SrcDepsAcc, PkgDepsAcc}) when is_tuple (Source) ->
Dir = ec_cnv:to_list(get_deps_dir(DepsDir, Name)),
{ok, Dep} = case rebar_app_info:discover(Dir) of
{ok, App} ->
{ok, App};
not_found ->
rebar_app_info:new(Name, Vsn, Dir)
end,
Dep1 = rebar_app_info:source(Dep, Source),
{[Dep1 | SrcDepsAcc], PkgDepsAcc};
Dep = new_dep(DepsDir, Name, Vsn, Source),
{[Dep | SrcDepsAcc], PkgDepsAcc};
({Name, Vsn, Source, _Level}, {SrcDepsAcc, PkgDepsAcc}) when is_tuple (Source) -> ({Name, Vsn, Source, _Level}, {SrcDepsAcc, PkgDepsAcc}) when is_tuple (Source) ->
Dir = ec_cnv:to_list(get_deps_dir(DepsDir, Name)),
{ok, Dep} = case rebar_app_info:discover(Dir) of
{ok, App} ->
{ok, App};
not_found ->
rebar_app_info:new(Name, Vsn, Dir)
end,
Dep1 = rebar_app_info:source(Dep, Source),
{[Dep1 | SrcDepsAcc], PkgDepsAcc}
Dep = new_dep(DepsDir, Name, Vsn, Source),
{[Dep | SrcDepsAcc], PkgDepsAcc}
end, {[], []}, Deps). end, {[], []}, Deps).
new_dep(DepsDir, Name, Vsn, Source) ->
Dir = ec_cnv:to_list(get_deps_dir(DepsDir, Name)),
{ok, Dep} = case rebar_app_info:discover(Dir) of
{ok, App} ->
{ok, App};
not_found ->
rebar_app_info:new(Name, Vsn, Dir)
end,
rebar_app_info:source(Dep, Source).
-spec parse_goal(binary(), binary()) -> pkg_dep(). -spec parse_goal(binary(), binary()) -> pkg_dep().
parse_goal(Name, Constraint) -> parse_goal(Name, Constraint) ->
case re:run(Constraint, "([^\\d]*)(\\d.*)", [{capture, [1,2], binary}]) of case re:run(Constraint, "([^\\d]*)(\\d.*)", [{capture, [1,2], binary}]) of
@ -300,9 +295,7 @@ info(Description) ->
"~n" "~n"
"Valid rebar.config options:~n" "Valid rebar.config options:~n"
" ~p~n" " ~p~n"
" ~p~n"
"Valid command line options:~n"
" deps_dir=\"deps\" (override default or rebar.config deps_dir)~n",
" ~p~n",
[ [
Description, Description,
{deps_dir, "deps"}, {deps_dir, "deps"},

불러오는 중...
취소
저장