Permalink
Browse files

Initial primitive support for dependencies (requires and deps_dir pro…

…perties)
  • Loading branch information...
1 parent 4ce346c commit eeca2f40f32bae4b356b82a06d5b2d1ae94a94e7 @yrashk yrashk committed Feb 1, 2011
Showing with 21 additions and 0 deletions.
  1. +8 −0 include/agner_spec.hrl
  2. +13 −0 src/agner_main.erl
View
@@ -12,6 +12,10 @@
{git, url(), git_ref()} |
{hg, url(), hg_rev()}.
+-type agner_spec_requirement() :: {agner_package_name(), agner_package_version_string()} |
+ agner_package_name().
+
+
-type agner_spec_property_name() :: {name, string()}.
-type agner_spec_property_description() :: {description, string()}.
-type agner_spec_property_keywords() :: {keywords, list(string())}.
@@ -28,6 +32,8 @@
-type agner_spec_property_applications() :: {applications, list(atom())}.
-type agner_spec_property_caveats() :: {caveats, string()}.
-type agner_spec_property_url() :: {url, agner_download_url()}.
+-type agner_spec_property_deps_dir() :: {deps_dir, directory()}.
+-type agner_spec_property_requires() :: {requires, list(agner_spec_requirement())}.
-type agner_spec_code_paths() :: {code_paths, [directory()]}.
@@ -46,6 +52,8 @@
agner_spec_property_applications() |
agner_spec_property_caveats() |
agner_spec_property_url() |
+ agner_spec_property_deps_dir() |
+ agner_spec_property_requires() |
agner_spec_code_paths().
-type agner_spec() :: list(agner_spec_property()).
View
@@ -350,6 +350,19 @@ handle_command(fetch, Opts) ->
io:format("~p~n",[agner:fetch(Spec,Version,
Directory)]),
+ Requires = proplists:get_value(requires, Spec, []),
+ DepsDir = filename:join(Directory, proplists:get_value(deps_dir, Spec, "deps")),
+ lists:foreach(fun ({ReqName, ReqVersion}) ->
+ io:format("[Building dependency: ~s -v ~s]~n", [ReqName, ReqVersion]),
+ handle_command(fetch, [{package, ReqName},{version, ReqVersion},
+ {directory, filename:join(DepsDir,ReqName)}|
+ proplists:delete(spec,Opts)]);
+ (ReqName) when is_list(ReqName) ->
+ io:format("[Building dependency: ~s]~n", [ReqName]),
+ handle_command(fetch, [{package, ReqName},{version, "@master"},
+ {directory, filename:join(DepsDir,ReqName)}|
+ proplists:delete(spec, Opts)])
+ end, Requires),
case proplists:get_value(caveats, Spec) of
undefined ->

0 comments on commit eeca2f4

Please sign in to comment.