Revision: 4183
          http://vexi.svn.sourceforge.net/vexi/?rev=4183&view=rev
Author:   mkpg2
Date:     2011-07-11 01:38:23 +0000 (Mon, 11 Jul 2011)

Log Message:
-----------
Utility. Create standalone vexi dir structure+launch script.

Added Paths:
-----------
    trunk/org.vexi-build.deployment/src/poke/
    trunk/org.vexi-build.deployment/src/poke/java/
    trunk/org.vexi-build.deployment/src/poke/java/dev/
    trunk/org.vexi-build.deployment/src/poke/java/dev/CreateStandalone.java

Added: trunk/org.vexi-build.deployment/src/poke/java/dev/CreateStandalone.java
===================================================================
--- trunk/org.vexi-build.deployment/src/poke/java/dev/CreateStandalone.java     
                        (rev 0)
+++ trunk/org.vexi-build.deployment/src/poke/java/dev/CreateStandalone.java     
2011-07-11 01:38:23 UTC (rev 4183)
@@ -0,0 +1,67 @@
+package dev;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.vexi.util.IOUtil;
+
+import ebuild.util.FileUtil;
+import ebuild.util.FileUtil.CopyFilter;
+import ebuild.util.ZipUtil;
+
+public class CreateStandalone {
+    static public void main(String[] args) throws Exception {
+        String dirArg = System.getProperty("standalone.dir", "standalone");
+        String coreArg = System.getProperty("standalone.core");
+        if(coreArg==null)
+            throw new Exception("Expected property standalone.core");
+        if(!args[0].equals("-t")) 
+            throw new Exception("Expected -t for arg 0");
+        String template = args[1];
+        List<String> srcs = new ArrayList();
+        List<String> params = new ArrayList();
+        
+        for(int i=2; i<args.length; i++){
+            String a = args[i];
+            if(a.indexOf('-')==-1){
+                params.add(a);
+            }else{
+                srcs.add(a);
+            }
+        }
+        
+        File dir = new File(dirArg);
+        if(dir.exists()) FileUtil.deleteDirOrFail(dir);
+        FileUtil.mkdirOrFail(dir);
+        
+        File core = new File(coreArg);
+        FileUtil.copyToDir(core, dir);
+        
+        File src= new File(dir, "src");
+        FileUtil.mkdirOrFail(src);
+        
+        for(String s: srcs){
+            File f = new File(s);
+            if(f.isFile()){
+                ZipUtil.unzipArchive(f, src);
+            }else{
+                FileUtil.mergeCopy(f, src, new CopyFilter() {
+                    public boolean accept(File source, File dest) {
+                        return !source.getName().equals(".svn");
+                    }
+                });
+            }
+        }
+        
+        StringBuilder sb = new StringBuilder();
+        sb.append("#! /bin/sh\n");
+        sb.append("java -jar "+core.getName()+" -t "+template+" ./src/");
+        for(String p: params)
+            sb.append(" "+p);
+        
+        
+        IOUtil.stringToFile(sb.toString(), new File(dir,"run.sh"));
+        
+    }
+}


Property changes on: 
trunk/org.vexi-build.deployment/src/poke/java/dev/CreateStandalone.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to