Home

Advertisement

Dec. 16th, 2007

Seashore

Plug-in Updates...

I've updated the following items on Yushan:  book_scrollofthemonk, book_MoEP-Sidereals, and anathemaTool.sh.

Due to versioning on Google Code (i.e. the inability to delete old plug-ins after a certain date), I've encapsulated all the files inside of zip files.  If you are using OS X 10.5 "Leopard" you may have to use something other than the built in unarchiving program because it de-JAR'd my plug-in as well.

What I see when I decompress the zip file.

Nov. 28th, 2007

Dent

Welcome back to Citadel Station...

A couple of business things to note:

1). With the exception of HTML Tidy and Java, the rest of my script seems to be usable on Ubuntu Linux (specifically Edubuntu). If you attempt to use "Tidy" or "Jar" it will prompt you with the commands necessary to download their related packages.

2). Landon Fuller has ported Java 6 over to OS X 10.4 and 10.5 (64-bit). You can get it as source code or as a compiled application. Unfortunately, the hooks that link Java to OS X's Cocoa interface are not extant (i.e. no OS X GUI).

------------

Mass Effect -- My Thoughts

My "review" of Mass Effect starts before I even purchased the game, which is noticably odd. Shortly after Mass Effect went "gold", I made the sojourn to my local video game trader to trade in Viva Piñata for a "pre-book" on Mass Effect. Given that I have been keeping up on Mass Effect related news, I knew that they were making a limited edition of it available and so I told the clerk to put my money on that. He gave me a completely nonplussed look, spent the next 3 minutes searching his system, and finally said that he had no idea what I was talking about. I made certian to confirm that my money was transferable to the Limited Edition if it became available (it was) and put my money down.

The day of the release, I called that game store and they still had no idea what I was talking about. I visited just about every retailer of video games in my area to find the limited edition and most of them were just as dumbfounded. Oddly enough, the only store that had any clue about the Limited Edtion was Best Buy but they only had it available as a web order. (Just a shout out to Bioware on their outstanding efforts to completely piss off a fan by so restricting the Limited Edition as to make it impossible to find.) Having been completely stymied in my efforts to acquire the Mass Effect: Limited Edition, I went back to the company that held my pre-book and picked up the game.

Ok, scrap all of that... This blog post on "Magical Wasteland" mostly sums up what I didn't take the time to write and does it with much more panache and I could muster.

Nov. 18th, 2007

Mirror

The more complex it becomes the simpler it is...

The following shell script is the evolution of my previous scripting attempt. It combines "HTML Tidy" with the necessary Jar making facilities for what I do with Anathema and Yushan.

This script itself has gone through many different revisions to get to this point and still is not yet "complete". I would like to add the ability to find the plug-in directory and to store it as a configuration file. I have attempted that through a find for "plugin-fragment.xml" but it seems that TextWrangler keeps file of that name as a pointer to recently used files and it's the first one in the list. Oh, well a task for another day.

anathemaTool.sh


#!/bin/bash

######################
## global constants ##
######################

anathemaLog=$HOME/Library/Logs/anathemaTool.log ; # Sets default $USER log location in OS X.
anathemaHome=$HOME/Documents/Development/Anathema ; # Sets default repository for plugin directories.
tidyConfiguration=$( mktemp /tmp/anathema.tidy.XXXXXX ) ; # Sets tidy configuration file name.

####################
## make main menu ##
####################

function makeMainMenu {
clear ;
echo "\n" ;
echo "\n" ;
echo "###########################" ;
echo "A.) About Anathema Tool..." ;
echo "L.) License Information..." ;
echo "1.) Tidy up your XML." ;
echo "2.) Create a JAR file." ;
echo "Q.) Quit Anathema Tool" ;
echo "###########################" ;
echo "\n" ;
echo "\n" ;
read -p "Which option do you need? (A, L, 1, 2 or Q): " selectOption ;
case "$selectOption" in
"a" | "A" )
echo "Displaying information \"About\" this script." >> $anathemaLog ;
aboutAnathemaTool ;
;;
"l" | "L" )
echo "Displaying \"Licensing\" information about this script." >> $anathemaLog ;
licenseInformationText ;
;;
"1" )
echo "Starting Tidy function.\n" >> $anathemaLog ;
tidyUpXML ;
;;
"2" )
echo "Starting Jar making function.\n" >> $anathemaLog ;
makePluginJar ;
;;
* )
echo "Removing Tidy configuration: $tidyConfiguration ." >> $anathemaLog ;
rm -f $tidyConfiguration ;
echo "Exiting $0 ." >> $anathemaLog ;
exit 0;
;;
esac
}

############################
## why i made this script ##
############################

function aboutAnathemaTool {
echo "This tool is designed to facilitate my work creating plug-ins for Anathema. It takes\na series of tasks that used to take 10+ minutes with 2 different operating systems to\na minute (or less) and just one operating system. \n\nThis tool is designed to work on OS X 10.5 \"Leopard\" without needing to have any \nadditional software installed. It may also work on other systems with some small \nmodifications, like the installation of GNU's \"ClassPath\" or Sun's \"Java Development \nKit\" programs. \n\nFeel free to modify this script to add any capabilities that you require.\n\nPress \"Q\" to continue." | less ;
makeMainMenu ;
}

#####################################
## display license text for script ##
#####################################

