Author: ks156
Date: 2008-12-11 16:30:31 +0100 (Thu, 11 Dec 2008)
New Revision: 3053

Added:
   software_suite_v2/software/development_tools/gadget_packer/
   software_suite_v2/software/development_tools/gadget_packer/branches/
   software_suite_v2/software/development_tools/gadget_packer/tags/
   software_suite_v2/software/development_tools/gadget_packer/trunk/
   
software_suite_v2/software/development_tools/gadget_packer/trunk/tux_gadget_packer
Log:
* First import of the gadget packer.
  This script create the TGF archive from an existing directory. It check for
  commons errors, and display a report.


Added: 
software_suite_v2/software/development_tools/gadget_packer/trunk/tux_gadget_packer
===================================================================
--- 
software_suite_v2/software/development_tools/gadget_packer/trunk/tux_gadget_packer
                          (rev 0)
+++ 
software_suite_v2/software/development_tools/gadget_packer/trunk/tux_gadget_packer
  2008-12-11 15:30:31 UTC (rev 3053)
@@ -0,0 +1,192 @@
+#!/bin/bash
+
+# Constants
+OPTIONAL="\033[80D\033[71C\033[33mOPTIONAL \033[00m\n"
+WARNING="\033[80D\033[72C\033[33mWARNING \033[00m\n"
+DETECTED="\033[80D\033[71C\033[32mDETECTED \033[00m\n"
+PASSED="\033[80D\033[73C\033[32mPASSED \033[00m\n"
+NOTFOUND="\033[80D\033[70C\033[31mNOT FOUND \033[00m\n"
+FAILED="\033[80D\033[73C\033[31mFAILED \033[00m\n"
+
+# Scan the <description></description> section
+scan_description () {
+    echo $line |grep "<name>" > /dev/null
+    if [ $? == 0 ]; then
+       printf ">  Name : "
+       NAME=`echo $line |cut -f 2 -d ">" | cut -f 1 -d "<"`
+       echo $NAME
+    fi
+    echo $line |grep "<description>" >/dev/null
+    if [ $? == 0 ]; then
+       printf ">  Desc : "
+       echo $line |cut -f 2 -d ">" | cut -f 1 -d "<"
+    fi
+    echo $line |grep "<author>" >/dev/null
+    if [ $? == 0 ]; then
+       printf ">  Author : "
+       echo $line |cut -f 2 -d ">" | cut -f 1 -d "<"
+    fi
+    echo $line |grep "<version>" >/dev/null
+    if [ $? == 0 ]; then
+       printf ">  Version : "
+       echo $line |cut -f 2 -d ">" | cut -f 1 -d "<"
+    fi
+}
+
+# Scan the <parameters></parameters> section
+scan_parameters () {
+    echo $line |grep "<parameter" >/dev/null
+    if [ $? == 0 ]; then
+       printf "\n Parameter :\n"
+    fi
+    echo $line |grep "name" > /dev/null
+    if [ $? == 0 ]; then
+       printf ">  Name : "
+       echo $line |cut -f 2 -d "=" |cut -f 1 -d "/"
+    fi
+    echo $line |grep "description" >/dev/null
+    if [ $? == 0 ]; then
+       printf ">  Desc : "
+       echo $line |cut -f 2 -d "=" |cut -f 1 -d "/"
+    fi
+    echo $line |grep "type" >/dev/null
+    if [ $? == 0 ]; then
+       printf ">  Author : "
+       echo $line |cut -f 2 -d "=" |cut -f 1 -d "/"
+    fi
+    echo $line |grep "defaultValue" >/dev/null
+    if [ $? == 0 ]; then
+       printf ">  Version : "
+       echo $line |cut -f 2 -d "=" |cut -f 1 -d "/"
+    fi
+}
+
+# Scan the <commands></commands> section
+scan_commands () {
+    echo $line |grep "<command" >/dev/null
+    if [ $? == 0 ]; then
+       printf "\n Command :\n"
+    fi
+    echo $line |grep "name" > /dev/null
+    if [ $? == 0 ]; then
+       printf ">  Name : "
+       echo $line |cut -f 2 -d "=" |cut -f 1 -d "/"
+    fi
+    echo $line |grep "description" >/dev/null
+    if [ $? == 0 ]; then
+       printf ">  Desc : "
+       echo $line |cut -f 2 -d "=" |cut -f 1 -d "/"
+    fi
+}
+
+#### Start of the script
+#>>> Header
+echo "TuxDroid gadgets compiler"
+echo 
"--------------------------------------------------------------------------------"
+#<<< Check if the path is correct >>>
+DIR=$1
+if [ ! -d $DIR ]; then
+    echo "Couldn't find the folder to pack"
+    echo "Please specify the complete path to the folder"
+    exit 0
+fi
+#<<< Check the file architecture integrity >>>
+printf "Verifying the architecture integrity"
+if [ ! -d $DIR/libraries ]; then
+    printf "\n$DIR/libraries doesn't exists $FAILED"
+    exit 1
+fi
+if [ ! -d $DIR/resources ]; then
+    printf "\n$DIR/resources doesn't exists $FAILED"
+    exit 1
+fi
+printf "$PASSED"
+
+#<<< Verify the files >>>
+# gadget.xml
+echo "Verifying the files"
+if [ ! -e $DIR/resources/gadget.xml ]; then
+    printf ">  gadget.xml $NOTFOUND"
+    exit 1
+else
+    INT=`grep "kind" $DIR/resources/gadget.xml | sed 's/kind=//g' |sed 
's/>//g' |sed 's/\"//g'`
+    case $INT in
+       *java*)   EXT="jar" ;;
+       *python*) EXT="py" ;;
+       perl)   EXT="pl" ;;
+       ruby)   EXT="rb" ;;
+       bash)   EXT="sh" ;;
+       *)  echo $INT
+    esac
+    printf ">  gadget.xml $DETECTED"
+fi
+# icon
+ICN=`grep "iconFile" $DIR/resources/gadget.xml |cut -f 2 -d ">" |cut -f 1 -d 
"<"`
+if [ ! -e "$DIR/$ICN" ]; then
+    printf ">  no icon file found $WARNING"
+else
+    printf ">  icon file found $DETECTED"
+fi
+
+# translation files
+if [ ! -e $DIR/resources/gadget.pot ]; then
+    printf ">  no translation file found $WARNING"
+else
+    printf ">  translation file found $DETECTED"
+fi
+
+# help files
+if [ ! -e $DIR/resources/help.html ]; then
+    printf ">  no help file found $WARNING"
+else
+    printf ">  help file found $DETECTED"
+fi
+echo ""
+
+# <<< Parse the XML file >>>
+echo "Retrieving informations from gadget.xml"
+DESC=False
+PARAM=False
+COM=False
+
+while read line; do
+    if [ $DESC == "True" ]; then
+       scan_description
+    fi
+    if [ $PARAM == "True" ]; then
+       scan_parameters
+    fi
+    if [ $COM == "True" ]; then
+       scan_commands
+    fi
+
+
+    echo $line |grep "<description>" >/dev/null
+    if [ $? == 0 ]; then
+       DESC=True
+       PARAM=False
+       COM=False
+    fi
+    echo $line |grep "<parameters>" >/dev/null
+    if [ $? == 0 ]; then
+       DESC=False
+       PARAM=True
+       COM=False
+    fi
+    echo $line |grep "<commands>" >/dev/null
+    if [ $? == 0 ]; then
+       DESC=False
+       PARAM=False
+       COM=True
+    fi
+done < $DIR/resources/gadget.xml
+
+# <<< Creating the TGF file >>>
+echo ""
+printf "Creating TGF file"
+NAME=`echo $NAME |sed 's/ /_/g'`
+cd $DIR
+zip -r -q $NAME.zip *
+cd -
+mv $DIR/$NAME.zip ./$NAME.tgf
+printf "$PASSED"


Property changes on: 
software_suite_v2/software/development_tools/gadget_packer/trunk/tux_gadget_packer
___________________________________________________________________
Name: svn:executable
   + *


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to