Created
April 10, 2013 19:36
-
-
Save barata0/5357749 to your computer and use it in GitHub Desktop.
List all Domain Classes without a Controller in GRAILS
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
import static groovy.io.FileType.FILES | |
def appFolderName = 'C:/Users/me/grails-base-folder/' | |
def appFolder = new File(appFolderName) | |
def domainFolder = new File(appFolder, "grails-app/domain") | |
def controllersFolder = new File(appFolder, "grails-app/controllers") | |
def listAllGroovyFiles(folder) { | |
def files = [] | |
folder.eachFileRecurse(FILES) { f -> | |
if(f.name.endsWith('.groovy')) { | |
files << f | |
} | |
} | |
files | |
} | |
def domainFiles = listAllGroovyFiles(domainFolder) | |
def controllersFiles = listAllGroovyFiles(controllersFolder) | |
def dif = domainFiles.collect {f -> f.absolutePath - domainFolder.absolutePath - '.groovy'} - controllersFiles.collect {f -> (f.absolutePath - controllersFolder.absolutePath - 'Controller.groovy')} | |
dif = dif.collect {(it[1..it.size()-1]).replaceAll('\\\\', '.')} | |
dif.join(' ') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment