Created
October 18, 2016 10:03
-
-
Save Lesmiscore/694d5fcea659ce67aa3e779fca9b2565 to your computer and use it in GitHub Desktop.
実装関連のTodo削除
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
task("eliminateImplementTodo") { | |
def list=new ArrayList<File>(); | |
println "Finding .java files..." | |
finder(list,new File("."),".java"); | |
list=list.sort() | |
println "Found "+list.size()+" files." | |
list.each{File listingF-> | |
println listingF | |
} | |
println "Eliminating TODO lines... (only implement todo)" | |
def eliminated=0 | |
list.each{File ddir-> | |
println "Editing "+ddir | |
def fr=null | |
def sbld=new StringBuilder() | |
try{ | |
fr=new BufferedReader(new FileReader(ddir)) | |
def line=null | |
while((line=fr.readLine())!=null){ | |
if(line.trim().contains("// TODO: Implement this method")){ | |
eliminated++ | |
continue; | |
} | |
sbld.append(line).append('\n') | |
} | |
}finally{ | |
if(fr!=null)fr.close() | |
fr=null | |
} | |
ddir.delete() | |
try{ | |
fr=new FileWriter(ddir) | |
fr.write(sbld.toString()) | |
}finally{ | |
if(fr!=null)fr.close() | |
fr=null | |
} | |
} | |
println "Done. "+eliminated+" lines are eliminated in "+list.size()+" files." | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment