Browse Source

standardize more

Zeke Sikelianos 9 years ago
parent
commit
68510cbe49
2 changed files with 22 additions and 30 deletions
  1. 15 21
      default_app/main.js
  2. 7 9
      tools/dump-version-info.js

+ 15 - 21
default_app/main.js

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

+ 7 - 9
tools/dump-version-info.js

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