diff options
author | Steven Barth <steven@midlink.org> | 2008-07-23 14:04:26 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-07-23 14:04:26 +0000 |
commit | dba6854d65a9ff859e1a7782f048cecfdd2513ca (patch) | |
tree | fb1a93890588131811dc8b987413e2cf3e548eb6 /contrib/luadoc/lua | |
parent | ce5f619c4fb2d3089c28726d37122351f4141e50 (diff) |
Ported luadoc to use luaposix instead of lfs
Diffstat (limited to 'contrib/luadoc/lua')
-rw-r--r-- | contrib/luadoc/lua/luadoc/doclet/formatter.lua | 2 | ||||
-rw-r--r-- | contrib/luadoc/lua/luadoc/doclet/html.lua | 10 | ||||
-rw-r--r-- | contrib/luadoc/lua/luadoc/taglet/standard.lua | 16 | ||||
-rw-r--r-- | contrib/luadoc/lua/luadoc/util.lua | 6 |
4 files changed, 17 insertions, 17 deletions
diff --git a/contrib/luadoc/lua/luadoc/doclet/formatter.lua b/contrib/luadoc/lua/luadoc/doclet/formatter.lua index af070d54b..2d725389c 100644 --- a/contrib/luadoc/lua/luadoc/doclet/formatter.lua +++ b/contrib/luadoc/lua/luadoc/doclet/formatter.lua @@ -41,7 +41,7 @@ function start (doc) luadoc.logger:info(string.format("generating file `%s'", filename)) -- TODO: confirm file overwrite - local f = lfs.open(filename, "w") + local f = posix.open(filename, "w") assert(f, string.format("could not open `%s' for writing", filename)) for _, block in ipairs(file_doc.doc) do diff --git a/contrib/luadoc/lua/luadoc/doclet/html.lua b/contrib/luadoc/lua/luadoc/doclet/html.lua index b736a9ddf..9a38c87b5 100644 --- a/contrib/luadoc/lua/luadoc/doclet/html.lua +++ b/contrib/luadoc/lua/luadoc/doclet/html.lua @@ -14,7 +14,7 @@ local assert, getfenv, ipairs, loadstring, pairs, setfenv, tostring, tonumber, type = assert, getfenv, ipairs, loadstring, pairs, setfenv, tostring, tonumber, type local io = require"io" -local lfs = require "lfs" +local posix = require "posix" local lp = require "luadoc.lp" local luadoc = require"luadoc" local package = package @@ -220,7 +220,7 @@ function start (doc) if (#doc.files > 0 or #doc.modules > 0) and (not options.noindexpage) then local filename = options.output_dir.."index.html" logger:info(string.format("generating file `%s'", filename)) - local f = lfs.open(filename, "w") + local f = posix.open(filename, "w") assert(f, string.format("could not open `%s' for writing", filename)) io.output(f) include("index.lp", { doc = doc }) @@ -235,7 +235,7 @@ function start (doc) local filename = out_module(modulename) logger:info(string.format("generating file `%s'", filename)) - local f = lfs.open(filename, "w") + local f = posix.open(filename, "w") assert(f, string.format("could not open `%s' for writing", filename)) io.output(f) include("module.lp", { doc = doc, module_doc = module_doc }) @@ -251,7 +251,7 @@ function start (doc) local filename = out_file(file_doc.name) logger:info(string.format("generating file `%s'", filename)) - local f = lfs.open(filename, "w") + local f = posix.open(filename, "w") assert(f, string.format("could not open `%s' for writing", filename)) io.output(f) include("file.lp", { doc = doc, file_doc = file_doc} ) @@ -260,7 +260,7 @@ function start (doc) end -- copy extra files - local f = lfs.open(options.output_dir.."luadoc.css", "w") + local f = posix.open(options.output_dir.."luadoc.css", "w") io.output(f) include("luadoc.css") f:close() diff --git a/contrib/luadoc/lua/luadoc/taglet/standard.lua b/contrib/luadoc/lua/luadoc/taglet/standard.lua index 144755e6b..334f4a24d 100644 --- a/contrib/luadoc/lua/luadoc/taglet/standard.lua +++ b/contrib/luadoc/lua/luadoc/taglet/standard.lua @@ -4,7 +4,7 @@ local assert, pairs, tostring, type = assert, pairs, tostring, type local io = require "io" -local lfs = require "lfs" +local posix = require "posix" local luadoc = require "luadoc" local util = require "luadoc.util" local tags = require "luadoc.taglet.standard.tags" @@ -433,14 +433,14 @@ end -- @return table with documentation function directory (path, doc) - for f in lfs.dir(path) do + for f in posix.files(path) do local fullpath = path .. "/" .. f - local attr = lfs.attributes(fullpath) + local attr = posix.stat(fullpath) assert(attr, string.format("error stating file `%s'", fullpath)) - if attr.mode == "file" then + if attr.type == "regular" then doc = file(fullpath, doc) - elseif attr.mode == "directory" and f ~= "." and f ~= ".." then + elseif attr.type == "directory" and f ~= "." and f ~= ".." then doc = directory(fullpath, doc) end end @@ -475,12 +475,12 @@ function start (files, doc) assert(doc.modules, "undefined `modules' field") table.foreachi(files, function (_, path) - local attr = lfs.attributes(path) + local attr = posix.stat(path) assert(attr, string.format("error stating path `%s'", path)) - if attr.mode == "file" then + if attr.type == "regular" then doc = file(path, doc) - elseif attr.mode == "directory" then + elseif attr.type == "directory" then doc = directory(path, doc) end end) diff --git a/contrib/luadoc/lua/luadoc/util.lua b/contrib/luadoc/lua/luadoc/util.lua index e51e2e5df..3a48e7418 100644 --- a/contrib/luadoc/lua/luadoc/util.lua +++ b/contrib/luadoc/lua/luadoc/util.lua @@ -3,7 +3,7 @@ -- @release $Id: util.lua,v 1.16 2008/02/17 06:42:51 jasonsantos Exp $ ------------------------------------------------------------------------------- -local lfs = require "lfs" +local posix = require "posix" local type, table, string, io, assert, tostring, setmetatable, pcall = type, table, string, io, assert, tostring, setmetatable, pcall ------------------------------------------------------------------------------- @@ -144,14 +144,14 @@ end -- @param mode mode of opening -- @return file handle -function lfs.open (filename, mode) +function posix.open (filename, mode) local f = io.open(filename, mode) if f == nil then filename = string.gsub(filename, "\\", "/") local dir = "" for d in string.gfind(filename, ".-/") do dir = dir .. d - lfs.mkdir(dir) + posix.mkdir(dir) end f = io.open(filename, mode) end |