Skip to content

Instantly share code, notes, and snippets.

@kattrali
Created February 25, 2011 07:46
Show Gist options
  • Save kattrali/843493 to your computer and use it in GitHub Desktop.
Save kattrali/843493 to your computer and use it in GitHub Desktop.
A sample hotswap configuration file for grails projects for use with Redcar editor. Save as [project]/.redcar/hotswap.json and change the project name as appropriate
{
"patterns" : [
{
"pattern" : "(.*)\\/my_project\\/grails-app\\/(services|controllers)\\/(.*)(Service|Controller)\\.groovy",
"1" : {
"link" : "$1 + '/my_project/grails-app/domain/' + $3 + '.groovy'",
"name" : "Model"
},
"2" : {
"link" : "$1 + '/my_project/grails-app/views/' + (a = $3.split('/').last.split(//); a[0] = a[0].downcase; a.join) + '/CURRENT_WORD.gsp'",
"name" : "View"
},
"3" : {
"link" : "$1 + '/my_project/grails-app/views/' + (a = $3.split('/').last.split(//); a[0] = a[0].downcase; a.join) + '/_CURRENT_WORD.gsp'",
"name" : "Template"
},
"4" : {
"link" : "$1 + '/my_project/test/unit/' + $3 + $4 +'Tests.groovy'",
"name" : "Unit Tests"
},
"5" : {
"link" : "$1 + '/my_project/test/integration/' + $3 + $4 +'Tests.groovy'",
"name" : "Integration Tests"
},
"6" : {
"link" : "$1 + '/my_project/test/unit/' + $3 + $4 +'.story'",
"name" : "Easyb Feature"
}
},
{
"pattern" : "(.*)\\/domain\\/(.*)\\.groovy",
"1" : {
"link" : "$1 + '/controllers/' + $2 + 'Controller.groovy'",
"name" : "Controller"
},
"2" : {
"link" : "$1 + '/services/' + $2 + 'Service.groovy'",
"name" : "Service"
},
"3" :{
"link" : "$1 + '/test/unit/' + $2 + 'Tests.groovy'",
"name" : "Unit Tests"
},
"4" :{
"link" : "$1 + '/test/integration/' + $2 + 'Tests.groovy'",
"name" : "Integration Tests"
},
"5" :{
"link" : "$1 + '/test/unit/' + $2 + '.story'",
"name" : "Easyb Feature"
},
"6" :{
"link" : "$1 + '/views/' + (a = $2.split('/').last.split(//); a[0] = a[0].downcase; a.join) + '/show.gsp'",
"name" : "show.gsp"
},
"7" :{
"link" : "$1 + '/views/' + (a = $2.split('/').last.split(//); a[0] = a[0].downcase; a.join) + '/edit.gsp'",
"name" : "edit.gsp"
},
"8" :{
"link" : "$1 + '/views/' + (a = $2.split('/').last.split(//); a[0] = a[0].downcase; a.join) + '/list.gsp'",
"name" : "list.gsp"
},
"9" :{
"link" : "$1 + '/views/' + (a = $2.split('/').last.split(//); a[0] = a[0].downcase; a.join) + '/create.gsp'",
"name" : "create.gsp"
}
},
{
"pattern" : "(.*)\\/views\\/(.*)\\/(.*)\\.gsp",
"1" : {
"link" : "d = File.join($1,'domain','**',( (a = $2.split('/').last.split(//); a[0] = a[0].upcase; a.join)+'.groovy')); Dir.glob(d).first",
"name" : "Model"
},
"2" : {
"link" : "d = File.join($1,'controllers','**',( (a = $2.split('/').last.split(//); a[0] = a[0].upcase; a.join)+'Controller.groovy')); Dir.glob(d).first",
"name" : "Controller"
}
},
{
"pattern" : "(.*)\\/test\\/(unit|integration|functional)\\/(.*)\\/((.*)(Controller|Service|TagLib)|(.*))Tests\\.groovy",
"1" : {
"link" : "$1 + '/grails-app/' + ($7 ? 'domain' : $6.downcase + ($6 == 'TagLib' ? '': 's')) + '/' + $3 + '/' + $4 +'.groovy'",
"name" : "Test Target Source"
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment