UNPKG

@appshuttle.io/turing

Version:
61 lines (43 loc) 1.67 kB
const fs = require('fs') const crypto = require('crypto') const MainActivityViewTemplates = require('../TemplateContent/MainActivityView-Template') class MainActivityViewMotor { 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.mainActViewContent = '' this.templates = new MainActivityViewTemplates() this.generateMainActivityView = function () { this.generateStructure() const context = this return new Promise((resolve, reject) => { try { fs.writeFileSync(context.path, context.mainActViewContent) resolve() } catch (error) { reject(error) } }) } /* GENERATION METHODS */ this.generateStructure = function () { this.mainActViewContent = this.templates.getMainActivityViewStructure() this.mainActViewContent = this.mainActViewContent.replace(this.templates.CONTENT_HOLDER, this.getContent()) } /* CONTENT PRODUCERS */ this.getContent = function () { return '' } } } module.exports = MainActivityViewMotor