Changes between Initial Version and Version 1 of Internal/OpenFlow/mvnParse


Ignore:
Timestamp:
Nov 25, 2014, 3:42:07 AM (10 years ago)
Author:
akoshibe
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Internal/OpenFlow/mvnParse

    v1 v1  
     1= A Bash parser for Maven project layout. =
     2There are two points to this page.
     3 * Next to Python, Bash/sh is the flamethrowers of the *nix world.
     4 * Projects built using [http://maven.apache.org Maven] can get ridiculously complex, but if the authors are mindful, can be organized enough so that you can garner information about its structure with just a bit of file munging (no compiling code at all).
     5This is a proof of concept of the second point above.
     6== What it does ==
     7Basically, say we have this following directory structure:
     8{{{
     9 /root/node1/leaf1
     10     |     /leaf2
     11     |
     12     /node2/leaf3
     13          /leaf4
     14}}}
     15Say root, node1 and node2 have files, called ''pom.xml'' in them that describe their name and what they do.
     16 * in /root:
     17 {{{
     18<artifactId>root-of-project</artifactId>
     19<description>This is the root</description>
     20 }}}
     21 * in nodes:
     22 {{{
     23<parent>root-of-project</parent>
     24<artifactId>node-n-of-project</artifactId>
     25<description>This is node n</description>
     26 }}}
     27
     28So going back to the directory tree, we take that, and turn it into the following, wiki-friendly things:
     29 * the first is an indented list:
     30{{{
     31 * root
     32 ** node1
     33 *** leaf1
     34 *** leaf2
     35 ** node2
     36 *** leaf3
     37 *** leaf4
     38}}}
     39 * and the second and third are bulleted lists of the names and descriptions
     40{{{
     41 * root-of-project
     42 * node-1-of-project
     43 * node-2-of-project
     44}}}
     45{{{
     46 * This is the root
     47 * This is node 1
     48 * This is node 2
     49}}}
     50This is also considerably easier to look at than going through each directory and figuring it out/formatting something manually.
     51
     52== The script ==
     53The script that does this is attached below. The rest of this page points out the various parts of the script, not because it is great, but it could sort of be a primer of some of the messier things that can be done with Bash.