 
       ## NB: Gonna clear Releases for now, in the future we need to pull down
       ## the existing version
-      rimraf.sync(releasesDir)
+      rm(releasesDir)
 
       cmd = 'build/windows/update.com'
       args = ['--releasify', path.join(buildDir, pkgs), '-r', releasesDir]

fs = require 'fs'
path = require 'path'
_ = require 'underscore-plus'
rimraf = require 'rimraf'

module.exports = (grunt) ->
  {spawn} = require('./task-helpers')(grunt)

  grunt.registerTask 'create-installer', 'Create the Windows installer', ->
    if process.platform != 'win32'

    atomDir = path.join(buildDir, 'Atom')

    packageInfo = JSON.parse(fs.readFileSync(path.join(atomDir, 'resources', 'app', 'package.json'), {encoding: 'utf8'}))
    inputTemplate = grunt.file.read(path.join('build', 'windows', 'atom.nuspec.erb'))

    ## NB: Build server has some sort of stamp on the version number
    packageInfo.version = packageInfo.version.replace(/-.*$/, '')

    targetNuspecPath = path.join(buildDir, 'atom.nuspec')
    grunt.file.write(targetNuspecPath, _.template(inputTemplate, packageInfo))

    cmd = 'build/windows/nuget.exe'
    args = ['pack', targetNuspecPath, '-BasePath', atomDir, '-OutputDirectory', buildDir]
