The Trunk: SMBase-bf.133.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: SMBase-bf.133.mcz

commits-2
Bert Freudenberg uploaded a new version of SMBase to project The Trunk:
http://source.squeak.org/trunk/SMBase-bf.133.mcz

==================== Summary ====================

Name: SMBase-bf.133
Author: bf
Time: 8 December 2014, 1:59:49.419 am
UUID: 6561d5c0-abd2-4521-ab54-656fdf9fab4b
Ancestors: SMBase-nice.132

Restore timestamps lost in assignment conversion.

=============== Diff against SMBase-nice.132 ===============

Item was changed:
  ----- Method: ImageSegment>>writeForExportOn: (in category '*SMBase-export') -----
  writeForExportOn: fileStream
  "Write the segment on the disk with all info needed to reconstruct it in a new image.  For export.  Out pointers are encoded as normal objects on the disk."
 
  | temp |
  state = #activeCopy ifFalse: [self error: 'wrong state'].
  temp := endMarker.
  endMarker := nil.
  fileStream fileOutClass: nil andObject: self.
  "remember extra structures.  Note class names."
  endMarker := temp.
  !

Item was changed:
  ----- Method: RcsDiff>>commandLines: (in category 'accessing') -----
  commandLines: aString
  commandLines := aString!

Item was changed:
  ----- Method: SMAccount>>advogatoId: (in category 'accessing') -----
  advogatoId: aString
  advogatoId := aString!

Item was changed:
  ----- Method: SMAccount>>correctPassword: (in category 'passwords') -----
  correctPassword: aPassword
  "We store the password as a SHA hash so that we can let the slave maps
  have them too. Also check the optional new random password."
 
  | try |
  aPassword isEmptyOrNil ifTrue:[^false].
  try := SecureHashAlgorithm new hashMessage: aPassword.
  ^password = try or: [newPassword = try]!

Item was changed:
  ----- Method: SMAccount>>deleteFiles: (in category 'files') -----
  deleteFiles: fileNames
  "Delete all fileNames from the uploads directory."
 
  | dir |
  dir := self uploadsDirectory.
  fileNames do: [:fn | dir deleteFileNamed: fn]
  !

Item was changed:
  ----- Method: SMAccount>>directory (in category 'files') -----
  directory
  "Get the directory for the account."
 
  | dir |
  dir := (map directory directoryNamed: 'accounts') assureExistence; yourself.
  ^(dir directoryNamed: id asString) assureExistence; yourself
  !

Item was changed:
  ----- Method: SMAccount>>email: (in category 'accessing') -----
  email: address
  email := address!

Item was changed:
  ----- Method: SMAccount>>initialize (in category 'initialize-release') -----
  initialize
  "Initialize account."
 
  super initialize.
  initials := signature := advogatoId := ''.
  isAdmin := false.
  objects := OrderedCollection new.
  coObjects := OrderedCollection new!

Item was changed:
  ----- Method: SMAccount>>initials: (in category 'accessing') -----
  initials: aString
  "If these are changed we need to update the dictionary in the map."
 
  initials ~= aString ifTrue: [
  initials := aString.
  map clearUsernames]!

Item was changed:
  ----- Method: SMAccount>>isAdmin: (in category 'accessing') -----
  isAdmin: aBoolean
  isAdmin := aBoolean!

Item was changed:
  ----- Method: SMAccount>>newPassword: (in category 'accessing') -----
  newPassword: aHashNumber
  "Set the parallell password hash."
 
  newPassword := aHashNumber!

Item was changed:
  ----- Method: SMAccount>>password: (in category 'accessing') -----
  password: aHashNumber
  "Set the password hash."
 
  password := aHashNumber!

Item was changed:
  ----- Method: SMAccount>>setNewPassword: (in category 'passwords') -----
  setNewPassword: aString
  "Set a new parallell password the user can use to get in
  if the old password is forgotten. We don't delete the old
  password since the request for this new password is made
  anonymously. Note that the password is stored as a secured
  hash large integer."
 
  newPassword := SecureHashAlgorithm new hashMessage: aString!

Item was changed:
  ----- Method: SMAccount>>setPassword: (in category 'passwords') -----
  setPassword: aString
  "We also clear the random extra password."
 
  password := SecureHashAlgorithm new hashMessage: aString.
  newPassword := nil!

