Skip to content

Commit d966073

Browse files
author
livecodeali
committed
[[ MergExt ]] Fix docs builder to use build mergext utility functions
1 parent cf40c42 commit d966073

File tree

1 file changed

+4
-107
lines changed

1 file changed

+4
-107
lines changed

builder/docs_builder.livecodescript

Lines changed: 4 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1913,7 +1913,9 @@ command docsBuilderGenerateDocsNew pEdition, pVersion
19131913

19141914
-- Ensure we have downloaded and extracted all the mergExt data
19151915
-- needed to build the docs for this edition
1916-
docsBuilderEnsureMergExt pEdition
1916+
local tEditionCased
1917+
put (toUpper(char 1 of pEdition) & toLower(char 2 to -1 of pEdition)) into tEditionCased
1918+
builderMergExtUnpack builderMergExtVersion(), tEditionCased
19171919

19181920
builderLog "report", "Building guide into" && builderGuideFolder(pEdition) & slash & "distributed_guide.js"
19191921
pathEnsure (builderGuideFolder(pEdition))
@@ -1927,19 +1929,6 @@ command docsBuilderGenerateDocsNew pEdition, pVersion
19271929
builderLog "report", "Built docs"
19281930
end docsBuilderGenerateDocsNew
19291931

1930-
private function escape pString, pConvertLineEndings
1931-
replace "\" with "\\" in pString
1932-
replace quote with ("\" & quote) in pString
1933-
1934-
if pConvertLineEndings is true then
1935-
replace (numToChar(13) & CR) with (CR & numToChar(13)) in pString
1936-
replace (CR & numToChar(13)) with CR in pString
1937-
end if
1938-
replace CR with "\n" in pString
1939-
replace tab with "\t" in pString
1940-
return (quote & pString & quote)
1941-
end escape
1942-
19431932
private command addToList pElement, @xArray
19441933
local tCount
19451934
put the number of elements in xArray into tCount
@@ -1996,7 +1985,7 @@ private command docsBuilderAddMergExtFolders pEdition, @xFolders
19961985
put the defaultFolder into tDefaultFolder
19971986

19981987
local tTargetFolder
1999-
put docsBuilderMergExtExtractedDocsFolder(pEdition) into tTargetFolder
1988+
put builderMergExtFolder() & "/" & "MergExt" into tTargetFolder
20001989
set the defaultFolder to tTargetFolder
20011990

20021991
repeat for each line tFolder in the folders
@@ -2008,7 +1997,6 @@ private command docsBuilderAddMergExtFolders pEdition, @xFolders
20081997
end docsBuilderAddMergExtFolders
20091998

20101999
private command docsBuilderGetAdditionalDictionaryFolders pEdition, @xFolders
2011-
docsBuilderEnsureMergExt pEdition
20122000
docsBuilderAddMergExtFolders pEdition, xFolders
20132001
end docsBuilderGetAdditionalDictionaryFolders
20142002

@@ -2278,97 +2266,6 @@ private command docsBuilderGenerateZip pEdition, pVersion
22782266
builderLog "message", merge("Generated [[tZipPath]]")
22792267
end docsBuilderGenerateZip
22802268

2281-
function docsBuilderMergExtZipPath pEdition
2282-
-- Ensure edition has upper case first letter
2283-
put toUpper(char 1 of pEdition) & char 2 to -1 of pEdition into pEdition
2284-
return "https://downloads.livecode.com/mergext/mergExt_" & pEdition & ".zip"
2285-
end docsBuilderMergExtZipPath
2286-
2287-
function docsBuilderMergExtUnzipFolder
2288-
local tUnzipDirectory
2289-
put builderWorkFolder() & slash & "mergext" into tUnzipDirectory
2290-
pathEnsure tUnzipDirectory
2291-
return tUnzipDirectory
2292-
end docsBuilderMergExtUnzipFolder
2293-
2294-
function docsBuilderMergExtUnzipPath pEdition
2295-
put toUpper(char 1 of pEdition) & char 2 to -1 of pEdition into pEdition
2296-
return docsBuilderMergExtUnzipFolder() & slash & "mergExt_" & pEdition & ".zip"
2297-
end docsBuilderMergExtUnzipPath
2298-
2299-
function docsBuilderMergExtExtractedDocsFolder pEdition
2300-
local tExtractFolder
2301-
put docsBuilderMergExtUnzipFolder() & slash & pEdition into tExtractFolder
2302-
return tExtractFolder
2303-
end docsBuilderMergExtExtractedDocsFolder
2304-
2305-
command docsBuilderEnsureMergExt pEdition
2306-
local tDownloaded
2307-
put docsBuilderMergExtUnzipPath(pEdition) into tDownloaded
2308-
2309-
if there is not a file tDownloaded then
2310-
docsBuilderDownloadMergExt pEdition
2311-
end if
2312-
2313-
local tExtracted
2314-
put docsBuilderMergExtExtractedDocsFolder(pEdition) into tExtracted
2315-
if there is not a folder tExtracted then
2316-
docsBuilderExtractMergExt pEdition
2317-
end if
2318-
end docsBuilderEnsureMergExt
2319-
2320-
command docsBuilderDownloadMergExt pEdition
2321-
local tSource, tArchive, tCommand
2322-
put docsBuilderMergExtZipPath(pEdition) into tSource
2323-
put docsBuilderMergExtUnzipPath(pEdition) into tArchive
2324-
builderLog "message", "downloading mergext from" && tSource && "to" && tArchive
2325-
2326-
-- Shell out to curl because LiveCode server has some issues with
2327-
-- making HTTPS on Linux (see bug 16940)
2328-
put merge("curl -o '[[tArchive]]' '[[tSource]]'") into tCommand
2329-
get shell(tCommand)
2330-
2331-
if the result is not empty or there is not a file tArchive then
2332-
builderLog "error", "failed to download from" && tSource
2333-
exit docsBuilderDownloadMergExt
2334-
end if
2335-
end docsBuilderDownloadMergExt
2336-
2337-
command docsBuilderExtractMergExt pEdition
2338-
local tArchive
2339-
put docsBuilderMergExtUnzipPath(pEdition) into tArchive
2340-
2341-
-- open the archive
2342-
revZipOpenArchive tArchive, "read"
2343-
if the result begins with "ziperr" then
2344-
builderLog "error", "failed to open archive" && tArchive & return & the result
2345-
exit docsBuilderExtractMergExt
2346-
end if
2347-
2348-
-- enumerate all lcdoc files
2349-
local tItems
2350-
put revZipEnumerateItems(tArchive) into tItems
2351-
filter tItems with "*.lcdoc"
2352-
2353-
local tTargetFolder, tBaseFolder
2354-
put docsBuilderMergExtExtractedDocsFolder(pEdition) into tBaseFolder
2355-
pathEnsure tBaseFolder
2356-
set the itemDelimiter to slash
2357-
2358-
-- Extract all lcdoc files to the edition-specific folder
2359-
repeat for each line tDoc in tItems
2360-
put item 1 to -2 of (tBaseFolder & slash & tDoc) into tTargetFolder
2361-
pathEnsure tTargetFolder
2362-
builderLog "message", "extracting mergext docs to" && tTargetFolder
2363-
revZipExtractItemToFile tArchive, tDoc, tBaseFolder & slash & tDoc
2364-
if the result begins with "ziperr" then
2365-
builderLog "error", "failed to extract docs to" && tTargetFolder & return & the result
2366-
exit docsBuilderExtractMergExt
2367-
end if
2368-
end repeat
2369-
end docsBuilderExtractMergExt
2370-
2371-
23722269
--- LEGACY
23732270

23742271
function revDocumentationRetrieve pType, pTag, pFolder

0 commit comments

Comments
 (0)