Author: rfelden
Date: Wed Jun 20 16:25:33 2007
New Revision: 3

URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D3&repname=3Df=
ix_apply
Log:
small refactoring

Modified:
    trunk/fixapplier/src/main/java/org/jahia/fixapplier/controller/MyContro=
ller.java

Modified: trunk/fixapplier/src/main/java/org/jahia/fixapplier/controller/My=
Controller.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/fixapplier/src/=
main/java/org/jahia/fixapplier/controller/MyController.java&rev=3D3&repname=
=3Dfix_apply
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/fixapplier/src/main/java/org/jahia/fixapplier/controller/MyContro=
ller.java (original)
+++ trunk/fixapplier/src/main/java/org/jahia/fixapplier/controller/MyContro=
ller.java Wed Jun 20 16:25:33 2007
@@ -39,8 +39,6 @@
 =

     private PrintStream logStream ;
 =

-    private boolean yesToAll =3D false ;
-
     /**
      * Constructor, first call of the application.
      * @param nogui disable the gui
@@ -546,7 +544,11 @@
 =

         // file processing
         } else {
-            if (neu.getName().endsWith(".old")) {
+            // jahia specific treatment
+            if (neu.getName().equals("jahia.skeleton")) {
+                jahiaSkeletonTreatment(neu);
+            }
+            else if (neu.getName().endsWith(".old")) {
                 return ;
             }
             String targetPath =3D StringUtils.replaceFirstToken(neu.getAbs=
olutePath(), dataModel.temp().getAbsolutePath() + File.separator + "output"=
, dataModel.getProject().getAbsolutePath()) ;
@@ -564,6 +566,25 @@
     }
 =

     /**
+     * Jahia-specific method to merge changes made to jahia.skeleton (-> j=
ahia.properties).
+     * @param skeleton the jahia.skeleton file
+     */
+    private void jahiaSkeletonTreatment(File skeleton) {
+        String targetPath =3D StringUtils.replaceFirstToken(skeleton.getAb=
solutePath(), dataModel.temp().getAbsolutePath() + File.separator + "output=
", dataModel.getProject().getAbsolutePath()) ;
+        targetPath =3D StringUtils.replaceLastToken(targetPath, "jahia.ske=
leton", "jahia.properties") ;
+        File destination =3D new File(targetPath) ;
+
+        // this is the text merge
+        checkConfiguration(skeleton, destination) ;
+
+        File parentPath =3D destination.getParentFile() ;
+        parentPath.mkdirs() ;
+        Tools.copy(skeleton, destination) ;
+        out(skeleton.getName() + " replaced (jahia.properties)");
+        printUI("   " + skeleton.getName() + " replaced (jahia.properties)=
");
+    }
+
+    /**
      * This concerns the merge file merging. It checks a given update file=
 and its existing copy,
      * and modifies the processed file resulting from the smart merge betw=
een these two. To do so, it uses
      * the .old file that should be included if merging has to be done.
@@ -592,7 +613,7 @@
         // now the actual merge
         File old =3D new File(update.getParentFile(), update.getName()+".o=
ld") ;
         if (!Merger.merge(this, update, old, existing)) {
-            out("merge merging for the file '"+update.getName()+"' encount=
ered issues");
+            out("merge for the file '"+update.getName()+"' encountered iss=
ues");
         }
     }
 =


_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list

Reply via email to