You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by re...@apache.org on 2007/10/10 17:41:39 UTC

svn commit: r583517 - /cocoon/trunk/tools/cocoon-maven-docs-cleaner-plugin/src/main/java/org/apache/cocoon/maven/docscleaner/DocsCleanerMojo.java

Author: reinhard
Date: Wed Oct 10 08:41:38 2007
New Revision: 583517

URL: http://svn.apache.org/viewvc?rev=583517&view=rev
Log:
revert deletion logic: only delete particular files that contain versioning information

Modified:
    cocoon/trunk/tools/cocoon-maven-docs-cleaner-plugin/src/main/java/org/apache/cocoon/maven/docscleaner/DocsCleanerMojo.java

Modified: cocoon/trunk/tools/cocoon-maven-docs-cleaner-plugin/src/main/java/org/apache/cocoon/maven/docscleaner/DocsCleanerMojo.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-maven-docs-cleaner-plugin/src/main/java/org/apache/cocoon/maven/docscleaner/DocsCleanerMojo.java?rev=583517&r1=583516&r2=583517&view=diff
==============================================================================
--- cocoon/trunk/tools/cocoon-maven-docs-cleaner-plugin/src/main/java/org/apache/cocoon/maven/docscleaner/DocsCleanerMojo.java (original)
+++ cocoon/trunk/tools/cocoon-maven-docs-cleaner-plugin/src/main/java/org/apache/cocoon/maven/docscleaner/DocsCleanerMojo.java Wed Oct 10 08:41:38 2007
@@ -30,13 +30,11 @@
     protected File siteOutputDirectory;
 
     public void execute() throws MojoExecutionException, MojoFailureException {
-        System.out.println("OutputDirectory: " + siteOutputDirectory);
         File[] files = this.siteOutputDirectory.listFiles();
         for (int i = 0; i < files.length; i++) {
             File f = files[i];
             if(deleteFile(f)) {
-                this.getLog().debug("[delete] " + f.getAbsolutePath());
-                System.out.println("Deleting: " + f.getAbsolutePath());
+                this.getLog().info("[delete] " + f.getAbsolutePath());
                 if(f.isDirectory()) {
                     try {
                         FileUtils.deleteDirectory(f);
@@ -51,49 +49,13 @@
     }
 
     private boolean deleteFile(File file) {
-        String fileName = file.getName();
-
-        // find out if it is a Daisy page -> don't delete them
-        int pos = fileName.indexOf('_');
-        if (pos > 0) {
-        String documentId = fileName.substring(0, fileName.indexOf('_'));
-            boolean isDaisyDocument = false;
-            try {
-                Integer.parseInt(documentId);
-                isDaisyDocument = true;
-            } catch (NumberFormatException nfe) {
-                isDaisyDocument = false;
-            }
-
-            if (isDaisyDocument) {
-                return false;
-            }
+        if("project-summary.html".equals(file.getName())) {
+            return true;
         }
-
-        if (".htaccess".equals(fileName)) {
-            return false;
-        }
-
-        // is it a status report --> don't delete it
-        if ("changes-report.html".equals(fileName)) {
-            return false;
+        if("dependencies.html".equals(file.getName())) {
+            return true;
         }
-
-        // is it the css directory --> don't delete it
-        if ("css".equals(fileName)) {
-            return false;
-        }
-        // is it the images directory --> don't delete it
-        if ("images".equals(fileName)) {
-            return false;
-        }
-
-        // is it the index page --> don't delete it
-        if ("index.html".equals(fileName)) {
-            return false;
-        }
-
-        return true;
+        return false;
     }
 
 }