mirror of
https://github.com/atom/atom.git
synced 2026-02-02 10:45:14 -05:00
Make auto updater work.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
AtomWindow = require './atom-window'
|
||||
BrowserWindow = require 'browser-window'
|
||||
Menu = require 'menu'
|
||||
autoUpdater = require 'auto-updater'
|
||||
crashReporter = require 'crash-reporter'
|
||||
app = require 'app'
|
||||
ipc = require 'ipc'
|
||||
@@ -106,13 +107,12 @@ class AtomApplication
|
||||
setupJavaScriptArguments: ->
|
||||
app.commandLine.appendSwitch 'js-flags', '--harmony_collections'
|
||||
|
||||
buildApplicationMenu: ->
|
||||
buildApplicationMenu: (version, continueUpdate) ->
|
||||
menus = []
|
||||
menus.push
|
||||
label: 'Atom'
|
||||
submenu: [
|
||||
{ label: 'About Atom', selector: 'orderFrontStandardAboutPanel:' }
|
||||
{ label: "Version #{@version}", enabled: false }
|
||||
{ type: 'separator' }
|
||||
{ label: 'Preferences...', accelerator: 'Command+,', click: => @openConfig() }
|
||||
{ type: 'separator' }
|
||||
@@ -125,6 +125,14 @@ class AtomApplication
|
||||
{ label: 'Quit', accelerator: 'Command+Q', click: -> app.quit() }
|
||||
]
|
||||
|
||||
menus[0].submenu.splice 1, 0,
|
||||
if version
|
||||
label: "Update to #{version}"
|
||||
click: continueUpdate
|
||||
else
|
||||
label: "Version #{@version}"
|
||||
enabled: false
|
||||
|
||||
if @dev
|
||||
menus.push
|
||||
label: '\uD83D\uDC80'
|
||||
@@ -176,6 +184,10 @@ class AtomApplication
|
||||
event.preventDefault()
|
||||
@openPath filePath
|
||||
|
||||
autoUpdater.on 'ready-for-update-on-quit', (event, version, quitAndUpdate) =>
|
||||
event.preventDefault()
|
||||
@buildApplicationMenu version, quitAndUpdate
|
||||
|
||||
ipc.on 'close-without-confirm', (processId, routingId) ->
|
||||
window = BrowserWindow.fromProcessIdAndRoutingId processId, routingId
|
||||
window.removeAllListeners 'close'
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
AtomApplication = require './atom-application'
|
||||
autoUpdater = require 'auto-updater'
|
||||
delegate = require 'atom-delegate'
|
||||
app = require 'app'
|
||||
fs = require 'fs'
|
||||
path = require 'path'
|
||||
optimist = require 'optimist'
|
||||
nslog = require 'nslog'
|
||||
AtomApplication = require './atom-application'
|
||||
_ = require 'underscore'
|
||||
|
||||
console.log = (args...) ->
|
||||
@@ -20,6 +21,13 @@ delegate.browserMainParts.preMainMessageLoopRun = ->
|
||||
args.pathsToOpen.push(filePath)
|
||||
|
||||
app.on 'open-file', addPathToOpen
|
||||
|
||||
app.on 'will-finish-launching', ->
|
||||
autoUpdater.setFeedUrl 'https://speakeasy.githubapp.com/apps/27/appcast.xml'
|
||||
autoUpdater.setAutomaticallyChecksForUpdates true
|
||||
autoUpdater.setAutomaticallyDownloadsUpdates true
|
||||
autoUpdater.checkForUpdatesInBackground()
|
||||
|
||||
app.on 'finish-launching', ->
|
||||
app.removeListener 'open-file', addPathToOpen
|
||||
|
||||
|
||||
Reference in New Issue
Block a user