summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2016-04-16 18:26:54 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2016-05-12 11:59:09 +0100
commita2e8f950151ff7dcab1ea0c8c693a60fa163dee1 (patch)
treeaf011617bf50486e77da0d2bf46f712bb5be5155
parentd199a270003c916a0f868afd89990e556d19bf9a (diff)
downloadefl-a2e8f950151ff7dcab1ea0c8c693a60fa163dee1.tar.gz
docgen: simplify build.sh (move some of it into the main script)
-rwxr-xr-xbuild.sh9
-rw-r--r--gendoc.lua20
2 files changed, 7 insertions, 22 deletions
diff --git a/build.sh b/build.sh
index b9c889a90c..ac25748092 100755
--- a/build.sh
+++ b/build.sh
@@ -1,6 +1,5 @@
#!/bin/sh
-
-ROOTNS="efl"
-GENPATH="dokuwiki/data/pages"
-rm -rf "$GENPATH/$ROOTNS"
-elua gendoc.lua -r "$GENPATH" -n "$ROOTNS" "$@"
+if [ -z "$EFL_DOC_ROOT" ]; then
+ export EFL_DOC_ROOT="dokuwiki/data/pages"
+fi
+elua gendoc.lua -r "$EFL_DOC_ROOT" "$@"
diff --git a/gendoc.lua b/gendoc.lua
index e839234f81..800d6f31cd 100644
--- a/gendoc.lua
+++ b/gendoc.lua
@@ -28,22 +28,7 @@ local make_page = function(path)
end
local mkdir_r = function(dirn)
- local fullp = dirn and path_join(doc_root, dirn) or doc_root
- local prev
- for x in fullp:gmatch("[^" .. path_sep .. "]+") do
- local p
- if prev then
- p = path_join(prev, x)
- else
- p = x
- end
- prev = p
- if cutil.file_exists(p) then
- assert(cutil.file_is_dir(p))
- else
- assert(cutil.file_mkdir(p))
- end
- end
+ assert(cutil.file_mkpath(dirn and path_join(doc_root, dirn) or doc_root))
end
local mkdir_p = function(path)
@@ -1249,7 +1234,7 @@ getopt.parse {
verbose = true
end
root_nspace = opts["n"] or "efl"
- if not opts["r"] then
+ if not opts["r"] or opts["r"] == "" then
error("no documentation root supplied")
end
doc_root = path_join(opts["r"], nspace_to_path(root_nspace))
@@ -1268,6 +1253,7 @@ getopt.parse {
if not eolian.all_eo_files_parse() then
error("failed parsing eo files")
end
+ cutil.file_rmrf(path_join(doc_root))
mkdir_r(nil)
build_ref()
build_classes()