flm01/server/api/webmachine/deps/mochiweb/scripts/new_mochiweb.erl

28 lines
549 B
Erlang
Raw Normal View History

2010-02-25 17:45:11 +00:00
#!/usr/bin/env escript
%% -*- mode: erlang -*-
-export([main/1]).
%% External API
main([Name]) ->
main([Name, "."]);
main([Name, Dest]) ->
ensure(),
DestDir = filename:absname(Dest),
ok = mochiweb_skel:skelcopy(DestDir, Name);
main(_) ->
usage().
%% Internal API
ensure() ->
code:add_patha(filename:join(filename:dirname(escript:script_name()),
"../ebin")).
usage() ->
io:format("usage: ~s name [destdir]~n",
[filename:basename(escript:script_name())]),
halt(1).