Advanced Rails - Building Industrial-Strength Web Apps in Record Time

(Tuis.) #1

82 | Chapter 3: Rails Plugins


To solve these problems, François Beausoleil created Piston,*a program to manage
vendor branches in Subversion. Piston imports the remote branch into the local
repository, only synchronizing when requested. As a full copy of the code exists
inside the project’s repository, it can be modified as needed. Any changes made to
the local copy will be merged when the project is updated from the remote server.


Piston is available as a gem; install it withsudo gem install --include-dependencies
piston.


To install a plugin using Piston, you need to manually find the Subversion URL of
the repository. Then, simply import it with Piston, specifying the repository URL and
the destination path in your working copy:


$ piston import http://svn.rubyonrails.org/rails/plugins/deadlock_retry \
vendor/plugins/deadlock_retry
Exported r7144 from 'http://svn.rubyonrails.org/rails/plugins/deadlock_retry/'
to 'vendor/plugins/deadlock_retry'

$ svn ci

Thesvn ciis necessary because Piston adds the code to your working copy. To Sub-
version, it is as if you wrote the code yourself—it is versioned alongside the rest of
your application. This makes it very simple to patch the vendor branch for local use;
simply make modifications to the working copy and check them in.


When the time comes to update the vendor branch,piston update vendor/plugins/
deadlock_retrywill fetch all changes from the remote repository and merge them in.
Any local modifications will be preserved in the merge.piston updatecan be called
without an argument; in that case, it will recursively update any Piston-controlled
directories under the current one.


Piston-controlled directories can be locked to their current version withpiston lock
and unlocked withpiston unlock. And for currentsvn:externalsusers, existing
directories managed withsvn:externalscan be converted to Piston all at once with
piston convert.


Piston is also good for managing edge Rails, along with any patches you may apply.
To import Rails from the edge, with all of the features of Piston:


$ piston import http://svn.rubyonrails.org/rails/trunk vendor/rails

Decentralized version control


Piston effectively creates one layer between a remote repository and the working copy.
Decentralized version control systems take this model to its logical conclusion: every
working copy is a repository, equally able to share changes with other repositories. This
can be a much more flexible model than normal centralized version control systems.
We examine decentralized version control systems in more detail in Chapter 10.


*http://piston.rubyforge.org/

Free download pdf