4.4.3 Packages

Q How do I create a SqueakSource project?
  1. go to squeaksource.com
  2. register yourself as a new member
  3. register a project (name = category)
  4. copy the Registration code snippet
  5. open>Monticello browser
  6. +Package to add the category
  7. Select the package
  8. +Repository>HTTP
  9. paste and accept the Registration code snippet; enter your password
  10. Save to save the first version
Q How do I load a Squeaksource project?
  1. Find the project in squeaksource
  2. Copy the Registration code snippet
  3. open>Monticello browser
  4. +Repository>HTTP
  5. paste and accept the Registration code snippet; enter your password
  6. select the new repository and Open it
  7. Select and load the latest version
Q How do I programmatically load projects from SqueakSource?
| 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?
  1. Start a pharo-dev image with the latest refactoring Browser code in it.
  2. Select your package in the OB class or package browser.
  3. Select open environment > package [opens a package browser]
  4. 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?
| pkg |
pkg := PackageInfo named: 'Saphir'.
pkg classes do: [:class | class category: 'Coral' ].
pkg methods collect: [:method |
	method actualClass organization
		classify: method methodSymbol
		under: #'*coral' ]

User Contributed Notes

renggli (20 December 2011, 10:37 am)

The answer to "How do I programmatically load projects from SqueakSource?" is outdated since Pharo 1.1. More concise is:


Gofer new

       squeaksource: 'DaliotsPlayground';

       package: 'Ameba';


Add a Note

Licensed under Creative Commons BY-NC-SA | Published using Pier |