A new version of Packages-Core was added to project Packages: http://www.squeaksource.com/Packages/Packages-Core-kph.52.mcz
==================== Summary ====================
Name: Packages-Core-kph.52 Author: kph Time: 18 August 2008, 1:19:20 am UUID: c01e4939-5ae1-48f9-aae3-31d2623c4236 Ancestors: Packages-Core-kph.51
Added default action which uses the url form the metadata.
This reduces the number of arbitrary scripts and makes things essentially data driven.
=============== Diff against Packages-Core-kph.51 ===============
Item was added: + ----- Method: Packages>>isUnloading (in category 'as yet unclassified') ----- + isUnloading + + ^ isUnload = true!
Item was changed: SakeTask subclass: #Packages + instanceVariableNames: 'unloadBlock unloadPriors provides name version isUnload' - instanceVariableNames: 'unloadBlock unloadPriors provides name version' classVariableNames: 'Provided' poolDictionaries: '' category: 'Packages-Core'! Packages class instanceVariableNames: 'lastUpdate theUUniverse'!
!Packages commentStamp: 'kph 5/16/2008 01:40' prior: 0! To generate all of the methods based upon universes definitions: Packages taskGenerateAllUniverses run. or Packages taskGenerateAll run.
Sake/Packages usage:
Public API ============ "load package definition for your current version of Squeak" Packages current load: 'Seaside'. Packages beta named: 'Seaside'.
or
(Packages current named: 'Seaside') run. " or runQuietly, runStepping, runLogging" (Packages beta named: 'Seaside') run.
multiples:
Packages current load: #('Seaside' 'Magma' 'Logging')
Run-variants =========
#runStepping , - presents a confirm/debug dialog before each action. #run - default. #runQuietly - auto-confirms any SakeConfirm dialogs. #runLogging - Writes any SakeStop warnings to self log.
Unloading ======== Unloading comes in two variants.
Each package task loaded by Sake/Packages is remembered in the 'provided' list If you perform:
Packages unload: 'Seaside' .
Packages unloadStepping: 'Seaside' .
Then the 'historical' unload scripts are used, as defined when the original load tasks were run.
If instead you perform:
(Packages current named: 'Seaside') unload runStepping.
Then the most recently defined unload script will be run.
Note: If packages such as "Magma server" and "Magma client" provides "Magma", then
Packages unload: 'Magma'.
Will unload whichever of the two are loaded. === Misc notes...
Universes are using 'instance side' task definition, so the task extensions mechanism does not work in this context.
!
Item was added: + ----- Method: Packages>>dependsOn (in category 'as yet unclassified') ----- + dependsOn + + self isUnloading ifFalse: [ ^ super dependsOn ]. + + unloadPriors ifNil: [ self unloadDependsOn: self loadedDependantsUnloadTasks ]. + + ^ unloadPriors!
Item was added: + ----- Method: Packages>>doActionStep (in category 'as yet unclassified') ----- + doActionStep + + self isUnloading + ifTrue: [ self step: 'Confirm unload: ', self name printString ] + ifFalse: [ self step: 'Confirm load: ', self name printString ]!
Item was added: + ----- Method: Packages>>defaultUnloadAction (in category 'as yet unclassified') ----- + defaultUnloadAction + + self info url ifNotNil: [ Installer mc unload: self name ]!
Item was added: + ----- Method: Packages>>loadedDependantsUnloadTasks (in category 'as yet unclassified') ----- + loadedDependantsUnloadTasks + + "if the task is the provided one, then we return the provided dependants." + + self loadedDependants in: [ :deps | + + deps ifEmpty: [ ^ #() ]. + + ^ (self class provided at: self name ifAbsent: nil) == self + ifTrue: [ (deps collect: [ :ea | ea copy beUnloading ]) ] + ifFalse: [ (deps collect: [ : ea | (self class named: ea name) beUnloading ]) ] + ].!
Item was added: + ----- Method: Packages>>doActionEnd (in category 'as yet unclassified') ----- + doActionEnd + + self isUnloading ifTrue: [ ^ self ]. + + self class provided in: [ :reg | + info := nil. + self provides do: [ :each | reg at: each put: self ]. + ]. + + ^ nil!
Item was added: + ----- Method: Packages>>defaultAction (in category 'as yet unclassified') ----- + defaultAction + + Installer installUrl: self info url!
Item was changed: ----- Method: Packages class>>taskGenerateUniversePackageTasks (in category 'tasks - universes') ----- taskGenerateUniversePackageTasks
| source selector | ^ SakeTask define: [ :task | task dependsOn: { [ self isUniverse ]. self taskUpdateUniverse. self taskRemoveOldPackages. }.
task action: [ (self theUUniverse packageNames collect: [ :each | self theUUniverse newestPackageNamed: each ]) do: [ :each | source := (WriteStream on: String new). source << (selector := self asSelector: each name). source cr; cr. source << ' self name: ' << each name printString << '.' ; cr. source << ' self version: ''' << each version << '''.' ; cr. + source << ' info worksIn: #( ' << self class name << ' )'; cr ; cr. - source << ' info supports: #( ' << self class name << ' )'; cr ; cr. source << ' info category: ''' << each category printString << '''.' ; cr. source << ' info description: ' ; cr. source << each description withSqueakLineEndings printString << '.' ; cr. source << ' info maintainer: ''' << each maintainer << '''.' ; cr. source << ' info homepage: ''' << (each homepage ifNil: ['']) asString << '''.' ; cr. source << ' info squeakMapID: ''' << (each squeakMapID ifNil: ['']) asString << '''.' ; cr. source << ' info url: ''' << each url printString << '''.' ; cr. source << ' self provides: ' << each provides asArray printString << '.' ; cr ; cr. source << ' self dependsOn: ' << each depends asSortedCollection asArray printString << '.' ; cr ; cr. + - source << ' self load: [' ; cr. - - each url ifNotNil: [ - source << ' Installer installUrl:''' << each url printString << '''.' ; cr. - ]. - source << ' ].' ; cr ; cr. - "source << ' self unloadDependsOn: { self taskUnloadDependants }.' ; cr." - source << ' self unload: [' ; cr. - each url ifNotNil: [ - source << ' Installer mc unload: ' << each name printString << '.' ; cr. - ]. - source << ' ].'. - (self sourceCodeAt: selector ifAbsent: nil) ~= source contents ifTrue: [ self compile: source contents classified: each category printString notifying: nil ] ]. theUUniverse := nil. ]. ]!
Item was changed: ----- Method: Packages>>beUnloading (in category 'as yet unclassified') ----- beUnloading
+ isUnload := true. - actionBlock := unloadBlock. - - (unloadPriors ifNil: [ self unloadDependsOn: (Array with: self taskUnloadDependants) ]). - - priors := unloadPriors. - hasRun := false.!
Item was added: + ----- Method: Packages>>action (in category 'as yet unclassified') ----- + action + + self isUnloading + ifTrue: [ unloadBlock ifNil: [ [ self defaultUnloadAction ] ] ] + ifFalse: [ super action ].!
Item was removed: - ----- Method: Packages>>doAction (in category 'as yet unclassified') ----- - doAction - - actionBlock == unloadBlock - ifTrue: [ self step: 'Confirm unload: ', self name printString ] - ifFalse: [ self step: 'Confirm load: ', self name printString ]. - - actionBlock value. - - self class provided in: [ :reg | - info := nil. - self provides do: [ :each | reg at: each put: self ]. - ]. - - ^ nil!
Item was removed: - ----- Method: Packages>>taskUnloadDependants (in category 'as yet unclassified') ----- - taskUnloadDependants - - "if the task is the provided one, then we return the provided dependants." - - self loadedDependants in: [ :deps | - - deps ifEmpty: [ ^ nil ]. - - ^ (self class provided at: self name ifAbsent: nil) == self - ifTrue: [ (deps collect: [ :ea | ea copy beUnloading ]) asTask ] - ifFalse: [ (deps collect: [ : ea | (self class named: ea name) beUnloading ]) asTask ] - ].!
packages@lists.squeakfoundation.org