function licenseInformationText {
echo "anathemaTool.sh - An plug-in creation tool for Anathema. \nCopyright (C) 2007 Paul R. Adams (pauladams@hotmail.com)\nThis program is free software; you can redistribute it and/or modify \nit under the terms of the GNU General Public License as published by \nthe Free Software Foundation; either version 2 of the License, or \n(at your option) any later version. \n\nThis program is distributed in the hope that it will be useful, \nbut WITHOUT ANY WARRANTY; without even the implied warranty of \nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \nGNU General Public License for more details. \n\nYou should have received a copy of the GNU General Public License \nalong with this program; if not, write to the Free Software \nFoundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n\nPress \"Q\" to continue." | less ;
makeMainMenu ;
}

######################################
## test existence of directory name ##
######################################

function testDirectoryExistence {
if [ -z $pluginDirectory ] ; then
read -p "Please enter the directory containing the plug-in files: " pluginDirectory ;
fi
echo "Searching for plug-in directory: $anathemaHome/$pluginDirectory ." >> $anathemaLog ;
if [ -d $pluginDirectory ] ; then
echo "Directory \"$pluginDirectory\" has been found. Returning control to calling function.\n" >> $anathemaLog ;
return 0 ;
else
local noDirectory ;
echo "Directory \"$pluginDirectory\" does not exist. " >> $anathemaLog ;
read -p "The \"$pluginDirectory\" directory does not exist. Try again? (y/n) " noDirectory ;
if [ $( echo $noDirectory | tr Y y ) == "y" ] ; then
read -p "Please re-enter the directory containing the plug-in files: " pluginDirectory ;
testDirectoryExistence ;
else
pluginDirectory="" ;
return 1 ;
fi
fi
}

##############################
## tidy xml nested function ##
##############################

function tidyUpXML {
function compareTidyConfiguration {
local existingConfiguration ;
existingConfiguration="$( cat $tidyConfiguration )" ;
echo "Comparing Tidy configuration in file $tidyConfiguration to defaults." >> $anathemaLog ;
if [ "$existingConfiguration" == "$(echo "indent: auto\nindent-spaces: 5\nlanguage: en-US\nnewline: CRLF\noutput-encoding: utf8\nwrap: 0\nadd-xml-decl: yes\ninput-encoding: utf8\ninput-xml: yes\noutput-xml: yes")" ] ; then
echo "Tidy configuration match confirmed, running Tidy." >> $anathemaLog ;
runXMLTidy ;
else
echo "Tidy configuration does not match or is blank, must replace file. " >> $anathemaLog ;
writeTidyConfiguration ;
fi
}
function writeTidyConfiguration {
echo "Writing Tidy configuration file to: $( basename $tidyConfiguration ) ." >> $anathemaLog ;
echo "indent: auto\nindent-spaces: 5\nlanguage: en-US\nnewline: CRLF\noutput-encoding: utf8\nwrap: 0\nadd-xml-decl: yes\ninput-encoding: utf8\ninput-xml: yes\noutput-xml: yes" > $tidyConfiguration ;
runXMLTidy ;
}
function runXMLTidy {
echo "#### XML Tidy ####\n" >> $anathemaLog ;
tidy -m -config $tidyConfiguration $( find $pluginDirectory -type f -name *.xml ) >> $anathemaLog 2>&1 ;
echo "\n##################" >> $anathemaLog ;
}

testDirectoryExistence ;
if [ ! -z "$pluginDirectory" ] ; then
compareTidyConfiguration ;
fi
pluginDirectory="" ;
echo "Returning to main menu.\n" >> $anathemaLog ;
makeMainMenu ;
}

################################
## jar making nested function ##
################################

function makePluginJar {
function testJarExistence {
if [ ! -f $pluginDirectory.jar ] ; then
makeJarFile ;
else
echo "Existing plug-in JAR detected at: $anathemaHome/$pluginDirectory.jar ." >> $anathemaLog ;
local overwriteJar ;
read -p "\"$pluginDirectory.jar\" already exists. Overwrite? (y/n) " overwriteJar ;
if [ $( echo $overwriteJar | tr Y y ) == "y" ] ; then
echo "Approval given to overwrite: $pluginDirectory.jar ." >> $anathemaLog ;
rm -f $pluginDirectory.jar ;
testJarExistence ;
else
echo "Denied permission to overwrite: $pluginDirectory.jar ." >> $anathemaLog ;
return 1 ;
fi
fi
}
function makeJarFile {
temporaryDirectory=$( mktemp -d /tmp/plugin.XXXXXX ) ;
echo "Copying plug-in to temporary directory: $temporaryDirectory " >> $anathemaLog ;
cp -R $pluginDirectory $temporaryDirectory ;
echo "Removing SubVersioN meta-data from: $( basename $temporaryDirectory)." >> $anathemaLog ;
rm -rf $( find $temporaryDirectory -type d -name .svn ) ;
echo "Removing OS X meta-data from: $( basename $temporaryDirectory)." >> $anathemaLog ;
rm -f $( find $temporaryDirectory -type f -name .DS_Store ) ;
echo "Creating JAR and moving to: $anathemaHome/$pluginDirectory.jar ." >> $anathemaLog ;
$( cd $temporaryDirectory ; cd $pluginDirectory; jar cf $anathemaHome/$pluginDirectory.jar * ) ;
echo "Removing temporary directory: $temporaryDirectory" >> $anathemaLog ;
rm -rdf $temporaryDirectory ;
open -g $anathemaHome ;
}

testDirectoryExistence ;
if [ ! -z "$pluginDirectory" ] ; then
testJarExistence ;
fi
pluginDirectory=""
echo "Returning to main menu.\n" >> $anathemaLog ;
makeMainMenu ;
}

echo "" > $anathemaLog ;
cd $anathemaHome ;
echo "Starting main menu." >> $anathemaLog ;
makeMainMenu ;


Now to post it to Yushan.

UPDATE: Fixed typo with makeMainMenu (Quite -> Quit).

Advertisement

Customize