Item was changed:
  ----- Method: SMAccount>>signature: (in category 'accessing') -----
  signature: aSignature
  "Set the signature."
 
  signature := aSignature!

Item was changed:
  ----- Method: SMCategorizableObject>>addCategory: (in category 'private') -----
  addCategory: aCategory
  "Add <aCategory> to me. If I already have it do nothing."
 
  categories ifNil: [categories := OrderedCollection new].
  (categories includes: aCategory) ifFalse:[
  aCategory addObject: self.
  categories add: aCategory].
  ^aCategory!

Item was changed:
  ----- Method: SMCategory>>addCategory: (in category 'private') -----
  addCategory: cat
  "Add a category as a subcategory to self.
  The collection of subcategories is lazily instantiated."
 
  subCategories ifNil: [subCategories := OrderedCollection new].
  cat parent ifNotNil: [cat parent removeCategory: cat ].
  subCategories add: cat.
  cat parent: self.
  ^cat!

Item was changed:
  ----- Method: SMCategory>>delete (in category 'private') -----
  delete
  "Delete me. Disconnect me from my objects and my parent.
  Then delete my subcategories."
 
  super delete.
  self removeFromObjects; removeFromParent.
  self subCategories do: [:c | c delete ]!

Item was changed:
  ----- Method: SMCategory>>initialize (in category 'initialize-release') -----
  initialize
  super initialize.
  name := summary := url := ''.
  objects := OrderedCollection new!

Item was changed:
  ----- Method: SMCategory>>mandatory: (in category 'accessing') -----
  mandatory: aSet
  mandatory := aSet!

Item was changed:
  ----- Method: SMCategory>>parent: (in category 'private') -----
  parent: aCategory
  "Change the parent category.
  This method relies on that somebody else
  updates the parent's subCategories collection."
 
  parent := aCategory!

