mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-12-26 08:03:17 +03:00
e53004c70c
This is a temporary workaround while a dedupe PR is in process Refs #5489
60 lines
2.0 KiB
JavaScript
Executable File
60 lines
2.0 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
var cp = require('./utils/child-process-wrapper.js');
|
|
var fs = require('fs');
|
|
var path = require('path');
|
|
|
|
process.chdir(path.dirname(__dirname));
|
|
|
|
var homeDir = process.platform == 'win32' ? process.env.USERPROFILE : process.env.HOME;
|
|
|
|
function loadEnvironmentVariables(filePath) {
|
|
try {
|
|
var lines = fs.readFileSync(filePath, 'utf8').trim().split('\n');
|
|
for (i in lines) {
|
|
var parts = lines[i].split('=');
|
|
var key = parts[0].trim();
|
|
var value = parts[1].trim().substr(1, parts[1].length - 2);
|
|
process.env[key] = value;
|
|
}
|
|
} catch(error) {
|
|
console.error("Failed to load environment variables: " + filePath, error.code);
|
|
}
|
|
}
|
|
|
|
function readEnvironmentVariables() {
|
|
if (process.platform === 'win32')
|
|
loadEnvironmentVariables(path.resolve('/jenkins/config/atomcredentials'));
|
|
else if (process.platform === 'darwin') {
|
|
loadEnvironmentVariables('/var/lib/jenkins/config/atomcredentials');
|
|
loadEnvironmentVariables('/var/lib/jenkins/config/xcodekeychain');
|
|
}
|
|
}
|
|
|
|
function removeNodeModules() {
|
|
try {
|
|
require('fs-plus').removeSync(path.resolve(__dirname, '..', 'node_modules'));
|
|
} catch (error) {
|
|
console.error(error.message);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
readEnvironmentVariables();
|
|
removeNodeModules();
|
|
cp.safeExec.bind(global, 'npm install npm', {cwd: path.resolve(__dirname, '..', 'build')}, function() {
|
|
cp.safeExec.bind(global, 'node script/bootstrap', function(error) {
|
|
if (error)
|
|
process.exit(1);
|
|
require('fs-plus').removeSync.bind(global, path.join(homeDir, '.atom'))
|
|
var async = require('async');
|
|
var gruntPath = path.join('build', 'node_modules', '.bin', 'grunt') + (process.platform === 'win32' ? '.cmd' : '');
|
|
var tasks = [
|
|
cp.safeExec.bind(global, 'git clean -dff'),
|
|
cp.safeExec.bind(global, gruntPath + ' ci --gruntfile build/Gruntfile.coffee --stack --no-color'),
|
|
]
|
|
async.series(tasks, function(error) {
|
|
process.exit(error ? 1 : 0);
|
|
});
|
|
})();
|
|
})();
|