joeblog
joeblog

Reputation: 1225

How do I get Erlang's edoc:application(myproject). to work?

I'm battling to figure out Erlang's automatic documentation system. The documentation advises the use of its edoc module's application function documented at http://erlang.org/doc/man/edoc.html#application-2

I've set up my subdirectories as so:

myproject/
├── src/
├── ebin/
│   └── myproject.app
├── include/
├── priv/
└── doc/
    └── overview.edoc

I can't figure out from the documentation if the application referred to in the edoc function application has anything to do with the myproject.app file, but it doesn't seem to.

The error I get is:

1> edoc:application(myproject).
edoc: cannot find application directory for 'myproject'.
** exception exit: error
     in function  edoc:application/2 (edoc.erl, line 165)

Any suggestions of what the magic incantation to get this to work gratefully received.

Upvotes: 1

Views: 218

Answers (2)

joeblog
joeblog

Reputation: 1225

To get the documentation put in the ./myproject/doc subdirectory, rather than the default ./myproject/ebin/doc directory, I used the following run from the project root directory ./myproject/

edoc:application(myproject, ".", [{dir, "doc"}, {subpackages, true}]).

Something that tripped me up was files referred to in overview.edoc need to be relative to the ./doc subdirectory (which makes sense in retrospect) as in:

@headerfile "../include/global.hrl"

Upvotes: 2

Pascal
Pascal

Reputation: 14042

application(Application::atom(), Options::proplist()) -> ok

Run EDoc on an application in its default app-directory.

I don't know where it is :o)

You can use the command edoc:application(myproject,".",[]). at myproject level, it will create a doc directory in the src one.

application(Application::atom(), Dir::filename(), Options::proplist()) -> ok

Run EDoc on an application located in the specified directory.

I prefer to create and manage application with rebar3 which does a lot of work for you with a simple configuration file.

Upvotes: 3

Related Questions