Item was changed:
  ----- Method: SMDVSInstaller>>install (in category 'services') -----
  install
  "Install using DVS."
 
  | imagePackageLoader streamPackageLoader packageInfo packageManager baseName current new manager |
  self cache; unpack.
  imagePackageLoader := Smalltalk at: #ImagePackageLoader ifAbsent: [].
  streamPackageLoader := Smalltalk at: #StreamPackageLoader ifAbsent: [].
  packageInfo := Smalltalk at: #PackageInfo ifAbsent: [].
  packageManager := Smalltalk at: #FilePackageManager ifAbsent: [].
 
  ({ imagePackageLoader. streamPackageLoader. packageInfo. packageManager } includes: nil)
  ifTrue: [ (self confirm: ('DVS support is not loaded, but would be helpful in loading ', unpackedFileName, '.
  It isn''t necessary, but if you intend to use DVS later it would be a good idea to load it now.
  Load it from SqueakMap?'))
  ifTrue: [ self class loadDVS. ^self install ]
  ifFalse: [ ^self fileIn ]].
 
  baseName := packageRelease name.
  dir rename: unpackedFileName toBe: (baseName, '.st').
  unpackedFileName := baseName, '.st'.
 
  (manager := packageManager allManagers detect: [ :pm | pm packageName = baseName ] ifNone: [])
  ifNotNil: [
  current := imagePackageLoader new package: (packageInfo named: baseName).
  new := streamPackageLoader new stream: (dir readOnlyFileNamed: unpackedFileName).
  (new changesFromBase: current) fileIn ]
  ifNil: [
  self fileIn.
  manager := packageManager named: baseName. ].
 
  manager directory: dir.
  packageManager changed: #allManagers.
  packageRelease noteInstalled!

Item was changed:
  ----- Method: SMDocument>>author: (in category 'accessing') -----
  author: aString
  author := aString!

Item was changed:
  ----- Method: SMDocument>>description: (in category 'accessing') -----
  description: aString
  description := aString!

Item was changed:
  ----- Method: SMExternalResource>>downloadUrl: (in category 'accessing') -----
  downloadUrl: anUrl
  downloadUrl := anUrl!

Item was changed:
  ----- Method: SMFileCache>>directoryForPackage: (in category 'accessing') -----
  directoryForPackage: aPackage
  "Returns the local path for storing the package cache's package file area.
  This also ensures that the path exists."
 
  | slash path dir |
  slash := FileDirectory slash.
  path := 'packages' , slash , aPackage id asString36 , slash.
  dir := FileDirectory default on: self directory fullName, slash, path.
  dir assureExistence.
  ^dir!

Item was changed:
  ----- Method: SMFileCache>>directoryForPackageRelease: (in category 'accessing') -----
  directoryForPackageRelease: aPackageRelease
  "Returns the local path for storing the package cache's version of a  
  package file. This also ensures that the path exists."
 
  | slash path dir |
  slash := FileDirectory slash.
  path := 'packages' , slash , aPackageRelease package id asString36 , slash , aPackageRelease automaticVersionString.
  dir := FileDirectory default on: self directory fullName, slash, path.
  dir assureExistence.
  ^dir!

Item was changed:
  ----- Method: SMFileCache>>directoryForResource: (in category 'accessing') -----
  directoryForResource: aResource
  "Returns the local path for storing the package cache's version of a  
  resource file. This also ensures that the path exists."
 
  | slash path dir |
  slash := FileDirectory slash.
  path := 'resources' , slash , aResource id asString36.
  dir := FileDirectory default on: self directory fullName, slash, path.
  dir assureExistence.
  ^dir!

Item was changed:
  ----- Method: SMFileCache>>forMap: (in category 'initialize') -----
  forMap: aMap
  "Initialize the ache, make sure the cache dir exists."
 
  map := aMap!

Item was changed:
  ----- Method: SMInstaller class>>classForPackageRelease: (in category 'instance creation') -----
  classForPackageRelease: aPackageRelease
  "Decide which subclass to instantiate.
  We detect and return the first subclass
  that wants to handle the release going
  recursively leaf first so that subclasses gets
  first chance if several classes compete over
  the same packages, like for example SMDVSInstaller
  that also uses the .st file extension."
 
  self subclasses do: [:ea |
  (ea classForPackageRelease: aPackageRelease)
  ifNotNilDo: [:class | ^ class]].
  ^(self canInstall: aPackageRelease)
  ifTrue: [self]!

Item was changed:
  ----- Method: SMInstaller class>>forPackageRelease: (in category 'deprecated') -----
  forPackageRelease: aPackageRelease
  "Instantiate the first class suitable to install the package release.
  If no installer class is found we raise an Error."
 
  | class |
  aPackageRelease ifNil: [self error: 'No package release specified to find installer for.'].
  class := self classForPackageRelease: aPackageRelease.
  ^class
  ifNil: [self error: 'No installer found for package ', aPackageRelease name, '.']
  ifNotNil: [class new packageRelease: aPackageRelease]!

Item was changed:
  ----- Method: SMInstaller>>packageRelease: (in category 'accessing') -----
  packageRelease: aPackageRelease
  packageRelease := aPackageRelease!

Item was changed:
  ----- Method: SMMcInstaller class>>canInstall: (in category 'testing') -----
  canInstall: aPackage
  "Is this a Monticello package and do I have MCInstaller
  or Monticello available?"
 
  | fileName |
  ((Smalltalk includesKey: #MCMczReader) or: [
  Smalltalk includesKey: #MczInstaller])
  ifTrue: [
  fileName := aPackage downloadFileName.
  fileName ifNil: [^false].
  ^ 'mcz' = (FileDirectory extensionFor: fileName) asLowercase].
  ^false!

Item was changed:
  ----- Method: SMMcInstaller>>fileIn (in category 'private') -----
  fileIn
  | extension |
  extension := (FileDirectory extensionFor: fileName) asLowercase.
  extension = 'mcz'
  ifTrue: [self installMcz]
  ifFalse: [self error: 'Cannot install file of type .', extension]!

Item was changed:
  ----- Method: SMObject>>id: (in category 'accessing') -----
  id: anId
  id := anId!

Item was changed:
  ----- Method: SMObject>>initialize (in category 'initialize-release') -----
  initialize
  "Initialize the receiver."
 
  updated := created := TimeStamp current asSeconds.
  name := summary := url := ''.!

Item was changed:
  ----- Method: SMObject>>map: (in category 'accessing') -----
  map: aMap
  map := aMap!

Item was changed:
  ----- Method: SMObject>>map:id: (in category 'initialize-release') -----
  map: aMap id: anId
  "Initialize the receiver."
 
  self initialize.
  map := aMap.
  id := anId!

Item was changed:
  ----- Method: SMObject>>name: (in category 'accessing') -----
  name: aName
  name := aName!

Item was changed:
  ----- Method: SMObject>>stampAsUpdated (in category 'updating') -----
  stampAsUpdated
  "This method should be called whenever the object is modified."
 
  updated := TimeStamp current asSeconds!

Item was changed:
  ----- Method: SMObject>>summary: (in category 'accessing') -----
  summary: aString
  summary := aString!

Item was changed:
  ----- Method: SMObject>>url: (in category 'accessing') -----
  url: aString
  url := aString!

Item was changed:
  ----- Method: SMPackage>>isSafelyOld (in category 'testing') -----
  isSafelyOld
  "Answer if I am installed and there also is a
  newer published version for this version of Squeak available."
 
  | installed |
  installed := self installedRelease.
  ^installed ifNil: [false] ifNotNil: [
  ^(self lastPublishedReleaseForCurrentSystemVersionNewerThan: installed) notNil]!

Item was changed:
  ----- Method: SMPackage>>isSafelyOldAndUpgradeable (in category 'testing') -----
  isSafelyOldAndUpgradeable
  "Answer if I am installed and there also is a
  newer published version for this version of Squeak available
  that can be upgraded to (installer support)."
 
  | installed newRelease |
  installed := self installedRelease.
  ^installed ifNil: [false] ifNotNil: [
  newRelease := self lastPublishedReleaseForCurrentSystemVersionNewerThan: installed.
  ^newRelease ifNil: [false] ifNotNil: [newRelease isUpgradeable]]!

Item was changed:
  ----- Method: SMPackage>>packageInfoName: (in category 'accessing') -----
  packageInfoName: aString
  packageInfoName := aString!

Item was changed:
  ----- Method: SMPackage>>releaseWithId: (in category 'services') -----
  releaseWithId: anIdString
  "Look up a specific package release of mine. Return nil if missing.
  They are few so we just do a #select:."
 
  | anId |
  anId := UUID fromString: anIdString.
  releases detect: [:rel | rel id = anId ].
  ^nil!

Item was changed:
  ----- Method: SMPackage>>upgrade (in category 'installation') -----
  upgrade
  "Upgrade to the latest newer published version for this version of Squeak."
 
  | installed |
  installed := self installedRelease.
  installed
  ifNil: [self error: 'No release installed, can not upgrade.']
  ifNotNil: [^installed upgrade]!

Item was changed:
  ----- Method: SMPackage>>upgradeOrInstall (in category 'installation') -----
  upgradeOrInstall
  "Upgrade to or install the latest newer published version for this version of Squeak."
 
  | installed |
  installed := self installedRelease.
  installed
  ifNil: [^self install]
  ifNotNil: [^installed upgrade]!

Item was changed:
  ----- Method: SMPackage>>versionLabel (in category 'installation') -----
  versionLabel
  "Return a label indicating installed and available version as:
  '1.0'      = 1.0 is installed and no new published version for this version of Squeak is available
  '1.0->1.1' = 1.0 is installed and 1.1 is published for this version of Squeak
  '->1.1'    = No version is installed and 1.1 is published for this version of Squeak
  '->(1.1) = No version is installed and there is only a non published version available for this version of Squeak
 
  The version showed is the one that #smartVersion returns.
  If a version name is in parenthesis it is not published."
 
  | installedVersion r r2 |
  r := self installedRelease.
  r ifNotNil: [
  installedVersion := r smartVersion.
  r2 := self lastPublishedReleaseForCurrentSystemVersionNewerThan: r]
  ifNil: [
  installedVersion := ''.
  r2 := self lastPublishedReleaseForCurrentSystemVersion ].
  ^r2 ifNil: [installedVersion ] ifNotNil: [installedVersion, '->', r2 smartVersion].!

Item was changed:
  ----- Method: SMPackageRelease>>package: (in category 'private') -----
  package: aPackage
  "Set when I am created."
 
  package := aPackage!

Item was changed:
  ----- Method: SMPackageRelease>>upgrade (in category 'services') -----
  upgrade
  "Upgrade this package release if there is a new release available."
 
  | newRelease |
  newRelease := package lastPublishedReleaseForCurrentSystemVersionNewerThan: self.
  newRelease ifNotNil: [(SMInstaller forPackageRelease: newRelease) upgrade]!

Item was changed:
  ----- Method: SMPersonalObject>>owner: (in category 'accessing') -----
  owner: anAccount
  owner := anAccount!

Item was changed:
  ----- Method: SMProjectInstaller class>>canInstall: (in category 'testing') -----
  canInstall: aPackage
  "Answer if this class can install the package.
  We handle .pr files (upper and lowercase)"
 
  | fileName |
  fileName := aPackage downloadFileName.
  fileName ifNil: [^false].
  ^'pr' = (FileDirectory extensionFor: fileName) asLowercase!

Item was changed:
  ----- Method: SMResource>>version: (in category 'accessing') -----
  version: aVersion
  version := aVersion!

Item was changed:
  ----- Method: SMSimpleInstaller>>cache (in category 'services') -----
  cache
  "Download object into cache if needed.
  Set the directory and fileName for subsequent unpacking and install."
 
  packageRelease ensureInCache ifTrue: [
  fileName := packageRelease downloadFileName.
  dir := packageRelease cacheDirectory]!

Item was changed:
  ----- Method: SMSimpleInstaller>>download (in category 'services') -----
  download
  "This service downloads the last release of the package
  even if it is in the cache already."
 
  packageRelease download ifTrue: [
  fileName := packageRelease downloadFileName.
  dir := packageRelease cacheDirectory]!

Item was changed:
  ----- Method: SMSimpleInstaller>>fileName: (in category 'accessing') -----
  fileName: aFileName
  fileName := aFileName!

Item was changed:
  ----- Method: SMSqueakMap class>>clear (in category 'instance creation') -----
  clear
  "Clear out the model in the image. This will forget
  about what packages are installed and what versions.
  The map is itself on disk though and will be reloaded.
 
  If you only want to reload the map and not forget about
  installed packages then use 'SMSqueakMap default reload'.
 
  If you want to throw out the map perhaps when shrinking
  an image, then use 'SMSqueakMap default purge'."
 
  "SMSqueakMap clear"
 
  DefaultMap := nil!

Item was changed:
  ----- Method: SMSqueakMap class>>default (in category 'instance creation') -----
  default
  "Return the default map, create one if missing."
 
  "SMSqueakMap default"
 
  ^DefaultMap ifNil: [DefaultMap := self new]!

Item was changed:
  ----- Method: SMSqueakMap class>>findServer (in category 'server detection') -----
  findServer
  "Go through the list of known master servers, ping
  each one using simple http get on a known 'ping'-url
  until one responds return the server name.
  If some servers are bypassed we write that to Transcript.
  If all servers are down we inform the user and return nil."
 
  | notAnswering deafServers |
  Socket initializeNetwork.
  notAnswering := OrderedCollection new.
  Cursor wait
  showWhile: [ServerList
  do: [:server | (self pingServer: server)
  ifTrue: [notAnswering isEmpty
  ifFalse: [deafServers := String
  streamContents: [:str | notAnswering
  do: [:srvr | str nextPutAll: srvr printString;
  nextPut: Character cr]].
  Transcript show: ('These SqueakMap master servers did not respond:\' , deafServers , 'Falling back on ' , server printString , '.') withCRs].
  ^ server]
  ifFalse: [notAnswering add: server]]].
  deafServers := String
  streamContents: [:str | notAnswering
  do: [:srvr | str nextPutAll: srvr printString;
  nextPut: Character cr]].
  self error: ('All SqueakMap master servers are down:\' , deafServers , '\ \Can not update SqueakMap...') withCRs.
  ^ nil!

Item was changed:
  ----- Method: SMSqueakMap>>accountWithId: (in category 'queries') -----
  accountWithId: anIdString
  "Look up an account. Return nil if missing.
  Raise error if it is not an account."
 
  | account |
  account := self objectWithId: anIdString.
  account ifNil: [^nil].
  account isAccount ifTrue:[^account].
  self error: 'UUID did not map to a account.'!

Item was changed:
  ----- Method: SMSqueakMap>>accounts (in category 'accessing') -----
  accounts
  "Lazily maintain a cache of all known account objects."
 
  accounts ifNotNil: [^accounts].
  accounts := objects select: [:o | o isAccount].
  ^accounts!

Item was changed:
  ----- Method: SMSqueakMap>>adminPassword: (in category 'accessing') -----
  adminPassword: aString
  "We store the password as a SHA hash so that we can let the slave maps
  have it too."
 
  adminPassword := SecureHashAlgorithm new hashMessage: aString!

Item was changed:
  ----- Method: SMSqueakMap>>categoryWithId: (in category 'queries') -----
  categoryWithId: anIdString
  "Look up a category. Return nil if missing.
  Raise error if it is not a category."
 
  | cat |
  cat := self objectWithId: anIdString.
  cat ifNil: [^nil].
  cat isCategory ifTrue:[^cat].
  self error: 'UUID did not map to a category.'!

Item was changed:
  ----- Method: SMSqueakMap>>categoryWithNameBeginning: (in category 'queries') -----
  categoryWithNameBeginning: aString
  "Look up a category beginning with <aString>. Return nil if missing.
  We return the shortest matching one. We also strip out spaces and
  ignore case in both <aString> and the names."
 
  | candidates shortest answer searchString |
  searchString := (aString asLowercase) copyWithout: Character space.
  candidates := self categories select: [:cat |
  ((cat name asLowercase) copyWithout: Character space)
  beginsWith: searchString ].
  shortest := 1000.
  candidates do: [:ca |
  ca name size < shortest ifTrue:[answer := ca. shortest := ca name size]].
  ^answer !

Item was changed:
  ----- Method: SMSqueakMap>>clearCaches (in category 'private') -----
  clearCaches
  "Clear the caches."
 
  packages := accounts := users := categories := nil
  !

Item was changed:
  ----- Method: SMSqueakMap>>clearCachesFor: (in category 'private') -----
  clearCachesFor: anObject
  "Clear the valid caches."
 
  anObject isPackage ifTrue:[packages := nil].
  anObject isAccount ifTrue:[accounts := users := nil].
  anObject isCategory ifTrue:[categories := nil]
  !

Item was changed:
  ----- Method: SMSqueakMap>>clearUsernames (in category 'private') -----
  clearUsernames
  "Clear the username cache."
 
  users := nil!

Item was changed:
  ----- Method: SMSqueakMap>>installPackage: (in category 'public-installation') -----
  installPackage: aPackage
  "Install the package.
 
  Note: This method should not be used anymore, better
  to specify a specific release."
 
  | rel |
  rel := aPackage lastPublishedReleaseForCurrentSystemVersion
  ifNil: [self error: 'No published release for this system version found to install.'].
  ^self installPackageRelease: rel!

Item was changed:
  ----- Method: SMSqueakMap>>installPackage:autoVersion: (in category 'public-installation') -----
  installPackage: aPackage autoVersion: version
  "Install the release <version> of <aPackage.
  <version> is the automatic version name."
 
  | r |
  r := aPackage releaseWithAutomaticVersionString: version.
  r ifNil: [self error: 'No package release found with automatic version ', version].
  ^self installPackageRelease: r!

Item was changed:
  ----- Method: SMSqueakMap>>installPackageNamed: (in category 'public-installation') -----
  installPackageNamed: aString
  "Install the last published release
  for this Squeak version of the package with a name
  beginning with aString (see method comment
  of #packageWithNameBeginning:).
 
  Note: This method should not be used anymore.
  Better to specify a specific release."
 
  | p |
  p := self packageWithNameBeginning: aString.
  p ifNil: [self error: 'No package found with name beginning with ', aString].
  ^self installPackage: p!

Item was changed:
  ----- Method: SMSqueakMap>>installPackageNamed:autoVersion: (in category 'public-installation') -----
  installPackageNamed: aString autoVersion: version
  "Install the release <version> of the package with a name
  beginning with aString (see method comment
  of #packageWithNameBeginning:). <version> is the
  automatic version name."
 
  | p r |
  p := self packageWithNameBeginning: aString.
  p ifNil: [self error: 'No package found with name beginning with ', aString].
  r := p releaseWithAutomaticVersionString: version.
  r ifNil: [self error: 'No package release found with automatic version ', version].
  ^self installPackageRelease: r!

Item was changed:
  ----- Method: SMSqueakMap>>installPackageReleaseWithId: (in category 'public-installation') -----
  installPackageReleaseWithId: anUUIDString
  "Look up and install the given release."
 
  | r |
  r := self packageReleaseWithId: anUUIDString.
  r ifNil: [self error: 'No package release available with id: ''', anUUIDString, ''''].
  ^self installPackageRelease: r!

Item was changed:
  ----- Method: SMSqueakMap>>installPackageWithId: (in category 'public-installation') -----
  installPackageWithId: anUUIDString
  "Look up and install the latest release of the given package.
 
  Note: This method should not be used anymore.
  Better to specify a specific release."
 
  | package |
  package := self packageWithId: anUUIDString.
  package ifNil: [self error: 'No package available with id: ''', anUUIDString, ''''].
  ^self installPackage: package!

Item was changed:
  ----- Method: SMSqueakMap>>installPackageWithId:autoVersion: (in category 'public-installation') -----
  installPackageWithId: anUUIDString autoVersion: version
  "Install the release <version> of the package with id <anUUIDString>.
  <version> is the automatic version name."
 
  | p |
  p := self packageWithId: anUUIDString.
  p ifNil: [self error: 'No package available with id: ''', anUUIDString, ''''].
  ^self installPackage: p autoVersion: version!

Item was changed:
  ----- Method: SMSqueakMap>>loadUpdatesFull: (in category 'private') -----
  loadUpdatesFull: full
  "Find a server and load updates from it."
   
  | server |
  server := self class findServer.
  server ifNotNil: [
  self synchWithDisk.
  full ifTrue: [self loadFullFrom: server]
  ifFalse:[self error: 'Not supported yet!!'."self loadUpdatesFrom: server"]]!

Item was changed:
  ----- Method: SMSqueakMap>>mutex (in category 'transactions') -----
  mutex
  "Lazily initialize the Semaphore."
 
  ^mutex ifNil: [mutex := Semaphore forMutualExclusion]!

Item was changed:
  ----- Method: SMSqueakMap>>newAccount:username:email: (in category 'public-master') -----
  newAccount: name username: username email: email
  "Create an account. Checking for previous account should already have been done.
  To add the account to the map, use SMSqueakMap>>addObject:"
 
  | account |
  account := self newAccount
  name: name;
  initials: username;
  email: email.
  ^account
 
  !

Item was changed:
  ----- Method: SMSqueakMap>>noteInstalledPackageNamed:autoVersion: (in category 'public-installation') -----
  noteInstalledPackageNamed: aString autoVersion: aVersion
  "Mark that the package release was just successfully installed.
  <aVersion> is the automatic version as a String.
  Can be used to inform SM of an installation not been done using SM."
 
  | p |
  p := self packageWithNameBeginning: aString.
  p ifNil: [self error: 'No package found with name beginning with ', aString].
 
  ^self noteInstalledPackage: p autoVersion: aVersion asVersion!

Item was changed:
  ----- Method: SMSqueakMap>>packageCacheDirectory (in category 'accessing') -----
  packageCacheDirectory
  "Return a FileDirectory for the package cache of the map.
  Creates it if it is missing."
 
  | dirName baseDir |
  dirName := self packageCacheDirectoryName.
  baseDir := self directory.
  (baseDir fileOrDirectoryExists: dirName)
  ifFalse:[baseDir createDirectory: dirName].
  ^baseDir directoryNamed: dirName!

Item was changed:
  ----- Method: SMSqueakMap>>packageReleaseWithId: (in category 'queries') -----
  packageReleaseWithId: anIdString
  "Look up a package release. Return nil if missing.
  Raise error if it is not a package release."
 
  | r |
  r := self objectWithId: anIdString.
  r ifNil: [^nil].
  r isPackageRelease ifTrue:[^r].
  self error: 'UUID did not map to a package release.'!

Item was changed:
  ----- Method: SMSqueakMap>>packageWithId: (in category 'queries') -----
  packageWithId: anIdString
  "Look up a package. Return nil if missing.
  Raise error if it is not a package."
 
  | package |
  package := self objectWithId: anIdString.
  package ifNil: [^nil].
  package isPackage ifTrue:[^package].
  self error: 'UUID did not map to a package.'!

Item was changed:
  ----- Method: SMSqueakMap>>packageWithNameBeginning: (in category 'queries') -----
  packageWithNameBeginning: aString
  "Look up a package beginning with <aString>. Return nil if missing.
  We return the shortest matching one. We also strip out spaces and
  ignore case in both <aString> and the names."
 
  | candidates shortest answer searchString |
  searchString := (aString asLowercase) copyWithout: Character space.
  candidates := self packages select: [:package |
  ((package name asLowercase) copyWithout: Character space)
  beginsWith: searchString ].
  shortest := 1000.
  candidates do: [:package |
  package name size < shortest ifTrue:[answer := package. shortest := package name size]].
  ^answer !

Item was changed:
  ----- Method: SMSqueakMap>>packages (in category 'accessing') -----
  packages
  "Lazily maintain a cache of all known package objects."
 
  packages ifNotNil: [^packages].
  objects ifNil: [^#()].
  packages := objects select: [:o | o isPackage].
  ^packages!

Item was changed:
  ----- Method: SMSqueakMap>>setDirty (in category 'transactions') -----
  setDirty
  "Set the map modified so that it will get written to disk."
 
  isDirty := true!

Item was changed:
  ----- Method: SMSqueakMap>>silentlyDo: (in category 'public-installation') -----
  silentlyDo: aBlock
  "Execute <aBlock> with the Silent flag set.
  This is a crude way of avoiding user interaction
  during batch operations, like loading updates."
 
  [silent := true.
  aBlock value]
  ensure: [silent := nil]!

Item was changed:
  ----- Method: SMSqueakMap>>transaction: (in category 'transactions') -----
  transaction: aBlock
  "Execute aBlock and then make sure any modified SMObjects
  are committed to disk. We do this inside a mutex in order to
  serialize transactions. Transactions must be initiated from
  service methods in this class and not from inside the domain
  objects - otherwise they could get nested and a deadlock occurs."
 
  "In first version of SM2 we simply set the isDirty flag,
  when next client asks for updates, or 30 minutes has passed,
  we checkpoint."
 
  " self mutex critical: ["
  aBlock value.
  isDirty := true
  " ]"
 
  " self mutex critical: [
  dirtyList := OrderedCollection new.
  aBlock value.
  dirtyList do: [:obj | obj commit].
  dirtyList := nil
  ]"!

Item was changed:
  ----- Method: SMSqueakMap>>upgradeOldPackagesConfirmBlock: (in category 'public-installation') -----
  upgradeOldPackagesConfirmBlock: aBlock
  "First we find out which of the installed packages are upgradeable and old.
  Then we upgrade them if confirmation block yields true.
  The block will be called with each SMPackage to upgrade.
  We return a Dictionary with the packages we tried to upgrade as keys
  and the value being the result of the upgrade, true or false."
 
  | result |
  result := Dictionary new.
  self upgradeableAndOldPackages
  do: [:package |
  (aBlock value: package)
  ifTrue:[ result at: package put: package upgrade]].
  ^result
  !

Item was changed:
  ----- Method: SMSqueakMap>>upgradeOrInstallPackageWithId: (in category 'public-installation') -----
  upgradeOrInstallPackageWithId: anUUIDString
  "Upgrade package (or install) to the latest published release for this Squeak version."
 
  | package |
  package := self packageWithId: anUUIDString.
  package ifNil: [self error: 'No package available with id: ''', anUUIDString, ''''].
  ^package upgradeOrInstall!

Item was changed:
  ----- Method: SMSqueakMap>>upgradePackageWithId: (in category 'public-installation') -----
  upgradePackageWithId: anUUIDString
  "Upgrade package to the latest published release for this Squeak version.
  Will raise error if there is no release installed, otherwise use
  #upgradeOrInstallPackageWithId: "
 
  | package |
  package := self packageWithId: anUUIDString.
  package ifNil: [self error: 'No package available with id: ''', anUUIDString, ''''].
  ^package upgrade!

Item was changed:
  ----- Method: SMSqueakMap>>users (in category 'accessing') -----
  users
  "Lazily maintain a cache of all known account objects
  keyed by their developer initials."
 
  users ifNotNil: [^users].
  users := Dictionary new.
  self accounts do: [:a | users at: a initials put: a].
  ^users!

Item was changed:
  ----- Method: SMUtilities class>>mailServer:masterServer: (in category 'class initialization') -----
  mailServer: ipName masterServer: httpUrl
  "Initialize server settings."
 
  MailServer := ipName.
  MasterServer := httpUrl!

Item was changed:
  ----- Method: SMUtilities class>>stripNameFrom: (in category 'utilities') -----
  stripNameFrom: aString
  "Picks out the name from:
  'Robert Robertson <[hidden email]>' => 'Robert Robertson'
  "
 
  | lessThan |
  lessThan := aString indexOf: $<.
  ^(aString copyFrom: 1 to: lessThan - 1) withBlanksTrimmed !