maenu/grunt-template-jasmine-istanbul — pull request #14 by zdennis (2013-07-03 02:02:51+00:00)
Title: Support baseDir option

This pull adds the `baseDir` option which when set indicates the base directory that the JS will be served out of. This is useful when the JS files are found in a directory hierarchy on the file-system that doesn't match 1:1 with how the files are being served through connect.

The example below shows how this works:

connect: {
server: {
options: {
port: 8000,
base: 'site/'
}
},
},
jasmine: {
coverage: {
src: 'site/js/**/*.js',
options: {
templateOptions: {
template: require('grunt-template-jasmine-requirejs'),
coverage: 'coverage/coverage.json',
report: 'coverage',
baseDir: 'site/',
templateOptions: {
requireConfigFile: 'site/js/app/core/config.js',
requireConfig: {
baseUrl: '.grunt/grunt-contrib-jasmine/site/js'
}
}
},

// Setting +replace+ to false ensures that grunt-template-jasmine-istanbul
// will leave alone the path to the files in the generated +outfile+. If this
// is set to true then the +outfile+ will contain bad references to files that
// requireJS tries to load.
replace: false
}
}
}

The source file are found in the `site/` directory on the file-system but the connect server servers up `site/` as root so it's not necessary to keep `site/` in the generated src paths when the requireJS config gets read in, modified, and then written back out.