2015-08-18 12:53:06 +00:00
|
|
|
updateNotifier = require('update-notifier')
|
2015-08-20 20:54:22 +00:00
|
|
|
isRoot = require('is-root')
|
2015-08-18 12:53:06 +00:00
|
|
|
packageJSON = require('../../package.json')
|
|
|
|
|
2015-08-20 20:54:22 +00:00
|
|
|
# `update-notifier` creates files to make the next
|
|
|
|
# running time ask for updated, however this can lead
|
|
|
|
# to ugly EPERM issues if those files are created as root.
|
|
|
|
if not isRoot()
|
|
|
|
notifier = updateNotifier(pkg: packageJSON)
|
2015-08-18 12:53:06 +00:00
|
|
|
|
|
|
|
exports.hasAvailableUpdate = ->
|
|
|
|
return notifier?
|
|
|
|
|
|
|
|
exports.notify = ->
|
|
|
|
return if not exports.hasAvailableUpdate()
|
2015-10-15 13:18:45 +00:00
|
|
|
notifier.notify(defer: false)
|
|
|
|
if notifier.update?
|
|
|
|
console.log('Notice that you might need administrator privileges depending on your setup\n')
|