Permalink
Browse files

config.script wrapper to redirect edoc README

  • Loading branch information...
1 parent 058f611 commit a9adcc363d2e116be73bf30ff05cc772619250e7 @uwiger committed May 4, 2012
Showing with 23 additions and 0 deletions.
  1. +23 −0 rebar.config.script
View
@@ -0,0 +1,23 @@
+%% -*- erlang -*-
+case os:getenv("TGT") of
+ false ->
+ CONFIG;
+ [] ->
+ CONFIG;
+ Tgt ->
+ io:fwrite("Tgt = ~p~n", [Tgt]),
+ {_, Opts} = lists:keyfind(edoc_opts, 1, CONFIG),
+ {_, {F,URL}} = lists:keyfind(top_level_readme, 1, Opts),
+ Name = lists:last(string:tokens(URL, "/")),
+ io:fwrite("Name = ~s~n", [Name]),
+ NewURL = re:replace(URL, "[^/]+/" ++ Name, Tgt ++ "/" ++ Name,
+ [{return, list}]),
+ CONFIG1 =
+ lists:keyreplace(
+ edoc_opts, 1,
+ CONFIG,
+ {edoc_opts, lists:keyreplace(top_level_readme, 1, Opts,
+ {top_level_readme, {F, NewURL}})}),
+ io:fwrite("CONFIG1 = ~p~n", [CONFIG1]),
+ CONFIG1
+end.

0 comments on commit a9adcc3

Please sign in to comment.