standardize more

This commit is contained in:
Zeke Sikelianos 2016-03-28 13:19:41 -07:00 committed by Kevin Sawicki
parent 3a55f0d1f7
commit 68510cbe49
2 changed files with 22 additions and 30 deletions

View file

@ -100,29 +100,21 @@ app.once('ready', function () {
{ {
label: 'Toggle Full Screen', label: 'Toggle Full Screen',
accelerator: (function () { accelerator: (function () {
if (process.platform === 'darwin') return (process.platform === 'darwin') ? 'Ctrl+Command+F' : 'F11'
return 'Ctrl+Command+F'
else
return 'F11'
})(), })(),
click: function (item, focusedWindow) { click: function (item, focusedWindow) {
if (focusedWindow) if (focusedWindow) focusedWindow.setFullScreen(!focusedWindow.isFullScreen())
focusedWindow.setFullScreen(!focusedWindow.isFullScreen())
} }
}, },
{ {
label: 'Toggle Developer Tools', label: 'Toggle Developer Tools',
accelerator: (function () { accelerator: (function () {
if (process.platform === 'darwin') return (process.platform === 'darwin') ? 'Alt+Command+I' : 'Ctrl+Shift+I'
return 'Alt+Command+I'
else
return 'Ctrl+Shift+I'
})(), })(),
click: function (item, focusedWindow) { click: function (item, focusedWindow) {
if (focusedWindow) if (focusedWindow) focusedWindow.toggleDevTools()
focusedWindow.toggleDevTools() }
} }
},
] ]
}, },
{ {
@ -138,7 +130,7 @@ app.once('ready', function () {
label: 'Close', label: 'Close',
accelerator: 'CmdOrCtrl+W', accelerator: 'CmdOrCtrl+W',
role: 'close' role: 'close'
}, }
] ]
}, },
{ {
@ -172,7 +164,7 @@ app.once('ready', function () {
} }
} }
] ]
}, }
] ]
if (process.platform === 'darwin') { if (process.platform === 'darwin') {
@ -214,8 +206,8 @@ app.once('ready', function () {
{ {
label: 'Quit', label: 'Quit',
accelerator: 'Command+Q', accelerator: 'Command+Q',
click: function () { app.quit(); } click: function () { app.quit() }
}, }
] ]
}) })
template[3].submenu.push( template[3].submenu.push(
@ -244,12 +236,14 @@ function loadApplicationPackage (packagePath) {
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))
if (packageJson.version) if (packageJson.version) app.setVersion(packageJson.version)
app.setVersion(packageJson.version)
if (packageJson.productName) if (packageJson.productName) {
app.setName(packageJson.productName) app.setName(packageJson.productName)
else if (packageJson.name) } else if (packageJson.name) {
app.setName(packageJson.name) app.setName(packageJson.name)
}
app.setPath('userData', path.join(app.getPath('appData'), app.getName())) app.setPath('userData', path.join(app.getPath('appData'), app.getName()))
app.setPath('userCache', path.join(app.getPath('cache'), app.getName())) app.setPath('userCache', path.join(app.getPath('cache'), app.getName()))
app.setAppPath(packagePath) app.setAppPath(packagePath)

View file

@ -1,6 +1,5 @@
var app = require('app') var app = require('app')
var fs = require('fs') var fs = require('fs')
var path = require('path')
var request = require('request') var request = require('request')
var TARGET_URL = 'https://atom.io/download/atom-shell/index.json' var TARGET_URL = 'https://atom.io/download/atom-shell/index.json'
@ -9,11 +8,9 @@ function getDate () {
var today = new Date() var today = new Date()
var year = today.getFullYear() var year = today.getFullYear()
var month = today.getMonth() + 1 var month = today.getMonth() + 1
if (month <= 9) if (month <= 9) month = '0' + month
month = '0' + month
var day = today.getDate() var day = today.getDate()
if (day <= 9) if (day <= 9) day = '0' + day
day = '0' + day
return year + '-' + month + '-' + day return year + '-' + month + '-' + day
} }
@ -38,7 +35,7 @@ function getInfoForCurrentVersion () {
'win32-ia32', 'win32-ia32',
'win32-ia32-symbols', 'win32-ia32-symbols',
'win32-x64', 'win32-x64',
'win32-x64-symbols', 'win32-x64-symbols'
] ]
return json return json
@ -46,12 +43,13 @@ function getInfoForCurrentVersion () {
function getIndexJsInServer (callback) { function getIndexJsInServer (callback) {
request(TARGET_URL, function (e, res, body) { request(TARGET_URL, function (e, res, body) {
if (e) if (e) {
callback(e) callback(e)
else if (res.statusCode != 200) } else if (res.statusCode != 200) {
callback(new Error('Server returned ' + res.statusCode)) callback(new Error('Server returned ' + res.statusCode))
else } else {
callback(null, JSON.parse(body)) callback(null, JSON.parse(body))
}
}) })
} }