Skip to content

Instantly share code, notes, and snippets.

@techieBrandon
Created August 9, 2013 03:25
Show Gist options
  • Save techieBrandon/6190945 to your computer and use it in GitHub Desktop.
Save techieBrandon/6190945 to your computer and use it in GitHub Desktop.
Working solution for local dev CI issue
tr-tz-mbp-2:guiMbb brandonwilburn$ 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,context) ->
console.log "Determining converted app resource file #{filepath} exists..."
unless grunt.file.exists(filepath)
console.log "File exists #{grunt.file.exists(filepath)}"
grunt.task.run('exec:generateAppResourcesJson')
console.log "New app resource file generated."
context(0)
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', () ->
context = @async()
updateJasmineFiles('.grunt/spec/spec-resources.json',context)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment