2016-08-02 15:04:45 +03:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
|
|
|
'use strict'
|
|
|
|
|
2017-07-19 03:38:04 +03:00
|
|
|
const childProcess = require('child_process')
|
2017-05-09 16:25:53 +03:00
|
|
|
const CONFIG = require('./config')
|
2016-08-02 15:35:58 +03:00
|
|
|
const cleanDependencies = require('./lib/clean-dependencies')
|
2016-08-05 01:36:21 +03:00
|
|
|
const deleteMsbuildFromPath = require('./lib/delete-msbuild-from-path')
|
2016-08-02 15:35:58 +03:00
|
|
|
const dependenciesFingerprint = require('./lib/dependencies-fingerprint')
|
2016-08-02 15:04:45 +03:00
|
|
|
const installApm = require('./lib/install-apm')
|
2017-05-09 16:21:26 +03:00
|
|
|
const runApmInstall = require('./lib/run-apm-install')
|
2016-08-02 15:04:45 +03:00
|
|
|
const installScriptDependencies = require('./lib/install-script-dependencies')
|
|
|
|
const verifyMachineRequirements = require('./lib/verify-machine-requirements')
|
|
|
|
|
2016-08-29 11:37:46 +03:00
|
|
|
process.on('unhandledRejection', function (e) {
|
|
|
|
console.error(e.stack || e)
|
|
|
|
process.exit(1)
|
|
|
|
})
|
|
|
|
|
2016-08-02 15:04:45 +03:00
|
|
|
verifyMachineRequirements()
|
2016-08-02 15:35:58 +03:00
|
|
|
|
|
|
|
if (dependenciesFingerprint.isOutdated()) {
|
|
|
|
cleanDependencies()
|
|
|
|
}
|
|
|
|
|
2016-08-05 01:36:21 +03:00
|
|
|
if (process.platform === 'win32') deleteMsbuildFromPath()
|
|
|
|
|
2016-08-02 15:04:45 +03:00
|
|
|
installScriptDependencies()
|
|
|
|
installApm()
|
2017-07-19 03:38:04 +03:00
|
|
|
childProcess.execFileSync(
|
|
|
|
CONFIG.getApmBinPath(),
|
|
|
|
['--version'],
|
|
|
|
{stdio: 'inherit'}
|
|
|
|
)
|
2017-05-09 16:21:26 +03:00
|
|
|
runApmInstall(CONFIG.repositoryRootPath)
|
2016-08-02 15:35:58 +03:00
|
|
|
|
|
|
|
dependenciesFingerprint.write()
|