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 ?
piston/commands/import.rb
1 require "piston/commands/base" 2 3 module Piston 4 module Commands 5 class Import < Piston::Commands::Base 6 attr_reader :options 7 8 def initialize(options={}) 9 @options = options 10 logger.debug {"Import with options: #{options.inspect}"} 11 end 12 13 def run(revision, working_copy) 14 tmpdir = working_copy.path.parent + ".#{working_copy.path.basename}.tmp" 15 16 begin 17 debug {"Creating temporary directory: #{tmpdir}"} 18 tmpdir.mkdir 19 revision.checkout_to(tmpdir) 20 working_copy.create 21 working_copy.copy_from(tmpdir) 22 working_copy.remember(revision.remember_values) 23 working_copy.finalize 24 ensure 25 debug {"Removing temporary directory: #{tmpdir}"} 26 tmpdir.rmtree 27 end 28 end 29 end 30 end 31 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.