New Piston implementation started
Well, it is started. If you want to follow Piston 2.0’s progress, head on over to the Piston GitHub Repository.
If you want, you can register to
Piston’s Recent Commits on master.
What have I got so far ?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
require "piston/commands/base" module Piston module Commands class Import < Piston::Commands::Base attr_reader :options def initialize(options={}) @options = options logger.debug {"Import with options: #{options.inspect}"} end def run(revision, working_copy) tmpdir = working_copy.path.parent + ".#{working_copy.path.basename}.tmp" begin debug {"Creating temporary directory: #{tmpdir}"} tmpdir.mkdir revision.checkout_to(tmpdir) working_copy.create working_copy.copy_from(tmpdir) working_copy.remember(revision.remember_values) working_copy.finalize ensure debug {"Removing temporary directory: #{tmpdir}"} tmpdir.rmtree end end end end end |
This is the new import command. Everything is expressed in terms of high-level operations, and the different backends will take care of doing the right thing. In the case of Subversion, checking out the repository will involve running “svn checkout”. For Git, this will be “git clone”, and so on.
remember in the context above is for storing the properties Piston requires. These are the old piston:root, piston:uuid Subversion properties. The different working copy backends will take care of storing this in a format that is suitable: Subversion properties when available, YAML file otherwise.
Also, Piston will be more like Merb: it will be split in multiple Gems. Piston, the main gem, will install piston-core as well as all backends. piston-svn and piston-git are the first two backends I am planning on adding.
I’m having fun reimplementing Piston like this ! No fun no new features. Fun many new features.
Leave a Reply