The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Update Tool split out

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Update Tool split out Posted: Aug 3, 2004 10:02 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Update Tool split out
Feed Title: Cincom Smalltalk Blog - Smalltalk with Rants
Feed URL: http://www.cincomsmalltalk.com/rssBlog/rssBlogView.xml
Feed Description: James Robertson comments on Cincom Smalltalk, the Smalltalk development community, and IT trends and issues in general.
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Cincom Smalltalk Blog - Smalltalk with Rants

Advertisement

The other day, Ralph asked me about the upgrade tool in BottomFeeder. Well, until this evening it had mostly been a component piece of Bf, not easily reusable elsewhere. I think I've fixed that. I just spent some time refactoring the tool and splitting it out of the bf bundle (which makes it entirely possible that the upgrade tool will be used to upgrade itself sometime. Such is Smalltalk :) ). The code is in the public store as PatchFileDelivery.

One thing you'll notice is the existence of PatchManager and PatchManagerUI, which I don't really use. That's an artifact of the way I used to deliver bf updates. The more current classes of interest are UpgradeManager and UpgradeManagerUI. Here's how I use them:

First, I set up an XML Manifest file on the server. I use the XML Configuration Files package in the public store for that:


defs := OrderedCollection new.
list := #('dev\Emote-Support.pcl' 'dev\ExtraEmphases.pcl' 'dev\VRCommonDialogs.pcl' 'dev\Http-Access.pcl' 'dev\PatchFileDelivery.pcl' 'dev\Browsing-Assist.pcl' 'dev\OSTimeZone.pcl' 'dev\XmlRpcClient.pcl' 'dev\XML-Configuration-Files.pcl' 'dev\BottomFeeder.pcl' 'dev\TwoflowerBundle.pcl' 'IRC-BottomFeeder-Plugin.pcl' 'Pongo.pcl' 'Blog-Tools.pcl'  'WinMineGame.pcl').
names := #('Base Component, Icon Support' 'Base Component, Font Support' 'Base Component, Dialog Support' 'Base Component, Http Support' 'Upgrade Tools Support'  'Base Component, Browser Support' 'Base Component, Local Time Support' 'Base Component, XML-RPC Support' 'Base Component, Upgrade System Support' 'Base Component, Main Application' 'Base Component, HTML Browsing Support' 'Plugin, IRC Client' 'Plugin, MSN IM Client' 'Plugin, Blog Posting Tool' 'Plugin, Minesweeper Game' ).
descripts := #('' '' '' 'encoding priority fix' 'Refactored Patch File Code' '' '' '' '' 'remote browsing includes top 5 items' 'encoding changes' 'Fix for settings reading problem' '' 'preview load could fail, fixed' '').
sizes := list collect: [:each | each asFilename fileSize]. 
allows := #(true true true true true true true true true true true true true true true ).
list do: [:each | | version nm timestamp properties index |
	properties := [CodeReader new readInfoFromFileNamed: each] 
				on: OsError, CodeReader fileFormatSignal
				do: [:ex | ex return: Dictionary new].
	version := properties at: #version.
	nm := properties at: #parcel.
	timestamp := properties at: #timestamp.
	index := list indexOf: each.
	comp := ComponentDefinition
		parcelName: nm
		parcelFilename: (each asFilename tail asString)
		version: version
		releaseDate: timestamp
		descriptiveName: (names at: index).
	comp description: (descripts at: index).
	comp fileSize: (sizes at: index).
	comp allowDynamicLoad: (allows at: index).
	defs add: comp].
(defs at: 12) isPlugin: true.
(defs at: 13) isPlugin: true.
(defs at: 14) isPlugin: true.
defs last isPlugin: true.


"now save it"
file := Tools.XMLConfigFileSupport.XMLConfigFile filename: 'upgradeBtf.xml'.
file saveObject: defs.
file saveConfiguration.

That saves a configuratioin file to disk - the plugins/main components thing is Bf specific, but it's not really essential to the package. To open the UI and check for upgrades, this is all you need to do:


	loader := Patch.UpgradeManagerUI new.
	loader viewer: self.
	Cursor wait showWhile: [loader doUpgradeCheck].
	loader open

Of course, to specify where the upgrade information lives, you need a settings file that looks like this:


[Settings]
patchSiteUrl='http://localhost/patches/'
patchSiteFilename='patches.xml'
patchDir='patches'
saveDir='app'
upgradeURL='http://localhost/upgrades/'
upgradeFilename='upgrades.xml'
version='1.0'
isOnline=true

By default, the code will look for a file called 'patches.ini'. You can also hand the manager object (the domain underneath the UI) settings in code; there's an API for that. That's pretty much it; Assuming that you have Http access to the remote server, you now have patch file delivery.

Read: Update Tool split out

Topic: On updating Previous Topic   Next Topic Topic: How To Create A Custom Widget - Introduction

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use