mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 10:17:11 +03:00
d1f372e439
Spawn an apm rebuild when the atom shell version changes after running the update-atom-shell script. Closes #618
27 lines
864 B
CoffeeScript
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()
|