pulsar/tasks/update-atom-shell-task.coffee
Kevin Sawicki d1f372e439 Rebuild native modules when atom-shell is upgraded
Spawn an apm rebuild when the atom shell version changes
after running the update-atom-shell script.

Closes #618
2013-07-12 14:48:10 -07:00

27 lines
864 B
CoffeeScript

path = require 'path'
module.exports = (grunt) ->
{spawn} = require('./task-helpers')(grunt)
getAtomShellVersion = ->
versionPath = path.join('atom-shell', 'version')
if grunt.file.isFile(versionPath)
grunt.file.read(versionPath).trim()
else
null
grunt.registerTask 'update-atom-shell', 'Update atom-shell', ->
done = @async()
currentVersion = getAtomShellVersion()
spawn cmd: 'script/update-atom-shell', (error) ->
if error?
done(error)
else
newVersion = getAtomShellVersion()
if newVersion and currentVersion isnt newVersion
grunt.log.writeln("Rebuilding native modules for new atom-shell version #{newVersion.cyan}.")
cmd = path.join('node_modules', '.bin', 'apm')
spawn {cmd, args: ['rebuild']}, (error) -> done(error)
else
done()