Rename tools to utils.
This commit is contained in:
parent
de91c416d7
commit
126efef9fe
@ -4,7 +4,7 @@ import shutil
|
||||
import zipfile
|
||||
import json
|
||||
|
||||
from lib import tools_lib as Tools
|
||||
from lib import utils as Utils
|
||||
|
||||
def GetVersion (rootDir):
|
||||
packageJson = None
|
||||
@ -57,7 +57,7 @@ def CreateWebsite (config, rootDir, websiteDir, version, testBuild):
|
||||
]
|
||||
for htmlFileName in htmlFileNames:
|
||||
htmlFilePath = os.path.join (websiteDir, htmlFileName)
|
||||
replacer = Tools.TokenReplacer (htmlFilePath, False)
|
||||
replacer = Utils.TokenReplacer (htmlFilePath, False)
|
||||
replacer.ReplaceTokenFileLinks ('<!-- website libs start -->', '<!-- website libs end -->', websiteLibFiles, version)
|
||||
replacer.ReplaceTokenFileLinks ('<!-- website start -->', '<!-- website end -->', websiteFiles, version)
|
||||
replacer.ReplaceTokenFileLinks ('<!-- plugins start -->', '<!-- plugins end -->', pluginFiles, version)
|
||||
@ -73,15 +73,15 @@ def CreateWebsite (config, rootDir, websiteDir, version, testBuild):
|
||||
replacer.ReplaceTokenContent ('<!-- embed init start -->', '<!-- embed init end -->', embedInitScriptContent)
|
||||
metaFile = os.path.join (rootDir, 'plugins', 'website_meta_data.txt')
|
||||
if os.path.exists (metaFile):
|
||||
metaContent = Tools.GetFileContent (metaFile)
|
||||
metaContent = Utils.GetFileContent (metaFile)
|
||||
replacer.ReplaceTokenContent ('<!-- meta start -->', '<!-- meta end -->', metaContent)
|
||||
analyticsFile = os.path.join (rootDir, 'plugins', 'website_analytics_data.txt')
|
||||
if os.path.exists (analyticsFile) and not testBuild:
|
||||
analyticsContent = Tools.GetFileContent (analyticsFile)
|
||||
analyticsContent = Utils.GetFileContent (analyticsFile)
|
||||
replacer.ReplaceTokenContent ('<!-- analytics start -->', '<!-- analytics end -->', analyticsContent)
|
||||
introFile = os.path.join (rootDir, 'plugins', 'website_intro_data.txt')
|
||||
if os.path.exists (introFile):
|
||||
introContent = Tools.GetFileContent (introFile)
|
||||
introContent = Utils.GetFileContent (introFile)
|
||||
replacer.ReplaceTokenContent ('<!-- intro start -->', '<!-- intro end -->', introContent)
|
||||
replacer.WriteToFile (htmlFilePath)
|
||||
|
||||
@ -116,7 +116,7 @@ def Main (argv):
|
||||
if len (argv) >= 2 and argv[1] == 'test':
|
||||
testBuild = True
|
||||
buildDir = os.path.join (rootDir, 'build', 'test')
|
||||
Tools.PrintInfo ('Creating test build.')
|
||||
Utils.PrintInfo ('Creating test build.')
|
||||
|
||||
websiteDir = os.path.join (buildDir, 'website')
|
||||
packageDir = os.path.join (buildDir, 'package')
|
||||
@ -128,13 +128,13 @@ def Main (argv):
|
||||
config = json.load (configJson)
|
||||
|
||||
version = GetVersion (rootDir)
|
||||
Tools.PrintInfo ('Create build directory')
|
||||
Utils.PrintInfo ('Create build directory')
|
||||
CreateWebsite (config, rootDir, websiteDir, version, testBuild)
|
||||
|
||||
Tools.PrintInfo ('Create package.')
|
||||
Utils.PrintInfo ('Create package.')
|
||||
packageResult = CreatePackage (rootDir, websiteDir, packageDir)
|
||||
if not packageResult:
|
||||
Tools.PrintError ('Create package failed.')
|
||||
Utils.PrintError ('Create package failed.')
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
@ -8,7 +8,7 @@ import platform
|
||||
import html
|
||||
import re
|
||||
|
||||
from lib import tools_lib as Tools
|
||||
from lib import utils as Utils
|
||||
|
||||
class HtmlGenerator:
|
||||
def __init__ (self, eol):
|
||||
@ -362,7 +362,7 @@ def BuildHierarchy (doclets):
|
||||
|
||||
def CreateFromTemplate (templateHtmlPath, resultHtmlPath, navigation, title, content, eol):
|
||||
shutil.copy (templateHtmlPath, resultHtmlPath)
|
||||
Tools.ReplaceStringsInFile (resultHtmlPath, [
|
||||
Utils.ReplaceStringsInFile (resultHtmlPath, [
|
||||
('$$$TITLE$$$', title),
|
||||
('$$$NAVIGATION$$$', navigation.GenerateHtml (eol)),
|
||||
('$$$MAIN$$$', content)
|
||||
@ -399,7 +399,7 @@ def BuildNavigation (pageGroups, hierarchy):
|
||||
|
||||
def BuildDocumentationFiles (navigation, pageGroups, hierarchy, sourceDir, resultDir):
|
||||
templateHtmlPath = os.path.join (sourceDir, 'Template.html')
|
||||
eol = Tools.GetEOLCharFromFile (templateHtmlPath)
|
||||
eol = Utils.GetEOLCharFromFile (templateHtmlPath)
|
||||
|
||||
for pageGroup in pageGroups:
|
||||
for page in pageGroup['pages']:
|
||||
@ -407,7 +407,7 @@ def BuildDocumentationFiles (navigation, pageGroups, hierarchy, sourceDir, resul
|
||||
continue
|
||||
sourceHtmlPath = os.path.join (sourceDir, page['url'])
|
||||
pageHtmlPath = os.path.join (resultDir, page['url'])
|
||||
pageContent = '<div class="page">' + eol + Tools.GetFileContent (sourceHtmlPath) + eol + '</div>'
|
||||
pageContent = '<div class="page">' + eol + Utils.GetFileContent (sourceHtmlPath) + eol + '</div>'
|
||||
CreateFromTemplate (templateHtmlPath, pageHtmlPath, navigation, page['name'], pageContent, eol)
|
||||
|
||||
for classDoc in hierarchy['classes']:
|
||||
|
||||
@ -2,7 +2,7 @@ import os
|
||||
import sys
|
||||
import shutil
|
||||
|
||||
from lib import tools_lib as Tools
|
||||
from lib import utils as Utils
|
||||
|
||||
def Main (argv):
|
||||
toolsDir = os.path.dirname (os.path.abspath (__file__))
|
||||
@ -21,12 +21,12 @@ def Main (argv):
|
||||
if not os.path.exists (iconFontDir):
|
||||
os.makedirs (iconFontDir)
|
||||
|
||||
Tools.RunCommand ('oslllo-svg-fixer', [
|
||||
Utils.RunCommand ('oslllo-svg-fixer', [
|
||||
'-s', iconsDir,
|
||||
'-d', fixedIconsDir
|
||||
])
|
||||
Tools.RunCommand ('svgo', [fixedIconsDir])
|
||||
Tools.RunCommand ('fantasticon', [
|
||||
Utils.RunCommand ('svgo', [fixedIconsDir])
|
||||
Utils.RunCommand ('fantasticon', [
|
||||
fixedIconsDir,
|
||||
'-o', iconFontDir,
|
||||
'-t', 'woff',
|
||||
@ -40,7 +40,7 @@ def Main (argv):
|
||||
|
||||
websiteIconsCssPath = os.path.join (websiteCssDir, 'icons.css')
|
||||
shutil.copy (os.path.join (iconFontDir, 'O3DVIcons.css'), websiteIconsCssPath)
|
||||
Tools.ReplaceStringInFile (websiteIconsCssPath, './O3DVIcons.woff', 'O3DVIcons/O3DVIcons.woff')
|
||||
Utils.ReplaceStringInFile (websiteIconsCssPath, './O3DVIcons.woff', 'O3DVIcons/O3DVIcons.woff')
|
||||
shutil.copy (os.path.join (iconFontDir, 'O3DVIcons.woff'), websiteIconFontDir)
|
||||
|
||||
infoCssDir = os.path.join (rootDir, 'website', 'info', 'css')
|
||||
|
||||
@ -2,7 +2,7 @@ import os
|
||||
import sys
|
||||
import re
|
||||
|
||||
from lib import tools_lib as Tools
|
||||
from lib import utils as Utils
|
||||
|
||||
def Main (argv):
|
||||
toolsDir = os.path.dirname (os.path.abspath (__file__))
|
||||
@ -22,13 +22,13 @@ def Main (argv):
|
||||
})
|
||||
|
||||
mainFilePath = os.path.join (sourceFolder, 'main.js')
|
||||
eolChar = Tools.GetEOLCharFromFile (mainFilePath)
|
||||
eolChar = Utils.GetEOLCharFromFile (mainFilePath)
|
||||
|
||||
exportedSymbols = []
|
||||
mainFileContent = ''
|
||||
for engineFile in engineFiles:
|
||||
engineFilePath = os.path.join (sourceFolder, engineFile['dirName'], engineFile['fileName'])
|
||||
content = Tools.GetFileContent (engineFilePath)
|
||||
content = Utils.GetFileContent (engineFilePath)
|
||||
matches = re.findall ('export class ([a-zA-Z0-9]+)', content)
|
||||
matches.extend (re.findall ('export function ([a-zA-Z0-9]+)', content))
|
||||
matches.extend (re.findall ('export const ([a-zA-Z0-9]+)', content))
|
||||
@ -49,7 +49,7 @@ def Main (argv):
|
||||
mainFileContent += eolChar
|
||||
mainFileContent += '};' + eolChar
|
||||
|
||||
Tools.WriteContentToFile (mainFilePath, mainFileContent)
|
||||
Utils.WriteContentToFile (mainFilePath, mainFileContent)
|
||||
return 0
|
||||
|
||||
sys.exit (Main (sys.argv))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user