Spree Commerce

Try It Now

New Extension Versioning Mechanism

Posted on March 28, 2011 by Sean Schofield

We’re pleased to announce a new mechanism for versioning Spree extensions to simplify the determination process of which version of an extension to use for a particular version of Spree. Once you’ve established that an extension you’re interested in works with the Spree version you’re using, there is still the challenge of figuring out how to "install" the right version of the extension in your application. We spent some time thinking through that challenge as well as looking at similar projects that support extensions such as Drupal.

Ultimately we wanted something that was simple to implement and understand. Just as important, the solution needed to be simple to maintain or people wouldn’t bother keeping it up to date. We didn’t want to require an extension author to have multiple branches or tags in their Github repository if the same branch or tag effectively worked on multiple versions of Spree. Our solution was to introduce a concept known as the Versionfile.

The basic concept is that you add a file with the name Versionfile to the root of your extension source code. The file is a simple Ruby hash which maps versions of Spree to a "point in time release" of the source code. If you have published your extension as a gem then this will map to the exact gem version you pushed to Rubygems. What’s even cooler is that you don’t need to actually release your code as a gem to share it with the world. Just identify an exact point in "git history" as the release point.

The extension registry now reads these files directly from Github and parses them for version information. This process allows for automatic updating of all extensions based on the Versionfile. We’ve also done away with the confusing "voting system" that we used to indicate whether or not an extension was working with a particular version. This biggest problem with community voting was that even if it were determined that an extension was compatible with a particular version of Spree, there was no easy way to identify which version of the extension to use or how to get the source.

We’ll be going through some of the old extensions and adding this information. We encourage extension authors to do the same. For more information please also see the new documentation on Versionfile.