Просмотр исходного кода

Now, lots of ugly words, should it work.

Andreas Stenius 9 лет назад
Родитель
Сommit
2e314f8d8b
2 измененных файлов с 22 добавлено и 10 удалено
  1. 3 5
      Makefile
  2. 19 5
      rebar.config.script

+ 3 - 5
Makefile

@@ -18,8 +18,9 @@ update-deps:
 	@$(REBAR) update-deps
 
 .PHONY: tests
-tests: src/erlydtl_parser.erl | deps/eunit_formatters
-	@$(REBAR) -C rebar-tests.config eunit
+tests: export EXTRA_CONFIG=rebar-tests.config
+tests: src/erlydtl_parser.erl
+	@$(REBAR) eunit
 
 check: tests dialyze
 
@@ -70,6 +71,3 @@ shell:
 # this file must exist for rebar eunit to work
 # but is only built when running rebar compile
 src/erlydtl_parser.erl: compile
-
-deps/eunit_formatters:
-	@$(REBAR) -C rebar-tests.config get-deps compile

+ 19 - 5
rebar.config.script

@@ -9,6 +9,20 @@ Patch = fun (Key, Value, Config) ->
                 end
         end,
 
+Merge = fun (NewCfg) ->
+                PatchCfg =
+                    case os:getenv("EXTRA_CONFIG") of
+                        false ->
+                            NewCfg;
+                        File ->
+                            {ok, ExtraCfg} = file:consult(File),
+                            NewCfg ++ ExtraCfg
+                    end,
+                lists:foldl(
+                  fun ({K, V}, C) -> Patch(K, V, C) end,
+                  CONFIG, PatchCfg)
+        end,
+
 application:load(syntax_tools),
 case application:get_key(syntax_tools, vsn) of
     {ok, Vsn} when "1.7" > Vsn ->
@@ -22,10 +36,10 @@ case application:get_key(syntax_tools, vsn) of
              {"(linux|darwin|solaris)", eunit, "make -C \"$REBAR_DEPS_DIR/merl\" test"},
              {"(freebsd|netbsd|openbsd)", eunit, "gmake -C \"$REBAR_DEPS_DIR/merl\" test"},
              {"win32", eunit, "make -C \"%REBAR_DEPS_DIR%/merl\" test"}],
-        lists:foldl(fun ({K, V}, C) -> Patch(K, V, C) end, CONFIG,
-                    [{deps, Deps},
-                     {pre_hooks, PreHooks},
-                     {erl_opts, [{d, 'MERL_DEP'}]}]);
+
+        Merge([{deps, Deps},
+               {pre_hooks, PreHooks},
+               {erl_opts, [{d, 'MERL_DEP'}]}]);
     _ ->
-        CONFIG
+        Merge([])
 end.