Skip to content

Commit

Permalink
--testing: version and date does not change. Bump to 1.4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
stevedonovan committed Jun 20, 2016
1 parent f09d617 commit 3d31f32
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 17 deletions.
23 changes: 14 additions & 9 deletions ldoc.lua
Expand Up @@ -27,17 +27,18 @@ local tablex = require 'pl.tablex'

-- Penlight compatibility
utils.unpack = utils.unpack or unpack or table.unpack

local append = table.insert

local lapp = require 'pl.lapp'

local version = '1.4.4'

-- so we can find our private modules
app.require_here()

--- @usage
local usage = [[
ldoc, a documentation generator for Lua, vs 1.4.3
ldoc, a documentation generator for Lua, vs ]]..version..[[
-d,--dir (default doc) output directory
-o,--output (default 'index') output name
-v,--verbose verbose
Expand Down Expand Up @@ -66,6 +67,8 @@ ldoc, a documentation generator for Lua, vs 1.4.3
--filter (default none) filter output as Lua data (e.g pl.pretty.dump)
--tags (default none) show all references to given tags, comma-separated
--fatalwarnings non-zero exit status on any warning
--testing reproducible build; no date or version on output
<file> (string) source file or directory containing source
`ldoc .` reads options from an `config.ld` file in same directory;
Expand Down Expand Up @@ -101,8 +104,6 @@ function ProjectMap:_init ()
self.fieldname = 'type'
end



local lua, cc = lang.lua, lang.cc

local file_types = {
Expand All @@ -120,7 +121,7 @@ local file_types = {
------- ldoc external API ------------

-- the ldoc table represents the API available in `config.ld`.
local ldoc = { charset = 'UTF-8' }
local ldoc = { charset = 'UTF-8', version = version }

local known_types, kind_names = {}

Expand Down Expand Up @@ -238,7 +239,7 @@ local ldoc_contents = {
'unqualified', 'custom_display_name_handler', 'kind_names', 'custom_references',
'dont_escape_underscore','global_lookup','prettify_files','convert_opt', 'user_keywords',
'postprocess_html',
'custom_css',
'custom_css','version'
}
ldoc_contents = tablex.makeset(ldoc_contents)

Expand Down Expand Up @@ -806,14 +807,18 @@ ldoc.title = ldoc.title or args.title
ldoc.project = ldoc.project or args.project
ldoc.package = args.package:match '%a+' and args.package or nil

if os.getenv("SOURCE_DATE_EPOCH") == nil then
local source_date_epoch = os.getenv("SOURCE_DATE_EPOCH")
if args.testing then
ldoc.updatetime = "2015-01-01 12:00:00"
ldoc.version = 'TESTING'
elseif source_date_epoch == nil then
if args.date == 'system' then
ldoc.updatetime = os.date("%Y-%m-%d %H:%M:%S")
else
ldoc.updatetime = args.date
end
else
ldoc.updatetime = os.date("!%Y-%m-%d %H:%M:%S",os.getenv("SOURCE_DATE_EPOCH"))
ldoc.updatetime = os.date("!%Y-%m-%d %H:%M:%S",source_date_epoch)
end

local html = require 'ldoc.html'
Expand Down
2 changes: 1 addition & 1 deletion ldoc/html/ldoc_ltp.lua
Expand Up @@ -306,7 +306,7 @@ return [==[
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc $(ldoc.version)</a></i>
<i style="float:right;">Last updated $(ldoc.updatetime) </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
Expand Down
22 changes: 17 additions & 5 deletions run-tests.lua
@@ -1,6 +1,18 @@
function run_test(dir)
os.execute('cd '..dir..' && ldoc --testing . && diff -r doc cdocs')
local run
if not arg[1] then
run = function (dir)
local cmd = 'cd '..dir..' && ldoc --testing . && diff -r doc cdocs'
print(cmd)
os.execute(cmd)
end
elseif arg[1] == 'update' then
run = function (dir)
local cmd = 'cd '..dir..' && ldoc --dir cdocs --testing .'
print(cmd)
os.execute(cmd)
end
end

for _,d in ipairs{'tests','tests/example','tests/md-test'} do
run(d)
end
run_test('tests')
run_test('tests/example')
run_test('tests/md-test')
2 changes: 1 addition & 1 deletion tests/classes.lua
Expand Up @@ -10,7 +10,7 @@ local _M = {}
_M.Bonzo = class()

--- a method.
-- function one
-- function one; reference to @{one.md.classes|documentation}
function Bonzo:one()

end
Expand Down
2 changes: 1 addition & 1 deletion tests/config.ld
Expand Up @@ -2,4 +2,4 @@ format='markdown'
project = 'Basic Example'
file = {'types.lua','classes.lua'}
use_markdown_titles=true
topics = {'one 1.md','two.md'}
topics = {'one.md','two.md'}

0 comments on commit 3d31f32

Please sign in to comment.