Understanding Metacello load directives with GTInspector

Metacello is the configuration management engine used throughout the Pharo ecosystem. It's a powerful engine, but when things go slightly wrong it can be painful to debug.

Metacello does offer some debugging support out of the box, but this support comes mainly in terms of a textual output. For example, to debug what gets loaded, you can print the result of:

((ConfigurationOfGlamour project version: #stable) 
 ignoreImage: true)
 record loadDirective

This would produce an output like:

linear load : 
	linear load : 3.3.0 [ConfigurationOfGlamour]
		load : ConfigurationOfMagritte3
	atomic load : 3.3.0 [ConfigurationOfGlamour]
		explicit load : GlamourCore
			load : ConfigurationOfGlamourCore-CyrilFerlicot.74
		linear load : 3.2.1 [ConfigurationOfGlamourCore]
			load : ConfigurationOfRubric
	...

This is not quite ideal. But, wait. We have a moldable inspector. As the data is actually a tree, we can display that output as a ... tree. What's more, as we often need to search, we could also offer a basic search possibility. The screenshot below shows how it looks like in the GTInspector:

The extension code looks like this:

MetacelloVersionLoadDirective>>gtInspectorLoadDirectivesIn: composite
	<gtInspectorPresentationOrder: 1>
	composite tree
		title: 'Load directives';
		display: [ { self } ];
		format: [:each | each label ifEmpty: [each title]];
		rootsExpanded;
		children: #gtInspectorChildren;
		filterOn: [:text :each | '\*', text, '\*' match: each label ]

This extension took about 7 minutes to write. Moldable tools can turn a problem on its head if you use them actively.

Posted by Tudor Girba at 15 September 2015, 1:27 pm link
|