Piston (written by François Beausoleil) allows you to copy the content from a remote Subversion repository inside your own repository, while memorizing the remote revision in use at that time. It relies on a clever use of Subversion properties to memorize the remote revision number.
While copying the content once is already good in itself if you want to ensure you don’t depend on external repositories failures (eg: one repository for each of your Rails plugins for instance), the real benefit comes when you want to upgrade.
A couple of weeks later (or sooner!) you can ask Piston to update your local copy, then you will be able to commit the results (after running the tests and reviewing the changes), always in your repository. Piston will also update the Subversion properties it relies on to ensure we know where we stand.
Can it make my life better, please ?
More and more applications need to be deployed along with some plugins to get specific behaviours, like Mephisto or Typo.
Using Piston in that context you can:
- keep a copy of a precise revision of these applications in your repository
- keep a copy of each plugin for these applications in your repository as well (usually under a plugins folder)
- tweak (modify/commit) each part if needed (patch either a plugin or the main application for specific needs)
- upgrade each part only when you want to
Once you are done with it, you don’t have to worry about losing your deployment folder, and upgrades become much easier, as everything is under control.
How to use it, roughly ?
Here’s a series of command out of my memory – that should give you the idea. For accurate reference, please refer to the Piston website.
# install piston
gem install piston
# import the current mephisto trunk (current folder should be a svn working copy)
piston import http://svn.techno-weenie.net/projects/mephisto/trunk mymephisto
# commit this in our repository
svn commit -m "Piston import mephisto rev xxxx" mymephisto
# import a sitemap plugin because we want to tell the search engines which pages they should crawl
piston import http://svn.exdolo.com/projects/plugins/mephisto_sitemap/trunk mymephisto/vendor/plugins/mephisto_sitemap
# commit this as well
svn commit -m "Piston import exdolo sitemap plugin rev xxxx" mymephisto/vendor/plugins/mephisto_sitemap
# add some deployment recipes, rake tasks, whatever under mymephisto, commit them
# a few weeks later, update mephisto
piston update mymephisto
# review the changes, launch the test, then commit to our repository and deploy
svn commit -m "Piston updated mephisto to rev yyyy and sitemap plugin to rev zzzz" mymephisto
One caveat is that error messages in Piston can be hard to understand in some cases. I advise you to commit your modifications then run a ‘svn update’ prior to calling ‘piston update’ if you meet any issue. As well, for some reason, it seems best to call ‘piston update myfolder’ from the parent folder, instead of calling ‘piston update .’ from myfolder itself which didn’t seem to work in my case.
Can I use it outside of Mephisto or Typo, for my own applications ?
Yep – definitely. If you write regular Rails application yourself, you can use Piston to handle all the Rails plugins for which you need to be able to track the trunk, for instance. I’ve used Piston outside Rails on a Datawarehouse project with ActiveWarehouse-ETL.
Combine Piston, CruiseControl.rb and Capistrano and you get a robust development factory.
The comments system is brand new - don't be afraid to comment!
- Monitoring File Changes and Getting Notified via Growl (February 14th, 2010)
- How to use Google Calendar and Rufus-Google for Basic Time Tracking (November 27th, 2009)
- Using JRuby to prototype VST plugins (November 17th, 2009)
- Introducing Learnivore.com (September 15th, 2009)
- How to create small, unique tokens in Ruby (July 2nd, 2009)
- Detecting Which Ruby Interpreter is Running (JRuby, IronRuby) (March 4th, 2009)
- How to create an empty Rails Edge application (January 28th, 2009)
- How to Freeze Gems with Rails >= 2.1 (December 23rd, 2008)
- Thoughts on IronRuby and .Net Testing (December 1st, 2008)
- How to Retrieve Delicious Tags and Number of Bookmarks for a Given Url (November 30th, 2008)
- Fixing Symbol not found _rl_filename_completion_function (November 6th, 2008)
- How to Generate a Gradient for your CSS using RMagick (October 21st, 2008)
- Analyzing Your GMail History (September 18th, 2008)
- Data Visualization with Ruby and RMagick - Where Are Those Bikes ? (March 31st, 2008)
- All-Time Classics: a Selection of Recommended Books for Software Developers (February 23rd, 2008)

