Skip to content

Commit

Permalink
Let "dub --build=ddox" start a local HTTP server instead of generatin…
Browse files Browse the repository at this point in the history
…g .html files.
  • Loading branch information
s-ludwig committed Nov 2, 2013
1 parent 299a4d0 commit f3a818e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion source/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ int main(string[] args)

logDiagnostic("Generating using %s", generator);
dub.generateProject(generator, gensettings);
if( build_type == "ddox" ) dub.runDdox();
if (build_type == "ddox") dub.runDdox(gensettings.run);
break;
case "describe":
if (args.length >= 2) package_name = args[1];
Expand Down
13 changes: 7 additions & 6 deletions source/dub/dub.d
Original file line number Diff line number Diff line change
Expand Up @@ -400,15 +400,16 @@ class Dub {
string[] filterargs = m_project.mainPackage.info.ddoxFilterArgs.dup;
if (filterargs.empty) filterargs = ["--min-protection=Protected", "--only-documented"];
commands ~= dub_path~"ddox filter "~filterargs.join(" ")~" docs.json";
commands ~= dub_path~"ddox generate-html --navigation-type=ModuleTree docs.json docs";
version(Windows) commands ~= "xcopy /S /D "~dub_path~"public\\* docs\\";
else commands ~= "cp -r \""~dub_path~"public/*\" docs/";
if (!run) {
commands ~= dub_path~"ddox generate-html --navigation-type=ModuleTree docs.json docs";
version(Windows) commands ~= "xcopy /S /D "~dub_path~"public\\* docs\\";
else commands ~= "cp -r \""~dub_path~"public/*\" docs/";
}
runCommands(commands);

if (run) {
auto url = Url("file", m_rootPath~"docs/index.html");
logDiagnostic("Openening generated docs at %s", url.toString());
browse(url.toString());
spawnProcess([dub_path~"ddox", "serve-html", "--navigation-type=ModuleTree", "docs.json", "--web-file-dir="~dub_path~"public"]);
browse("http://127.0.0.1:8080/");
}
}

Expand Down

0 comments on commit f3a818e

Please sign in to comment.