Merge pull request #1309 from shama/cleanscript

Add clean script
This commit is contained in:
Kevin Sawicki
2013-12-16 17:59:22 -08:00
2 changed files with 39 additions and 0 deletions

34
script/clean Executable file
View File

@@ -0,0 +1,34 @@
#!/usr/bin/env node
var cp = require('./utils/child-process-wrapper.js');
var path = require('path');
var os = require('os');
var removeCommand = process.platform === 'win32' ? 'del /F /Q /S ' : 'rm -rf ';
var productName = require('../package.json').productName;
process.chdir(path.dirname(__dirname));
var home = process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME'];
var tmpdir = process.platform === 'win32' ? os.tmpdir() : '/tmp';
// Windows: Use START as a way to ignore error if Atom.exe isnt running
var killatom = process.platform === 'win32' ? 'START taskkill /F /IM ' + productName + '.exe' : 'pkill -9 ' + productName + ' || true';
var commands = [
killatom,
[__dirname, '..', 'node_modules'],
[__dirname, '..', 'atom-shell'],
[home, '.atom', '.node-gyp'],
[home, '.atom', 'storage'],
[tmpdir, 'atom-build'],
[tmpdir, 'atom-cached-atom-shells'],
[tmpdir, 'atom-compile-cache'],
];
var run = function() {
var next = commands.shift();
if (!next)
process.exit(0);
if (Array.isArray(next))
next = removeCommand + path.resolve.apply(path.resolve, next);
cp.safeExec(next, run);
};
run();

5
script/clean.cmd Normal file
View File

@@ -0,0 +1,5 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\clean" %*
) ELSE (
node "%~dp0\clean" %*
)