Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option for destination directory? #41

Closed
oubiwann opened this issue Jan 18, 2016 · 9 comments
Closed

Option for destination directory? #41

oubiwann opened this issue Jan 18, 2016 · 9 comments
Milestone

Comments

@oubiwann
Copy link
Contributor

Is there a way to override the default destination directory?

If not, may I suggest updating the plugin to support something like rebar3 lfe lodox --output=some/path?

Here's my use case for several LFE projects:

  • I will have a Slate site set up in ./docs
  • versioned Slate output will be saved to ./docs/build/user-guide
  • I will be generating API docs using lodox, ideally writing the docs to ./docs/build/api
  • there will then be a ./docs/build/index.html file which links to both, and
  • the ./docs/build dir will get deployed to the gh-pages branch on Github for the given project

Once I can override the lodox output directory, I'll be able to start using for these projects :-)

@oubiwann
Copy link
Contributor Author

Well, I said --output flag, but I'd be just as happy with a settable rebar.config or lfe.config option.

@yurrriq
Copy link
Member

yurrriq commented Jan 18, 2016

This will be included in the configuration revamp. For now it's called output-path.

Thanks for these questions, suggestions and bug reports. Keep them coming!

@yurrriq
Copy link
Member

yurrriq commented Jan 18, 2016

Should lodox output be versioned too? For now it's not and output-path is the home for the latest output.

I guess with that you can change output-path as you change your vsn, but that seems lame and overly manual.

We do have access to vsn at runtime so it'd be possible to write to, e.g. output-path/{{vsn}} dynamically.

Thoughts?

@oubiwann
Copy link
Contributor Author

I was kinda of bummed when Slate didn't offer versioned docs. But after thinking about it, I realized (duh) that a bit of a manual process, as you say, helped me get around that (which I codified in make targets).

I've now gotten used to that for Slate, so I'd just assumed I'd do that with lodox. If you are interested in adding support for versioned docs, I'd probably be +1 on that :-) Though I'd almost certainly want flags for that capability so that my Makefile could generate both a "current" and a "versioned" set of docs (or you could provide a symlink by default?).

Also, I'd probably stay away from module-level vsn, since that is sometimes used independently of the project-level version. Hrm ... though it would make a good configurable option (off by default), e.g., use-vsn? for those that wanted to. There's an lutil function that will get the version number from the .app.src or .app file for a project (I think it also works for OTP releases, but I'd want to double-check that). That might be a good way to go.

Thinking about this more ... a workflow might go like this

  1. version my project
  2. generate docs to a configured dir (e.g., docs/build/api) with a symlink created (docs/build/api/current) sibling to the versioned docs directory just created (docs/build/api/0.1.0)
  3. add versioned docs and symlink to repo
  4. bump version number of project
  5. regen docs (docs/build/api/0.2.0)
  6. add new dir to repo, update changes to symlink

That probably outlines my approach. If that's what was done, then I'll I'd ever need to do is simply run rebar3 lfe lodox without having to add any flags. I'd only need the flags if lodox didn't generate a symlink...

You'd probably want to provide a meta-refresh index page in BUILD_DIR that redirects to current. In which case, configuration would need to have a base-url option, I think ... You'd probably also want to generate a list of links for previous versions of the docs, so they could be added to a drop-down in the header or something. Maybe as simple as finding all top-level dirs in BUILD_DIR?

If all this is too much for right now, I'm totally cool adapting the Makefile approach I use for Slate. In which case I'd just use lodox configuration and system tools to get what I needed for versioned docs. It would be a shame for a nice-to-have pulling you away from the urgent feature dev you've identified!

@yurrriq
Copy link
Member

yurrriq commented Jan 19, 2016

Ah, by vsn I meant in the application resource file. Lodox gets that via rebar3. It could be cool to parse module vsn too.

These are all great ideas. I guess I'll want to break them up into smaller tasks and try to chip away at them.

@yurrriq
Copy link
Member

yurrriq commented Jan 19, 2016

Re: module-level vsn. Right now I'm parsing out the behaviour and it could be cool, if nothing else, to show the module vsn there. The behaviour rendering could use some work too..

@yurrriq
Copy link
Member

yurrriq commented Jan 21, 2016

You can do this now in develop:

{lodox,
 [{apps,
   [{yourproject,
     [{'source-uri',
       "https://github.com/username/yourproject/blob/{version}/{filepath}#L{line}"},
      {'output-path', "relative/path/to/output"}]}]}]}.

where output-path is relative to app-dir or cwd.

@yurrriq yurrriq added this to the 1.0.0 milestone Jan 21, 2016
yurrriq added a commit that referenced this issue Jan 25, 2016
Also bump to 0.12.2 and update documentation.

This commit should resolve #43 and also address #41.
Still needed is some better documentation about how to configure Lodox.

Pandex: https://github.com/FilterKaapi/pandex
yurrriq added a commit that referenced this issue Jan 25, 2016
@yurrriq yurrriq closed this as completed Jan 25, 2016
@oubiwann
Copy link
Contributor Author

I tried doing this in a new project: and ran across a few speedbumps.

First, I misinterpreted the example above -- I didn't realize that the lodox under apps was for a given project, and not for lodox itself. As such, for future users who come across this ticket, I could have them look at this instead:

{lodox,
 [{apps,
   [{yourproject,
     [{'source-uri',
       "https://github.com/username/yourproject/blob/{version}/{filepath}#L{line}"},
      {'output-path', "relative/path/to/output"}]}]}]}.

Second, I didn't realize that if the parent directory of the source dir didn't exist, lodox would silently fail to create the docs :-( (no docs, but no error message either). I've added a dependency make target to my project to ensure that the docs parent dir exists before running rebar3 lfe lodox.

With those two out of the way, though, this feature is looking great!

Thanks!

@yurrriq
Copy link
Member

yurrriq commented Feb 29, 2016

Thanks for clarifying the example. I've updated mine above too to avoid confusion. I've been dogfooding Lodox, so that example makes sense to me and likely no one else.

Actually, I'm not sure I understand what you mean when you say "if the parent directory of the source dir didn't exist." Wait, after reading about your make hacks I think I get it. Lodox currently only tries to create the last element of the path, e.g. output in the example, but does nothing to relative, relative/path or relative/path/to.

I'm using file:make_dir/1 and the docstring mentions:

Missing parent directories are not created.

I'll figure out a solution and close #53.

Thanks again for your insightful feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants