Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
createPackage () {
this.options.logger(`Creating package at ${this.stagingDir}`)
const cmd = path.join(this.vendorDir, 'nuget', 'nuget.exe')
const args = [
'pack',
this.specPath,
'-BasePath',
this.stagingAppDir,
'-OutputDirectory',
path.join(this.stagingDir, 'nuget'),
'-NoDefaultExcludes'
]
return common.wrapError('creating package with NuGet', async () => spawn(cmd, args, this.options.logger))
}
async syncRemoteReleases () {
if (!this.options.remoteReleases) {
return
}
this.options.logger(`Syncing package at ${this.stagingDir}`)
const cmd = path.join(this.vendorDir, 'squirrel', 'SyncReleases.exe')
const args = [
'--url',
this.options.remoteReleases,
'--releaseDir',
this.squirrelDir
]
return common.wrapError('syncing remote releases', async () => {
await fs.ensureDir(this.squirrelDir, '0755')
return spawn(cmd, args, this.options.logger)
})
}
}
copySquirrelUpdater () {
const updateSrc = path.join(this.vendorDir, 'squirrel', 'Squirrel.exe')
const updateDest = path.join(this.stagingAppDir, 'Update.exe')
return common.wrapError('copying Squirrel updater', async () => fs.copy(updateSrc, updateDest))
}
findPackage () {
const packagePattern = path.join(this.stagingDir, 'nuget', '*.nupkg')
this.options.logger(`Finding package with pattern ${packagePattern}`)
return common.wrapError('finding package with pattern', async () => {
const files = await glob(packagePattern)
return files[0]
})
}
copyScripts () {
const scriptNames = ['preinst', 'postinst', 'prerm', 'postrm']
return common.wrapError('creating script files', async () =>
Promise.all(_.map(this.options.scripts, async (item, key) => {
if (scriptNames.includes(key)) {
const scriptFile = path.join(this.stagingDir, 'DEBIAN', key)
this.options.logger(`Creating script file at ${scriptFile}`)
await fs.copy(item, scriptFile)
return fs.chmod(scriptFile, 0o755)
} else {
throw new Error(`Wrong executable script name: ${key}`)
}
}))
)
}
createControl () {
const src = path.resolve(__dirname, '../resources/control.ejs')
const dest = path.join(this.stagingDir, 'DEBIAN', 'control')
this.options.logger(`Creating control file at ${dest}`)
return common.wrapError('creating control file', async () => this.createTemplatedFile(src, dest))
}
createSpec () {
const src = path.resolve(__dirname, '../resources/spec.ejs')
this.options.logger(`Creating spec file at ${this.specPath}`)
return common.wrapError('creating spec file', async () => this.createTemplatedFile(src, this.specPath))
}
async createSpec () {
const src = path.resolve(__dirname, '../resources/spec.ejs')
this.options.logger(`Creating spec file at ${this.specPath}`)
return common.wrapError('creating spec file', async () => this.createTemplatedFile(src, this.specPath))
}