Created
June 1, 2009 06:11
-
-
Save icco/121261 to your computer and use it in GitHub Desktop.
LOC Counter by Hyperlisk
This file contains hidden or 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
| #!/bin/bash | |
| START=`pwd`; | |
| script=$START"/hyperliskLOC.php"; | |
| cd /tmp/; | |
| svn co http://wiki.csc.calpoly.edu/blugoo/svn/trunk/ | |
| cd trunk; | |
| for i in $(seq 820 972); | |
| do | |
| svn up -r $i > /dev/null; | |
| echo $i `php $script`; | |
| done; |
This file contains hidden or 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
| <?php | |
| // Java source line counter | |
| // By: Nicholas Trevino | |
| // Directory to scan, needs trailing slash. | |
| $dirs[] = "goograde/WEB-INF/classes/goograde/"; | |
| $dirs[] = "goograde/TestSrc/goograde/"; | |
| $dirs[] = "goograde/WEB-INF/web/"; | |
| $dirs[] = "goograde/WEB-INF/web/teacher/"; | |
| $dirs[] = "goograde/WEB-INF/web/student/"; | |
| $lines = 0; | |
| foreach($dirs as $dir){ | |
| $files = glob($dir.'/*.java'); | |
| foreach($files as $file){ | |
| $code = implode('',file($file)); | |
| $code = preg_replace("/(\s*\/\/[^\n]*|\s*\/\*.*?\*\/ *|\n\s*\n+|)+/mis",'',$code); | |
| $lines += count(explode("\n",$code)); | |
| } | |
| $files = glob($dir.'/*.jsp'); | |
| foreach($files as $file){ | |
| $code = implode('',file($file)); | |
| $lines += count(explode("\n",$code)); | |
| } | |
| $files = glob($dir.'/*.jspf'); | |
| foreach($files as $file){ | |
| $code = implode('',file($file)); | |
| $lines += count(explode("\n",$code)); | |
| } | |
| } | |
| echo $lines; | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment