Fun with Shell Scripts... OR Sagacious Simplification of Plug-in Development
A little background...
Previously when I made plug-ins for Anathema I adhered to the following process:
The average time it took: 8+ minutes.
Now when I make plug-in's for Anathema:
The average time it now takes: -1 minute.
Is anyone aware of a way to force characters into the lower case? Y -> y OR N -> n
Previously when I made plug-ins for Anathema I adhered to the following process:
- Open directory with
- Select contents of directory.
- Compress selection into a ZIP archive.
- Change extension to
.jar. - Copy JAR to computer downstairs (This machine has VMWare and Windows.)
- Run downstairs to use computer.
- Open JAR in with 7-zip.
- Remove meta-data from JAR. (e.g.
.DS_Store,thumbs.db, etc.) - Post JAR for downloading
plugin-fragment.xml.The average time it took: 8+ minutes.
Now when I make plug-in's for Anathema:
- Open Terminal.
- Type
sh makeJar.sh - Type name of directory containing plug-in components.
- Post JAR for downloading.
The average time it now takes: -1 minute.
makeJar.sh
#!/bin/bash
function createJar {
printf "Copying files to temporary directory..."
cp -R $plugDirect pluginTemp ;
printf "\n Removing meta-data from files..."
rm -rf $( find pluginTemp -type d -name .svn ) ;
rm -f $( find pluginTemp -type f -name .DS_Store ) ;
cd pluginTemp ;
printf "\n Making $plugDirect.jar..." ;
jar cf ../$plugDirect.jar * ;
cd .. ;
printf "Removing temporary directory..."
rm -rdf pluginTemp ;
printf "\n" ;
printf "\n $plugDirect.jar is finished. \n Look in \'$( pwd )\' for the file." ;
printf "\n" ;
}
function testDirect {
if [ -d "$plugDirect" ] ; then
testJar ;
else
read -p "The $plugDirect directory does not exist. Try again? (y/n) " noDirect ;
if [ $noDirect == "y" ] ; then
read -p "Please re-ener the directory containing plug-in files: " plugDirect ;
testDirect ;
fi
fi
}
function testJar {
if [ ! -f "$plugDirect.jar" ] ; then
testTemp ;
else
read -p "$plugDirect.jar already exists. Overwrite? (y/n) " overwriteJar ;
if [ $overwriteJar == "y" ] ; then
rm -rdf $plugDirect.jar ;
testJar ;
fi
fi
}
function testTemp {
if [ ! -d "pluginTemp" ] ; then
createJar ;
else
read -p "pluginTemp already exists. Overwrite? (y/n) " overwriteTemp ;
if [ $overwriteTemp == "y" ] ; then
rm -rdf pluginTemp ;
testTemp ;
fi
fi
}
cd /Users/pauladams/Documents/Development/Anathema ;
read -p "Please enter the directory containing the plug-in files: " plugDirect ;
printf "\n" ;
testDirect ;
Is anyone aware of a way to force characters into the lower case? Y -> y OR N -> n
