forked from uwiger/edown
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ulf Wiger
committed
Oct 3, 2011
1 parent
4d41ead
commit b5f1675
Showing
8 changed files
with
207 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{application,edown}. | ||
{packages,[]}. | ||
{modules,[edown_doclet,edown_layout,edown_lib,edown_xmerl]}. | ||
{modules,[edown_doclet,edown_layout,edown_lib,edown_make,edown_xmerl]}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,9 +31,9 @@ __Authors:__ Ulf Wiger ([`[email protected]`](mailto:ulf.wiger@erla | |
|
||
|
||
|
||
<pre>run(Command :: <a href="#type-doclet_gen">doclet_gen()</a> | <a href="#type-doclet_toc">doclet_toc()</a>, | ||
Ctxt :: <a href="#type-edoc_context">edoc_context()</a>) -> | ||
ok</pre> | ||
<pre>run(Command::<a href="#type-doclet_gen">doclet_gen()</a> | <a href="#type-doclet_toc">doclet_toc()</a>, Ctxt::<a href="#type-edoc_context">edoc_context()</a>) -> ok</pre> | ||
<br></br> | ||
|
||
|
||
|
||
|
||
|
@@ -43,8 +43,8 @@ Main doclet entry point. | |
|
||
|
||
|
||
Also see [`//edoc/edoc:layout/2`](/Users/uwiger/ETC/git/edoc/doc/edoc.md#layout-2) for layout-related options, and | ||
[`//edoc/edoc:get_doc/2`](/Users/uwiger/ETC/git/edoc/doc/edoc.md#get_doc-2) for options related to reading source | ||
Also see [`//edoc/edoc:layout/2`](http://www.erlang.org/doc/man/edoc.html#layout-2) for layout-related options, and | ||
[`//edoc/edoc:get_doc/2`](http://www.erlang.org/doc/man/edoc.html#get_doc-2) for options related to reading source | ||
files. | ||
|
||
Options: | ||
|
@@ -77,7 +77,7 @@ functions will also be included. The default value is <code>false</code>. | |
|
||
|
||
|
||
<dt><code>{overview, <a href="/Users/uwiger/ETC/git/edoc/doc/edoc.md#type-filename">//edoc/edoc:filename()</a>}</code> | ||
<dt><code>{overview, <a href="http://www.erlang.org/doc/man/edoc.html#type-filename">//edoc/edoc:filename()</a>}</code> | ||
</dt> | ||
|
||
|
||
|
@@ -117,7 +117,7 @@ specified, no stylesheet reference will be generated. | |
|
||
|
||
|
||
<dt><code>{stylesheet_file, <a href="/Users/uwiger/ETC/git/edoc/doc/edoc.md#type-filename">//edoc/edoc:filename()</a>}</code> | ||
<dt><code>{stylesheet_file, <a href="http://www.erlang.org/doc/man/edoc.html#type-filename">//edoc/edoc:filename()</a>}</code> | ||
</dt> | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
|
||
|
||
#Module edown_make# | ||
* [Function Index](#index) | ||
* [Function Details](#functions) | ||
|
||
|
||
|
||
|
||
<a name="index"></a> | ||
|
||
##Function Index## | ||
|
||
|
||
<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#from_script-1">from_script/1</a></td><td>Reads ConfigFile and calls <a href="edoc.md#application-3"><code>edoc:application/3</code></a></td></tr><tr><td valign="top"><a href="#main-1">main/1</a></td><td>Escript entry point for building edown (or edoc) documentation.</td></tr></table> | ||
|
||
|
||
<a name="functions"></a> | ||
|
||
##Function Details## | ||
|
||
<a name="from_script-1"></a> | ||
|
||
###from_script/1## | ||
|
||
|
||
|
||
|
||
<pre>from_script(Config::ConfigFile) -> ok | {error, Reason}</pre> | ||
<br></br> | ||
|
||
|
||
|
||
|
||
|
||
|
||
Reads ConfigFile and calls [`edoc:application/3`](edoc.md#application-3) | ||
|
||
|
||
|
||
The ConfigFile will be read using [`file:script/1`](file.md#script-1), and should return | ||
`{App, Dir, Options}`, as required by [`edoc:application/3`](edoc.md#application-3). | ||
|
||
This function does not manage dependencies. It is simply a wrapper around | ||
[`edoc:application/3`](edoc.md#application-3).<a name="main-1"></a> | ||
|
||
###main/1## | ||
|
||
|
||
|
||
|
||
<pre>main(Args::[Config]) -> <a href="#type-no_return">no_return()</a></pre> | ||
<br></br> | ||
|
||
|
||
|
||
|
||
|
||
|
||
Escript entry point for building edown (or edoc) documentation | ||
|
||
|
||
|
||
Usage: edown_make -config ConfigFile [-pa P] [-pz P] | ||
|
||
|
||
|
||
Calls [from_script(ConfigFile)](#from_script-1) and then terminates, | ||
with a normal or non-normal exit code, depending on the outcome. | ||
|
||
|
||
|
||
Make sure `$EDOWN/edown_make` is runnable, and in the command path, and | ||
that the edown BEAM files are in the Erlang path (e.g. using $ERL_LIBS). | ||
The `edown_make` escript also accepts `-pa P` and/or `-pz P` flags as a | ||
means of locating the edown byte code. | ||
|
||
|
||
|
||
Note, however, that the function `edoc_make:main/1` only expects the | ||
config file as an input argument, corresponding to | ||
|
||
|
||
|
||
`escript edoc_make.beam ConfigFile` | ||
|
||
(The reason for this is that if the beam file can be passed directly to | ||
the escript command, setting the path should also be doable that way). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env escript | ||
%% -*- erlang -*- | ||
|
||
%% @spec main() -> no_return() | ||
%% @doc Escript for building edown (or edoc) documentation | ||
%% | ||
%% Usage: edown_make ConfigFile | ||
%% | ||
%% The ConfigFile will be read using {@link file:script/1}, and should return | ||
%% `{App, Dir, Options}', as required by {@link edoc:application/3}. | ||
%% | ||
%% This function does not manage dependencies. It is simply a wrapper around | ||
%% {@link edoc:application/3}. | ||
%% @end | ||
%% | ||
main(Args) -> | ||
Config = parse_args(Args), | ||
edown_make:main([Config]). | ||
|
||
parse_args(Args) -> | ||
parse_args(Args, "edown.config"). | ||
|
||
parse_args([], Config) -> | ||
Config; | ||
parse_args(["-config", Config|Args], _) -> | ||
parse_args(Args, Config); | ||
parse_args(["-pa", P|Args], Config) -> | ||
code:add_patha(P), | ||
parse_args(Args, Config); | ||
parse_args(["-pz", P|Args], Config) -> | ||
code:add_pathz(P), | ||
parse_args(Args, Config); | ||
parse_args(Args, _) -> | ||
io:fwrite("Unknown options: ~p~n", [Args]), | ||
usage(), | ||
halt(1). | ||
|
||
usage() -> | ||
Full = escript:script_name(), | ||
Base = filename:basename(Full), | ||
io:fwrite("~s~nUsage: ~s -config Config [-pa Path] [-pz Path]~n", | ||
[Full, Base]). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
%% -*- erlang -*- | ||
-module(edown_make). | ||
|
||
-export([from_script/1]). | ||
-export([main/1]). | ||
|
||
%% @spec main(Args::[Config]) -> no_return() | ||
%% @doc Escript entry point for building edown (or edoc) documentation | ||
%% | ||
%% Usage: edown_make -config ConfigFile [-pa P] [-pz P] | ||
%% | ||
%% Calls {@link from_script/1. from_script(ConfigFile)} and then terminates, | ||
%% with a normal or non-normal exit code, depending on the outcome. | ||
%% | ||
%% Make sure `$EDOWN/edown_make' is runnable, and in the command path, and | ||
%% that the edown BEAM files are in the Erlang path (e.g. using $ERL_LIBS). | ||
%% The `edown_make' escript also accepts `-pa P' and/or `-pz P' flags as a | ||
%% means of locating the edown byte code. | ||
%% | ||
%% Note, however, that the function `edoc_make:main/1' only expects the | ||
%% config file as an input argument, corresponding to | ||
%% | ||
%% `escript edoc_make.beam ConfigFile' | ||
%% | ||
%% (The reason for this is that if the beam file can be passed directly to | ||
%% the escript command, setting the path should also be doable that way). | ||
%% | ||
%% @end | ||
%% | ||
main([Config]) -> | ||
case from_script(Config) of | ||
ok -> | ||
halt(); | ||
{error, _} -> | ||
halt(1) | ||
end. | ||
|
||
%% @spec from_script(ConfigFile) -> ok | {error, Reason} | ||
%% @doc Reads ConfigFile and calls {@link edoc:application/3} | ||
%% | ||
%% The ConfigFile will be read using {@link file:script/1}, and should return | ||
%% `{App, Dir, Options}', as required by {@link edoc:application/3}. | ||
%% | ||
%% This function does not manage dependencies. It is simply a wrapper around | ||
%% {@link edoc:application/3}. | ||
%% @end | ||
%% | ||
from_script(Config) -> | ||
case file:script(Config) of | ||
{ok, {App, Dir, Options}} -> | ||
R = edoc:application(App, Dir, Options), | ||
case R of | ||
ok -> | ||
ok; | ||
Err -> | ||
io:fwrite("~p~n", [Err]), | ||
Err | ||
end; | ||
Other -> | ||
io:fwrite("Error reading config ~s:~n" | ||
"~p~n", [Config, Other]), | ||
{error, {config, Other}} | ||
end. | ||
|