Add generate-asar task

This commit is contained in:
Cheng Zhao 2015-01-29 11:54:46 -08:00
parent 2e10517e1c
commit f9e80439d0
2 changed files with 16 additions and 2 deletions

View File

@ -223,7 +223,7 @@ module.exports = (grunt) ->
ciTasks = ['output-disk-space', 'download-atom-shell', 'download-atom-shell-chromedriver', 'build']
ciTasks.push('dump-symbols') if process.platform isnt 'win32'
ciTasks.push('set-version', 'check-licenses', 'lint')
ciTasks.push('set-version', 'check-licenses', 'lint', 'generate-asar')
ciTasks.push('mkdeb') if process.platform is 'linux'
ciTasks.push('create-windows-installer') if process.platform is 'win32'
ciTasks.push('test') if process.platform is 'darwin'
@ -231,6 +231,6 @@ module.exports = (grunt) ->
ciTasks.push('publish-build')
grunt.registerTask('ci', ciTasks)
defaultTasks = ['download-atom-shell', 'download-atom-shell-chromedriver', 'build', 'set-version']
defaultTasks = ['download-atom-shell', 'download-atom-shell-chromedriver', 'build', 'set-version', 'generate-asar']
defaultTasks.push 'install' unless process.platform is 'linux'
grunt.registerTask('default', defaultTasks)

View File

@ -0,0 +1,14 @@
asar = require 'asar'
path = require 'path'
module.exports = (grunt) ->
{rm} = require('./task-helpers')(grunt)
grunt.registerTask 'generate-asar', 'Generate asar archive for the app', ->
done = @async()
appDir = grunt.config.get('atom.appDir')
asar.createPackage appDir, path.resolve(appDir, '..', 'app.asar'), (err) ->
return done(err) if err?
rm appDir
done()