27 April 2014

How to distribute your GitHub Pharo packages

Pharo still lacks normal git support, but there are already tool available to help you move your projects to git and GitHub. There is a GitFileTree by Thierry Goubier which adds very useful features, but I like to stick with vanilla stuff. Do not misunderstand me, during development I use bleeding edge tools, but for distribution I prefer to have less dependencies.
Pharo 3 now comes with filetree by Dale Henrichs, which allows you to store Monticello versions on your filesystem and so version them with git. But when it comes to distribution of the project, you have a little problem. Monticello packages benefit from Gofer, but nothing similar is available for filetree projects.

The best solution I've found for now is to create a Metacello configuration and store it with Monticello (on SmalltalkHub for example). Please note, that you can even publish it to Pharo Meta Repository, and it will be available in Configuration browser. Basics of Metacello are described in the other post. But now let's have some fun with GitHub. Metacello provides us with a special URI format:

github://<user>/<project>[:<branch>|<tag>|<SHA>][/<path>]

Here you can use optional path if your filetree packages do not reside in the root of the repository. And the optional branch|tag|SHA allows you to clone specific commit either by branch, tag, or its SHA hash. Now what I would suggest is to configure a baseline as:

spec for: #common do: [
spec
blessing: #baseline;
repository: 'github://User/Project:master';
package: 'MyPackage';
package: 'OtherPackage' ]

You can also put development branch or whatever has the latest updates.
Then for versions, you can tag commits and specify that tag in the URI:

spec for: #common do: [
spec
blessing: #release;
repository: 'github://User/Project:v1.0';
package: 'MyPackage' with: 'MyPackage-UserName.43';
package: 'OtherPackage' with: 'OtherPackage-UserName.14' ]

Please note, that when you add tags to your repository, GitHub automatically creates a "release". This way each version of your project will be nicely documented on GitHub.

Please note, that usually versioning and packaging systems are different things, while in Smalltalk they were somewhat the same and now this is a big pain. But maybe you, dear reader, will be the one who will create an adequate packaging tool ;) Good luck!

No comments:

Post a Comment