Allow Atom to be installed on OS X

This commit is contained in:
Antonio Scandurra 2016-08-03 15:50:27 +02:00
parent 518c02e329
commit af9fd41723
2 changed files with 26 additions and 0 deletions

View File

@ -12,6 +12,7 @@ const copyAssets = require('./lib/copy-assets')
const dumpSymbols = require('./lib/dump-symbols')
const generateMetadata = require('./lib/generate-metadata')
const generateModuleCache = require('./lib/generate-module-cache')
const installApplication = require('./lib/install-application')
const packageApplication = require('./lib/package-application')
const prebuildLessCache = require('./lib/prebuild-less-cache')
const transpileBabelPaths = require('./lib/transpile-babel-paths')
@ -41,4 +42,10 @@ dumpSymbols()
} else {
console.log('Skipping code-signing. Specify the --code-sign option to perform code-signing...')
}
if (argv.install) {
installApplication(packagedAppPath)
} else {
console.log('Skipping installation. Specify the --install option to install Atom...')
}
})

View File

@ -0,0 +1,19 @@
'use strict'
const fs = require('fs-extra')
const path = require('path')
module.exports = function (packagedAppPath) {
if (process.platform === 'darwin') {
const packagedAppPathFileName = path.basename(packagedAppPath)
const installationDirPath = path.join(path.sep, 'Applications', packagedAppPathFileName)
if (fs.existsSync(installationDirPath)) {
console.log(`Removing previously installed ${packagedAppPathFileName} at ${installationDirPath}...`)
fs.removeSync(installationDirPath)
}
console.log(`Installing ${packagedAppPath} at ${installationDirPath}...`)
fs.copySync(packagedAppPath, installationDirPath)
} else {
throw new Error("Not implemented yet.")
}
}