You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by jh...@apache.org on 2005/12/08 21:22:14 UTC

svn commit: r355192 - /cocoon/whiteboard/maven2/cocoon-archetype-core/src/main/resources/makeDescriptor.pl

Author: jheymans
Date: Thu Dec  8 12:22:10 2005
New Revision: 355192

URL: http://svn.apache.org/viewcvs?rev=355192&view=rev
Log:
perl script to generate the archetype descriptor, filesets are not supported yet :( . Don't mock about my perl skills please, it's been a while.

Added:
    cocoon/whiteboard/maven2/cocoon-archetype-core/src/main/resources/makeDescriptor.pl

Added: cocoon/whiteboard/maven2/cocoon-archetype-core/src/main/resources/makeDescriptor.pl
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-archetype-core/src/main/resources/makeDescriptor.pl?rev=355192&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-archetype-core/src/main/resources/makeDescriptor.pl (added)
+++ cocoon/whiteboard/maven2/cocoon-archetype-core/src/main/resources/makeDescriptor.pl Thu Dec  8 12:22:10 2005
@@ -0,0 +1,67 @@
+#!/usr/bin/perl -W
+
+use Data::Dumper;
+
+#find all files
+my @fileList=`find . -type d -name '.svn' -prune -o -type f -print` ;
+my @sources;
+my @resources; 
+my @testResources; 
+my @testSources;
+foreach my $file (@fileList){
+  next unless $file=~/\.\/archetype-resources/ ;
+  #attempt to skip binary files alltogether as they make the archetype deployer barf sometimes
+  next if $file=~/\.ico$/;
+  next if $file=~/\.png$/;
+  next if $file=~/\.jpg$/;
+  next if $file=~/\.gif$/;
+  chomp ($file);
+  $file =~ s/\.\/archetype-resources\///;
+
+  if ($file=~/src\/main\/java/){
+    push(@sources, $file);
+  }
+  
+  if ($file=~/src\/main\/webapp/){
+    push (@resources, $file);
+  }
+
+  if ($file=~/src\/test\/java/){
+    push (@testSources, $file);
+  }
+
+  if ($file=~/src\/\/test\/resources/){
+    push (@testResources, $file);
+  }
+
+  if ($file=~/src\/main\/resources/){
+    push (@resources, $file);
+  }
+}
+
+# ARCHETYPE
+print "<archetype>\n";
+print "<id>core-archetype</id>\n";
+
+# SOURCES
+print "<sources>\n";
+foreach my $source (@sources) {
+  print "<source>$source</source>\n";
+} 
+print "</sources>\n";
+
+# TESTSOURCES
+print "<testSources>\n";
+foreach my $testSource (@testSources) {
+  print "<testSource>$testSource</testSource>\n";
+} 
+print "</testSources>\n";
+
+# RESOURCES
+print "<resources>\n";
+foreach my $resource (@resources) {
+  print "<resource>$resource</resource>\n";
+} 
+print "</resources>\n";
+
+print "</archetype>\n";