Containers on deck[1]

When you have a bunch of packages that you need to transfer between repositories, you can use Metacello and Gofer to simplify the task.

With the SS3 repository coming on-line, I decided to move tODE development to it’s own repository on SS3. The scripts that I wrote turned out to be pretty simple, but not necessarily obvious, so I thought that they’d be worth sharing.

The basic idea is to use Metacello to identify the packages that you want to transfer and use Gofer fetch to download the selected packages from the source repository into the local cache. Then use Gofer push to upload the packages from the local cache to the target repository.

In my case I want to transfer all versions of the packages used in tODE 0.1:

| gofer |
"Identify the source repository"
gofer := Gofer new gemsource: 'Naviode';
	package: 'ConfigurationOftODE' yourself.
"Traverse all packages defined in version '0.1' of the tODE configuration"
(ConfigurationOftODE project version: '0.1') packages do:[:spec |
	"Use the #name and #package: messages and Gofer will fetch 
	all versions of the Monticello package"
	gofer package: spec name ].
"Initiate the download with the #fetch command"
gofer fetch.

After the above expression completes, I can then initiate the upload:

| gofer |
"Identify the target repository"
gofer := Gofer new url: 'http://ss3.gemstone.com/ss/tODE';
	package: 'ConfigurationOftODE' yourself.
"Use the same algorithm for identifying the packages to be pushed"
(ConfigurationOftODE project version: '0.1') packages do:[:spec |
	gofer package: spec name ].
"Initiate the upload with the #push command"
gofer push.

If you want to transfer only the latest versions of the packages, substitute the following expression in the above scripts:

"Traverse all packages defined in version '0.1' of the tODE configuration"
(ConfigurationOftODE project version: '0.1') packages do:[:spec |
	"Use the #file and the #version: messages and Gofer will fetch
	only the specified version of the Monticello package"
	gofer version: spec file ].

—–

[1] Photo by http://www.flickr.com/photos/blueship/137771066 / CC BY-NC-SA 2.0