var app = require('app');
var dialog = require('dialog');
+var fs = require('fs');
var path = require('path');
var optimist = require('optimist');
// start the default app.
if (argv._.length > 0) {
try {
- require(path.resolve(argv._[0]));
+ // Override app name and version.
+ var packagePath = path.resolve(argv._[0]);
+ var packageJsonPath = path.join(packagePath, 'package.json');
+ if (fs.existsSync(packageJsonPath)) {
+ var packageJson = JSON.parse(fs.readFileSync(packageJsonPath));
+ if (packageJson.version)
+ app.setVersion(packageJson.version);
+ if (packageJson.productName)
+ app.setName(packageJson.productName);
+ else if (packageJson.name)
+ app.setName(packageJson.name);
+ }
+
+ // Run the app.
+ require(packagePath);
} catch(e) {
if (e.code == 'MODULE_NOT_FOUND') {
app.focus();
describe 'app.getName()', ->
it 'returns the name field of package.json', ->
- assert.equal app.getName(), 'Atom Shell Default App'
+ assert.equal app.getName(), 'Atom Shell Test App'
describe 'app.setName(name)', ->
it 'overrides the name', ->
- assert.equal app.getName(), 'Atom Shell Default App'
+ assert.equal app.getName(), 'Atom Shell Test App'
app.setName 'test-name'
assert.equal app.getName(), 'test-name'
app.setName 'Atom Shell Default App'
{
"name": "atom-shell-specs",
+ "productName": "Atom Shell Test App",
"main": "static/main.js",
"version": "0.1.0",