def __buildCodeFiles(self): templateFiles = FileUtils().getFileMatches(self.TemplateDir, 'module_*.tpl') for tpl in templateFiles: FileUtils.copyFile( self.TemplateDir + tpl, self.ModuleDir + tpl.replace('module', self.ModuleName).replace('.tpl', '.py'))
def __buildManifest(self): sep = PlatformProperty.FileSep sourceFile = self.TemplateDir+'config'+sep+'project_base_manifest.tpl' targetFile = self.ProjectBaseDir+'app'+sep+'conf'+sep+self.ProjectName.lower()+'_manifest.ini' FileUtils.copyFile(sourceFile, targetFile) configManager = ConfigManager(targetFile) configManager.setValue('APP', 'AppName', self.ProjectName) configManager.setValue('APP', 'Version', {'MAJOR': '0.1', 'MINOR': '.0'}) configManager.setValue('PYTHON', 'RuntimeVersions', '['+PlatformProperty.getPythonVersion()+']') configManager.save()
def __buildManifest(self): fsep = PlatformProperty.FileSep manifestFilename = self.ProjectBaseDir+'app'+fsep+'conf'+fsep+self.ModuleName.lower()+'_manifest.ini' FileUtils.copyFile(self.TemplateDir+'modBaseManifest.tpl', manifestFilename) manFile = open(manifestFilename, 'r') fileContents = manFile.read() manFile.close() fileContents = fileContents.replace('{{MODNAME}}', self.ModuleName.lower()) manFile = open(manifestFilename, 'w') manFile.write(fileContents) manFile.close()
def __createDatabaseScripts(self): s = PlatformProperty.FileSep objectScripts = [ 'dblinks.sql', 'synonyms.sql', 'sequences.sql', 'types.sql', 'queues.sql', 'tables.sql', 'triggers.sql', 'views.sql', 'indexes.sql', 'constraints_ck.sql', 'constraints_pk.sql', 'constraints_uk.sql', 'constraints_fk.sql' ] dataScripts = ['seed.sql'] for obj in objectScripts: FileUtils.touchFile(self.ProjectBaseDir + 'app' + s + 'database' + s + 'ddl' + s + 'objects' + s + obj) for data in dataScripts: FileUtils.touchFile(self.ProjectBaseDir + 'app' + s + 'database' + s + 'data' + s + data) FileUtils.copyFile( self.TemplateDir + 'config' + s + 'database-userInfo.tpl', self.ProjectBaseDir + 'app' + s + 'database' + s + 'user' + s + 'user_info.ini') FileUtils.copyFile( self.TemplateDir + 'config' + s + 'database-userPrivs.tpl', self.ProjectBaseDir + 'app' + s + 'database' + s + 'user' + s + 'user_privs.ini') # REPLACE TOKENS IN INFO FILE iniFile = open( self.ProjectBaseDir + 'app' + s + 'database' + s + 'user' + s + 'user_info.ini', 'r') fileContents = iniFile.read() iniFile.close() fileContents = fileContents.replace('{{APPNAME}}', self.AppName.upper()) iniFile = open( self.ProjectBaseDir + 'app' + s + 'database' + s + 'user' + s + 'user_info.ini', 'w') iniFile.write(fileContents) iniFile.close() # REPLACE TOKENS IN PRIV FILE iniFile = open( self.ProjectBaseDir + 'app' + s + 'database' + s + 'user' + s + 'user_privs.ini', 'r') fileContents = iniFile.read() iniFile.close() fileContents = fileContents.replace('{{APPNAME}}', self.AppName.upper()) iniFile = open( self.ProjectBaseDir + 'app' + s + 'database' + s + 'user' + s + 'user_privs.ini', 'w') iniFile.write(fileContents) iniFile.close()
def __buildCodeFiles(self): templateFiles = FileUtils().getFileMatches(self.TemplateDir, 'module_*.tpl') for tpl in templateFiles: codeFilename = self.ModuleDir+tpl.replace('module', self.ModuleName).replace('.tpl', '.py') FileUtils.copyFile(self.TemplateDir+tpl, codeFilename) codeFile = open(codeFilename, 'r') fileContents = codeFile.read() codeFile.close() fileContents = fileContents.replace('{{MODNAME_OBJECT}}', NameConverter.getObjectName(self.ModuleName)) fileContents = fileContents.replace('{{MODNAME}}', NameConverter.getObjectName(self.ModuleName)) codeFile = open(codeFilename, 'w') codeFile.write(fileContents) codeFile.close()
def __copyModDefTemplate(self): s = PlatformProperty.FileSep FileUtils.copyFile(self.TemplateDir+'config'+s+'modelDef.tpl', self.ProjectBaseDir+'build'+s+'def-files'+s+'model.def') FileUtils.copyFile(self.TemplateDir+'config'+s+'model-def.README', self.ProjectBaseDir+'build'+s+'def-files'+s+'model-def.README')
def __buildAppBinFile(self): sep = PlatformProperty.FileSep appName = self.ProjectName.lower() tplFile = 'app.sh' FileUtils.copyFile(self.TemplateDir+'launchers'+sep+tplFile, self.ProjectBaseDir+'bin'+sep+appName)
def __buildConfFile(self): sep = PlatformProperty.FileSep appDir = self.ProjectBaseDir+'app'+sep FileUtils.copyFile(self.TemplateDir+'config'+sep+'app.ini', appDir+'conf'+sep+self.AppName+'.ini')
def __buildConfFile(self): FileUtils.copyFile(self.TemplateDir+'module.ini', self.ConfDir+self.ModuleName+'.ini')
def __createBuildFiles(self): s = PlatformProperty.FileSep FileUtils.copyFile(self.TemplateDir+'code'+s+'build.py', self.ProjectBaseDir+'build'+s+'build.py')