Auto-Updating the UcompOS Portal

As you know, at the Downloads portion of the UcompOS Project site, you can download the UcompOS Developers Package which contains the UcompOS Portal run-time, as well as the UcompOS SDK for JavaScript, Flash/Flex, and AIR 2.0.

This enables you to host a full UcompOS implementation on your local workstation for testing and development, or to host a public UcompOS implementation from your own webservers.

With the UcompOS project being updated frequently, the physical process of updating the UcompOS RPF and its associated components can be tedious.

There are ways you can automate the process, but it requires some simple scripting that can be accomplished in a variety of languages.

There are some static URLs to know about first of all.

The latest release of the UcompOS Developers package is always found at a URL of http://ucompos.ucompass.com/UcompOS.zip.  That zip package expands into a folder named bin-release and within that folder are the contents of the UcompOS Portal.  Also inside that folder is a file UcompOSSDK.zip which expands into an sdk folder, inside of which are an html, air, and flashOrFlex folder with each of the three respective SDKs for those different platforms.

In my current large scale UcompOS implementation, what I am doing is setting it up so that I have one and only one copy of the different SDK files  – UcompOSSDK.swc (Flash/Flex), UcompOSSDKAIR.swc (AIR), and UcompOSSDK.js and UcompOSSDK.swf (JavaScript).

I then establish relative symlinks to the various locations on my local file system where those files need to be placed – libs folders in Flex projects and root webserver paths for JavaScript applications.  For Flash applications I simply embed the UcompOSSDK.swc file from the singular location where the file exists on my workstation.

As far as updating the UcompOS Portal, the developers package bin-release folder contains a simple XML file named release.xml.

This is what the current one looks like as of this morning:

<release>
     <portal>
          <version>0.4.5</version>
          <packaged>Tue Mar 23 08:47:44 2010</packaged>
     </portal>
     <sdk>
          <version>0.4.5</version>
          <packaged>Tue Mar 23 02:02:53 2010</packaged>
     </sdk>
</release>

Also, a file exists at the URL http://ucompos.ucompass.com/release.xml of the same format which you can test against to determine if you are running the same version of the UcompOS Portal or if there is an update available.

Note there IS an SVN Repository for the UcompOS Project but at this time it is just meant as a means to distribute the UcompOS SDK source code. Eventually, I plan to make all of the UcompOS RPF project open source and there will be a model for accessing the full source code of all the associated UcompOS technologies and you’d be able to structure your updates according to check-outs from SVN. (My timeline for this by the way is to coincide the open-sourcing of the UcompOS Portal with the production 1.0 release of the UcompOS RPF which I am trying to coincide with Adobe MAX 2010 in October).

In the meantime, there are still a number of simple ways you can go about coordinating an auto-update.

Below is a very simple PERL script I wrote that auto-updates the UcompOS Portal in my Educator 2 project:

#!/usr/local/bin/perl
 
use strict;
 
use LWP::Simple;
use XML::LibXML;
 
my $myVersion;
if(!-e "../../frontend/release.xml")
{
	$myVersion = 0;
}
else
{
	open(FILE,"../../frontend/release.xml");
	my @line = <FILE>;
	close(FILE);
 
	my $myReleaseInfo = join("",@line);
	$myVersion = getVersion($myReleaseInfo);
 
 
}
 
my $latestVersion = getVersion(get("http://ucompos.ucompass.com/release.xml"));
 
if($myVersion ne $latestVersion)
{
	update();
}
 
sub getTextNode {
 
	my $thisNode = $_[0];
	my @thisChild = $thisNode->getChildNodes;
	my $textNode;
	eval {
		$textNode = $thisChild[0]->getNodeValue;
	};
 
	if(!$textNode) {
		eval {
		$textNode = $thisChild[0]->nodeValue;
		};
	}
 
	return $textNode;
 
}
 
sub getVersion
{
	my $releaseInfo = $_[0];
	my $xml = XML::LibXML->new;
	my $string = $xml->parse_string($releaseInfo);
	my $xp = XML::LibXML::XPathContext->new($string);
	my @nodeSet = $xp->findnodes('//portal/version');
	my $version = getTextNode($nodeSet[0]);
	return $version;
}
 
sub update
{
 
	chdir('cache');
	my $content = get("http://ucompos.ucompass.com/UcompOS.zip");
	open(FILE,">UcompOS.zip");
	print FILE $content;
	close(FILE);
 
	system("unzip -qq 'UcompOS.zip'");
	unlink("UcompOS.zip");
	system("rsync -a --delete --exclude=\"LocalLib.js\" --exclude=\"styles.css\" bin-release ../../../frontend");
	system("\\rm -rf bin-release");
 
}

In my example above, I basically have my UcompOS Portal code housed in a bin-release folder. I check the latest release version and see if it matches my local version, and if it doesn’t, I retrieve the latest package, unzip it, and overwrite my existing copy with rsync excluding the LocalLib.js and styles.css files – which are the only files in the UcompOS Developers package you would typically need to update with your own implementation specific information.

About Edward Mansouri
Edward Mansouri is the CEO and Founder of Ucompass.com, Inc., a company focused on building scalable and profitable e-Learning enterprises. His expertise is in building e-Learning software, as well as in building visual frameworks such as the Enrich Content Enrichment System and the newly announced UcompOS Rich Experience Framework. He has been working with Flash since 1998, building Flash applications since 2002, and working with Adobe AIR since its private alpha release in 2006. He authored the site AIRApps.net (later renamed to O2Apps.com) dedicated to providing leadership in building Adobe AIR applications. In 2010, he is building and releasing a new e-Learning platform called Educator 2 which is built entirely upon the UcompOS Rich Experience Framework. Since 1999, over 1,000,000 students have taken courses served with his original e-Learning platform, Educator 1.

Comments are closed.