@appshuttle.io/turing
Version:
Code Generation Library used in Shuttle
46 lines (34 loc) • 1.46 kB
JavaScript
const fs = require('fs')
const TRStringManagement = require('../../../../Mixins/StringManagement/StringManagement')
const InfoPlistTemplates = require('../TemplateContent/InfoPlist-Templates')
class InfoPlistMotor {
constructor(path, project, screenPointers, screens) {
if (!path) throw new Error('No pbxproj path is specified')
if (!project) throw new Error('No project is specified')
if (!screenPointers) throw new Error('No screen pointers were specified')
if (!screens) throw new Error('No screens were specified')
this.path = path
this.project = project
this.screenPointers = screenPointers
this.screens = screens
this.infoPlistContent = ''
this.templates = new InfoPlistTemplates()
this.StringManagement = new TRStringManagement()
this.generateInfoPlist = function () {
this.generateInfoPlistStructure()
const context = this
return new Promise((resolve, reject) => {
try {
fs.writeFileSync(context.path, context.infoPlistContent)
resolve()
} catch (error) {
reject(error)
}
})
}
this.generateInfoPlistStructure = function() {
this.infoPlistContent = this.templates.getInfoPlistStructure()
}
}
}
module.exports = InfoPlistMotor