diff options
author | Adam Kocoloski <adam@cloudant.com> | 2010-10-26 00:06:54 -0400 |
---|---|---|
committer | Adam Kocoloski <adam@cloudant.com> | 2010-10-26 00:09:23 -0400 |
commit | f35cbdbc2b4de02e8400aceb9e10f71c515be16d (patch) | |
tree | 79bb6bef65053fb4bb9f4401d0748bfa299ee7be /apps/mochiweb/src/mochiweb_skel.erl | |
parent | ebac05f686b56791511cb9b599dfb5a742dcfc96 (diff) |
use get-deps for mochiweb
We need to host our own mochiweb which tags the versions used by
CouchDB. This commit also contains a new rebar with a patch to fix
git tag dependencies (submitted upstream).
Diffstat (limited to 'apps/mochiweb/src/mochiweb_skel.erl')
-rw-r--r-- | apps/mochiweb/src/mochiweb_skel.erl | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/apps/mochiweb/src/mochiweb_skel.erl b/apps/mochiweb/src/mochiweb_skel.erl deleted file mode 100644 index 36b48be5..00000000 --- a/apps/mochiweb/src/mochiweb_skel.erl +++ /dev/null @@ -1,73 +0,0 @@ --module(mochiweb_skel). --export([skelcopy/2]). - --include_lib("kernel/include/file.hrl"). - -%% External API - -skelcopy(DestDir, Name) -> - ok = ensuredir(DestDir), - LDst = case length(filename:dirname(DestDir)) of - 1 -> %% handle case when dirname returns "/" - 0; - N -> - N + 1 - end, - skelcopy(src(), DestDir, Name, LDst), - ok = file:make_symlink( - filename:join(filename:dirname(code:which(?MODULE)), ".."), - filename:join([DestDir, Name, "deps", "mochiweb-src"])). - - -%% Internal API - -src() -> - Dir = filename:dirname(code:which(?MODULE)), - filename:join(Dir, "../priv/skel"). - -skel() -> - "skel". - -skelcopy(Src, DestDir, Name, LDst) -> - Dest = re:replace(filename:basename(Src), skel(), Name, - [global, {return, list}]), - case file:read_file_info(Src) of - {ok, #file_info{type=directory, mode=Mode}} -> - Dir = DestDir ++ "/" ++ Dest, - EDst = lists:nthtail(LDst, Dir), - ok = ensuredir(Dir), - ok = file:write_file_info(Dir, #file_info{mode=Mode}), - {ok, Files} = file:list_dir(Src), - io:format("~s/~n", [EDst]), - lists:foreach(fun ("." ++ _) -> ok; - (F) -> - skelcopy(filename:join(Src, F), - Dir, - Name, - LDst) - end, - Files), - ok; - {ok, #file_info{type=regular, mode=Mode}} -> - OutFile = filename:join(DestDir, Dest), - {ok, B} = file:read_file(Src), - S = re:replace(binary_to_list(B), skel(), Name, - [{return, list}, global]), - ok = file:write_file(OutFile, list_to_binary(S)), - ok = file:write_file_info(OutFile, #file_info{mode=Mode}), - io:format(" ~s~n", [filename:basename(Src)]), - ok; - {ok, _} -> - io:format("ignored source file: ~p~n", [Src]), - ok - end. - -ensuredir(Dir) -> - case file:make_dir(Dir) of - ok -> - ok; - {error, eexist} -> - ok; - E -> - E - end. |