<commit_before>fs = require 'fs'
path = require 'path'
temp = require 'temp'
_ = require 'underscore'

temp.track()

module.exports = (grunt) ->
  grunt.registerTask 'create-windows-installer', 'Create the Windows installer', ->
    @requiresConfig("#{@name}.appDirectory")

    done = @async()

    {appDirectory, outputDirectory} = @options()
    outputDirectory ?= path.resolve('.')

    metadata = grunt.file.readJSON('package.json')

    inputTemplate = grunt.file.read(path.join(__dirname, 'template.nuspec'))
    nuspecContent = _.template(inputTemplate, metadata)

    targetNuspecPath = path.join(temp.mkdirSync('squirrel-installer-'), "#{metadata.name}.nuspec")
    grunt.file.write(targetNuspecPath, nuspecContent)

    cmd = path.resolve(__dirname, '..', 'vendor', 'nuget.exe')
    args = [
      'pack'
      targetNuspecPath
      '-BasePath'
      appDirectory
      '-OutputDirectory'
      outputDirectory
    ]

    console.log cmd
    console.log args

    grunt.util.spawn({cmd, args}, done)<commit_msg>Use config for directory paths<commit_after>fs = require 'fs'
path = require 'path'
temp = require 'temp'
_ = require 'underscore'

temp.track()

module.exports = (grunt) ->
  grunt.registerTask 'create-windows-installer', 'Create the Windows installer', ->
    @requiresConfig("#{@name}.appDirectory")

    done = @async()

    {appDirectory, outputDirectory} = grunt.config(@name)
    outputDirectory ?= path.resolve('.')

    metadata = grunt.file.readJSON('package.json')

    inputTemplate = grunt.file.read(path.resolve(__dirname, '..', 'template.nuspec'))
    nuspecContent = _.template(inputTemplate, metadata)

    targetNuspecPath = path.join(temp.mkdirSync('squirrel-installer-'), "#{metadata.name}.nuspec")
    grunt.file.write(targetNuspecPath, nuspecContent)

    cmd = path.resolve(__dirname, '..', 'vendor', 'nuget.exe')
    args = [
      'pack'
      targetNuspecPath
      '-BasePath'
      appDirectory
      '-OutputDirectory'
      outputDirectory
    ]

    grunt.util.spawn({cmd, args}, done)
{'fraction_non_alphanumeric': 0.14909269249632173, 'fraction_numerical': 0.0, 'mean_word_length': 3.6575342465753424, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7076064', 'n_tokens_mistral': 665, 'n_tokens_neox': 640, 'n_words': 117}