4.4.3 Packages
- Q How do I create a SqueakSource project?
- A
- go to squeaksource.com
- register yourself as a new member
- register a project (name = category)
- copy the Registration code snippet
- open>Monticello browser
- +Package to add the category
- Select the package
- +Repository>HTTP
- paste and accept the Registration code snippet; enter your password
- Save to save the first version
- Q How do I load a Squeaksource project?
- A
- Find the project in squeaksource
- Copy the Registration code snippet
- open>Monticello browser
- +Repository>HTTP
- paste and accept the Registration code snippet; enter your password
- select the new repository and Open it
- Select and load the latest version
- Q How do I programmatically load projects from SqueakSource?
- A
| mc fileToLoad version |
mc := Smalltalk at: #MCHttpRepository
ifPresent: [:repoClass |
repoClass location: 'www.squeaksource.com/Installer'
user: 'squeak' password: 'squeak'].
fileToLoad := mc readableFileNames
detect: [ :aFile | aFile beginsWith:'Installer-sd.3' ]
ifNone: [ nil ].
version := mc versionFromFileNamed: fileToLoad.
version workingCopy repositoryGroup addRepository: mc.
mc creationTemplate: mc asCreationTemplate.
version load.
NB: Installer provides a high-level interface to specify load scripts.
- Q What do I do when the Installer complains that the Universe code is not there?
- A Run:
ScriptLoader new installingUniverse
- Q How do I define extension methods?
- A Suppose you want to extend Number with
Number>>chf
but have Monticello recognize it as being part of my Money package.
Put it in a method-category named *money
. MC gathers all extension methods that are in categories named like *package
.
- Q How do I run Code critics on a package?
- A
- Start a pharo-dev image with the latest refactoring Browser code in it.
- Select your package in the OB class or package browser.
- Select open environment > package [opens a package browser]
- Select open > Code Critics
If you directly open code critics, it will analyze the whole smalltalk system!
- Q How do I move all classes and extension methods from one package to another?
- A
| pkg | pkg := PackageInfo named: 'Saphir'. pkg classes do: [:class | class category: 'Coral' ]. pkg methods collect: [:method | method actualClass organization classify: method methodSymbol under: #'*coral' ]