Don't use third party dependency in default_app.
This commit is contained in:
parent
1beeda170c
commit
c81a4bcafc
3 changed files with 18 additions and 10 deletions
|
@ -2,7 +2,6 @@ var app = require('app');
|
||||||
var dialog = require('dialog');
|
var dialog = require('dialog');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var optimist = require('optimist');
|
|
||||||
|
|
||||||
// Quit when all windows are closed and no other one is listening to this.
|
// Quit when all windows are closed and no other one is listening to this.
|
||||||
app.on('window-all-closed', function() {
|
app.on('window-all-closed', function() {
|
||||||
|
@ -10,14 +9,27 @@ app.on('window-all-closed', function() {
|
||||||
app.quit();
|
app.quit();
|
||||||
});
|
});
|
||||||
|
|
||||||
var argv = optimist(process.argv.slice(1)).boolean('ci').argv;
|
// Parse command line options.
|
||||||
|
var argv = process.argv.slice(1);
|
||||||
|
var option = { file: null, version: null };
|
||||||
|
for (var i in argv) {
|
||||||
|
if (argv[i] == '--version' || argv[i] == '-v') {
|
||||||
|
option.version = true;
|
||||||
|
break;
|
||||||
|
} else if (argv[i][0] == '-') {
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
option.file = argv[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Start the specified app if there is one specified in command line, otherwise
|
// Start the specified app if there is one specified in command line, otherwise
|
||||||
// start the default app.
|
// start the default app.
|
||||||
if (argv._.length > 0) {
|
if (option.file) {
|
||||||
try {
|
try {
|
||||||
// Override app name and version.
|
// Override app name and version.
|
||||||
var packagePath = path.resolve(argv._[0]);
|
var packagePath = path.resolve(option.file);
|
||||||
var packageJsonPath = path.join(packagePath, 'package.json');
|
var packageJsonPath = path.join(packagePath, 'package.json');
|
||||||
if (fs.existsSync(packageJsonPath)) {
|
if (fs.existsSync(packageJsonPath)) {
|
||||||
var packageJson = JSON.parse(fs.readFileSync(packageJsonPath));
|
var packageJson = JSON.parse(fs.readFileSync(packageJsonPath));
|
||||||
|
@ -48,7 +60,7 @@ if (argv._.length > 0) {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (argv.version) {
|
} else if (option.version) {
|
||||||
console.log('v' + process.versions['atom-shell']);
|
console.log('v' + process.versions['atom-shell']);
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -2,8 +2,5 @@
|
||||||
"name": "atom-shell-default-app",
|
"name": "atom-shell-default-app",
|
||||||
"productName": "Atom Shell Default App",
|
"productName": "Atom Shell Default App",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"main": "main.js",
|
"main": "main.js"
|
||||||
"dependencies": {
|
|
||||||
"optimist": "*"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ def main():
|
||||||
enable_verbose_execute()
|
enable_verbose_execute()
|
||||||
update_submodules()
|
update_submodules()
|
||||||
update_node_modules('.')
|
update_node_modules('.')
|
||||||
update_atom_modules('atom/browser/default_app')
|
|
||||||
update_atom_modules('spec')
|
update_atom_modules('spec')
|
||||||
bootstrap_brightray(args.url)
|
bootstrap_brightray(args.url)
|
||||||
if sys.platform == 'cygwin':
|
if sys.platform == 'cygwin':
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue