[squeak-dev] The Inbox: Metacello-Base-mt.20.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Jul 16 11:30:34 UTC 2013

A new version of Metacello-Base was added to project The Inbox:

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

Name: Metacello-Base-mt.20
Author: mt
Time: 16 July 2013, 1:30:31.34 pm
UUID: 247700db-096b-2041-bd53-b56a6ed52b0e
Ancestors: Metacello-Base-DaleHenrichs.19

BOOTSTRAPPING: Repository URL updated to http://seaside.gemtalksystems.com/ss/metacello

==================== Snapshot ====================

SystemOrganization addCategory: #'Metacello-Base'!

Object subclass: #MetacelloBaseConfiguration
	instanceVariableNames: 'project'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Metacello-Base'!

!MetacelloBaseConfiguration commentStamp: '<historical>' prior: 0!
THIS IS AN EXPERIMENTAL CLASS. Use MetacelloConfigTemplate for creating configurations.

Subclass me to create a new configuration, then edit and evaluate the following expression to create the initial baseline version:

	"create baseline method"

                createBaseline: '1.0-baseline'
                for: 'MyProject'
                repository: 'http://www.example.com/MyProjectRepository'
                requiredProjects: #('Gofer')
                packages: #('MyProject-Core' 'MyProject-Tests')
                        {('MyProject-Core' -> #('Gofer')).
                         ('MyProject-Tests' -> #('MyProject-Core'))}
                        {('default' -> #('Core')).
                        ('Core' -> #('MyProject-Core')).
                        ('Tests' -> #('MyProject-Tests'))}.

	   "create initial development method from the baseline"

               createDevelopment: '1.0'
               for: 'MyProject'
                importFromBaseline: '1.0-baseline'
                description: 'initial version'.


----- Method: MetacelloBaseConfiguration class>>DevelopmentProcess (in category 'development support') -----

	- load current version:
	  	(self project version: #stable) load: 'ALL'.
	- open new version for development:
		self createNewDevelopmentVersion
	- do development and periodically save mcz files and configuration until ready for release
		self saveModifiedPackagesAndConfiguration: '- fixed a bug'
	- update the the development version to match mcz file versions
		self updateToLatestPackageVersions: '- fixed a bug'
	- save configuration
		self saveConfiguration: '- checkpoint configuration'
	- mark development version as release:
		self releaseDevelopmentVersion: '- release'

----- Method: MetacelloBaseConfiguration class>>bootstrapPackage:from: (in category 'private') -----
bootstrapPackage: aString from: aPath 
	| repository version |
	repository := MCHttpRepository
				location: aPath
				user: ''
				password: ''.
		versionReaderForFileNamed: aString , '.mcz'
		do: [:reader | 
			version := reader version.
			version load.
			version workingCopy repositoryGroup addRepository: repository]!

----- Method: MetacelloBaseConfiguration class>>compareVersions (in category 'development support') -----
	"Compare the #stable version to #development version"

	"self compareVersions"

	self ensureMetacello.
	((Smalltalk at: #MetacelloToolBox) compareVersionsIn: self) inspect

----- Method: MetacelloBaseConfiguration class>>createNewBaselineVersion (in category 'development support') -----
	"Create a new baseline version based upon the #stable version's baseline.
	 A new baseline should be created if new packages have been added or package dependencies have changed."

	"self createNewDevelopmentVersion"

	self ensureMetacello.
	(Smalltalk at: #MetacelloToolBox) createNewBaselineVersionIn: self description: ''

----- Method: MetacelloBaseConfiguration class>>createNewDevelopmentVersion (in category 'development support') -----
	"Create a new development version using the #stable version as model."

	"self createNewDevelopmentVersion"

	self ensureMetacello.
	(Smalltalk at: #MetacelloToolBox) createNewDevelopmentVersionIn: self description: ''!

----- Method: MetacelloBaseConfiguration class>>ensureMetacello (in category 'private') -----
	"Bootstrap Gofer (if necessary), load latest mcz file for ConfigurationOfMetacello (using old 
	 Gofer API), then load the latest version of Metacello itself."

	Smalltalk at: #MetacelloProject ifAbsent: [ | error |
		"list of repositories to try, in case primary repository is not accessible"
			with: 'http://www.squeaksource.com/MetacelloRepository' 
			with: 'http://seaside.gemtalksystems.com/ss/metacello') do: [:repositoryUrl |
					Smalltalk at: #Gofer ifAbsent: [
					"Current version of Gofer from which to bootstrap - as of 1.0-beta.21"
						self bootstrapPackage: 'Gofer-Core-lr.115' from: repositoryUrl ].
					Smalltalk at: #Gofer ifPresent: [:goferClass | | gofer |
						gofer := goferClass new
							url: repositoryUrl;
						[ gofer addPackage: 'ConfigurationOfMetacello' ] on: Warning do: [:ex | ex resume ].
						gofer load ]]
							on: Error
							do: [ :ex |
								error := ex.
									show: 'failed ensureMetacello: ';
									show: ex description printString;
									show: '...retrying'.
								"try again"
								ex return: nil ]) ~~ nil
					ifTrue: [
						"load 'default' group of Metacello"
						(Smalltalk at: #ConfigurationOfMetacello) perform: #load.
						^self ]].
		"shouldn't get here unless the load failed ... throw an error"
		self error: 'retry with alternate repository failed: ', error description printString ]!

----- Method: MetacelloBaseConfiguration class>>isMetacelloConfig (in category 'metacello tool support') -----
	"Answer true and the Metacello tools will operate on you"

----- Method: MetacelloBaseConfiguration class>>load (in category 'loading') -----
	"Load the #stable version defined for this platform. The #stable version is the version that is recommended to be used on this platform."

	"self load"

	^(self project version: #stable) load!

----- Method: MetacelloBaseConfiguration class>>loadBleedingEdge (in category 'loading') -----
	"Load the latest versions of the mcz files defined for this project. It is not likely that the #bleedingEdge has been tested."

	"self loadBleedingEdge"

	^(self project version: #bleedingEdge) load!

----- Method: MetacelloBaseConfiguration class>>loadDevelopment (in category 'loading') -----
	"Load the #development version defined for this platform. The #development version will change over time and is not expected to be stable."

	"self loadDevelopment"

	^(self project version: #development) load!

----- Method: MetacelloBaseConfiguration class>>project (in category 'accessing') -----

	^self new project!

----- Method: MetacelloBaseConfiguration class>>releaseDevelopmentVersion: (in category 'development support') -----
releaseDevelopmentVersion: commitMessage
	"Release #development version: set version blessing to #release, update the #development and #stable symbolic version methods and save the configuration."

	"self releaseDevelopmentVersion: '- release version 1.0.2'"

	self ensureMetacello.
	(Smalltalk at: #MetacelloToolBox) releaseDevelopmentVersionIn: self description: commitMessage!

----- Method: MetacelloBaseConfiguration class>>saveConfiguration: (in category 'development support') -----
saveConfiguration: commitMessage
	"Save mcz file that contains the configuration to it's repository."

	"self saveConfiguration: '- fixed bug'"

	self ensureMetacello.
	(Smalltalk at: #MetacelloToolBox) saveConfigurationPackageFor: self name asString description: commitMessage!

----- Method: MetacelloBaseConfiguration class>>saveModifiedPackagesAndConfiguration: (in category 'development support') -----
saveModifiedPackagesAndConfiguration: commitMessage
	"Save modified mcz files, update the #development version and then save the configuration."

	"self saveModifiedPackagesAndConfiguration: '- fixed bug'"

	self ensureMetacello.
	(Smalltalk at: #MetacelloToolBox) saveModifiedPackagesAndConfigurationIn: self description: commitMessage!

----- Method: MetacelloBaseConfiguration class>>unloadMetacello (in category 'unloading Metacello') -----
	"Unload the classes that implement Metacello. Metacello is not needed once a project has been loaded, so it can safely be unloaded."

	"self unloadMetacello"

	| gofer |
	gofer := (Smalltalk at: #Gofer) new.
	MCWorkingCopy allManagers do: [:wc |
		((wc packageName beginsWith: 'Metacello') or: [ wc packageName beginsWith: 'OB-Metacello' ])
			ifTrue: [ gofer package: wc packageName ]].
	gofer unload.!

----- Method: MetacelloBaseConfiguration class>>updateToLatestPackageVersions: (in category 'development support') -----
updateToLatestPackageVersions: descriptionString
	"Update the #development version to match currently loaded mcz files."

	"self updateToLatestPackageVersions: '- fixed a bug'"

	self ensureMetacello.
	((Smalltalk at: #MetacelloToolBox) updateToLatestPackageVersionsIn: self description: descriptionString) isEmpty
		ifTrue: [ self inform: 'All specs up to date' ]!

----- Method: MetacelloBaseConfiguration class>>validate (in category 'development support') -----
	"Check the configuration for Errors, Critical Warnings, and Warnings (see class comment for MetacelloMCVersionValidator for more information). 
	Errors identify specification issues that will result in unexpected behaviour when you load the configuration. 
	Critical Warnings identify specification issues that may result in unexpected behavior when you load the configuration.
	Warnings identify specification issues that are technically correct, but are worth take a look at."

	"self validate"

	self ensureMetacello.
	^ ((Smalltalk at: #MetacelloToolBox) validateConfiguration: self debug: #() recurse: false) explore!

----- Method: MetacelloBaseConfiguration>>bleedingEdge (in category 'defaults') -----
	"override if different behavior desired.
		self versionDoesNotExistError: #bleedingEdge
	 if #bleedingEdge version is disallowed."

	<defaultSymbolicVersion: #bleedingEdge>
	^self defaultBleedingEdgeVersion!

----- Method: MetacelloBaseConfiguration>>defaultBleedingEdgeVersion (in category 'defaults') -----
	| bleedingEdgeVersion |
	bleedingEdgeVersion := (self project map values select: [ :version | version blessing == #baseline ])
		detectMax: [ :version | version ].
	bleedingEdgeVersion ifNil: [ ^#'notDefined' ].
	^ bleedingEdgeVersion versionString!

----- Method: MetacelloBaseConfiguration>>project (in category 'accessing') -----

	^ project ifNil: [ | constructor |
		"Bootstrap Metacello if it is not already loaded"
		self class ensureMetacello.
		"Construct Metacello project"
		constructor := (Smalltalk at: #MetacelloVersionConstructor) on: self.
		project := constructor project.
		project loadType: #linear. "change to #atomic if desired"
		project ]!

----- Method: MetacelloBaseConfiguration>>project: (in category 'accessing') -----
project: aProject

	project ifNil: [ self class ensureMetacello ].
	project := aProject!

----- Method: MetacelloBaseConfiguration>>versionDoesNotExistError: (in category 'private') -----
versionDoesNotExistError: versionStringOrSymbol

	((Smalltalk at: #MetacelloSymbolicVersionDoesNotExistError) project: self project versionString: versionStringOrSymbol) signal!

More information about the Squeak-dev mailing list