Created
August 9, 2013 03:04
-
-
Save techieBrandon/6190878 to your computer and use it in GitHub Desktop.
Local dev CI problem focus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
techieBrandon$ cat Gruntfile.coffee | |
module.exports = (grunt) -> | |
path = require('path') | |
gruntConfig = | |
pkg: grunt.file.readJSON('package.json') | |
exec: | |
generateAppResourcesJson: | |
cmd: () -> | |
"grails my-resources --module=specs --dest=.grunt/spec/spec-resources.json" | |
watch: | |
groovyWebAppResources: | |
files: 'grails-app/conf/ApplicationResources.groovy' | |
tasks: ['exec:generateAppResourcesJson'] | |
grunt.initConfig gruntConfig | |
updateJasmineFiles = (filepath) -> | |
console.log "Determining converted app resource file #{filepath} exists..." | |
unless grunt.file.exists(filepath) | |
console.log "File exists #{grunt.file.exists(filepath)}" | |
exec = grunt.config.get('exec:generateAppResourcesJson') | |
grunt.config(exec) | |
grunt.task.run('exec:generateAppResourcesJson') | |
console.log "New app resource file generated." | |
updateJson = grunt.file.readJSON(filepath) | |
watchFx = (action,filepath) -> | |
if action? | |
if action == "changed" or action == "added" | |
if path.basename(filepath) == "spec-resources.json" | |
updateJasmineFiles(filepath) | |
grunt.event.on 'watch', watchFx | |
grunt.loadNpmTasks 'grunt-exec' | |
grunt.loadNpmTasks 'grunt-contrib-watch' | |
grunt.registerTask 'spec', 'Runs test suites', () => | |
updateJasmineFiles('.grunt/spec/spec-resources.json') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
techieBrandon$(cat(Gruntfile.coffee));