SystemOrganization addCategory: #PersephoneLoader! Object subclass: #PersephoneLoader instanceVariableNames: 'username password' classVariableNames: '' poolDictionaries: '' category: 'PersephoneLoader'! !PersephoneLoader commentStamp: 'md 3/21/2007 12:11' prior: 0! Loads Persephone and the required packages into your image. Usage: PersephoneLoader new loadPackages Requirements: Squeak 3.9! !PersephoneLoader methodsFor: 'initialize-release' stamp: 'pmm 6/27/2006 23:12'! askFor: aString | answer | answer := ''. [ answer isEmptyOrNil ] whileTrue: [ answer := FillInTheBlank request: aString ]. ^answer! ! !PersephoneLoader methodsFor: 'initialize-release' stamp: 'pmm 6/27/2006 23:13'! askForPassword username := self askFor: 'Please enter your SqueakSource username'. password := self askFor: 'Please enter your SqueakSource password'.! ! !PersephoneLoader methodsFor: 'initialize-release' stamp: 'pmm 6/27/2006 23:13'! discoverPassword | repositories repository | repositories := MCRepositoryGroup default repositories select: [ :each | (each isKindOf: MCHttpRepository) and: [ each locationWithTrailingSlash includesSubString: 'squeaksource.com' ] ]. repository := repositories detect: [ :each | each user isEmptyOrNil not and: [ each password isEmptyOrNil not ] ] ifNone: [ ^self askForPassword ]. password := repository password. username := repository user.! ! !PersephoneLoader methodsFor: 'initialize-release' stamp: 'pmm 6/27/2006 23:14'! initialize super initialize. self discoverPassword! ! !PersephoneLoader methodsFor: 'loading' stamp: 'pmm 8/20/2006 10:09'! loadLatestPackage: aString from: aPath | repository versionsBlock versions tries version | repository := MCHttpRepository location: aPath user: username password: password. versionsBlock := [ (repository allVersionNames select: [ :each | each beginsWith: aString ]) asSortedCollection: [ :a :b | (a copyAfterLast: $.) asNumber <= (b copyAfterLast: $.) asNumber ] ] fixTemps. versions := versionsBlock value. tries := 0. [ versions isEmpty and: [ tries < 3 ] ] whileTrue: [ versions := versionsBlock value. tries := tries + 1 ]. versions isEmpty ifTrue: [ self error: 'problems when accessing squeaksource' ]. version := (repository versionReaderForFileNamed: versions last , '.mcz') version. version load. version workingCopy repositoryGroup addRepository: repository. "version workingCopy modified: false"! ! !PersephoneLoader methodsFor: 'loading' stamp: 'md 4/6/2007 21:38'! loadPackages self loadLatestPackage: 'AST-' from: 'http://www.squeaksource.com/AST/'. self loadLatestPackage: 'RefactoringEngine-' from: 'http://www.squeaksource.com/RefactoringEngine/'. self loadLatestPackage: 'SmaCC-' from: 'http://www.squeaksource.com/SmaccDevelopment/'. self loadLatestPackage: 'NewCompiler-' from: 'http://www.squeaksource.com/NewCompiler/'. self loadLatestPackage: 'Persephone' from: 'http://www.squeaksource.com/Persephone/'. Preferences setPreference: #compileUseNewCompiler toValue: true. Preferences setPreference: #compileReflectiveMethods toValue: true. "self loadLatestPackage: 'JCompiledMethodsTest-' from: 'http://www.squeaksource.com/JCompiledMethods/'."! !