| Shipwright documentation | Contained in the Shipwright distribution. |
Shipwright::Backend - Backend
# shipwright some_command -r backend_type:path
shipwright create -r svn:file:///svnrepo/shipwright/my_proj
See <Shipwright::Manual::Glossary/shipyard> to understand its concept. Look at list of </SUPPORTED BACKENDS> or IMPLEMENTING BACKENDS if you want add a new one.
Currently, the supported backends are FS (Shipwright::BACKEND::FS), Git (Shipwright::BACKEND::Git), SVK (Shipwright::BACKEND::SVK) and SVN (Shipwright::BACKEND::SVN).
Each implementation of a backend is a subclass of Shipwright::Backend::Base.
This is a tiny class with only one method new that loads
particular implementation class and returns instance of that
class.
Returns the backend object that corresponds to the type defined in the repository argument.
sunnavy <sunnavy@bestpractical.com>
Shipwright is Copyright 2007-2011 Best Practical Solutions, LLC.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Shipwright documentation | Contained in the Shipwright distribution. |
package Shipwright::Backend; use warnings; use strict; use UNIVERSAL::require; use Shipwright::Util; sub new { my $class = shift; my %args = @_; confess_or_die 'need repository arg' unless exists $args{repository}; $args{repository} =~ s/^\s+//; $args{repository} =~ s/\s+$//; # exception for svk repos, they can start with // if ( $args{repository} =~ m{^//} ) { $args{repository} = 'svk:'. $args{repository}; } my $backend; if ( $args{repository} =~ /^([a-z]+)(?:\+([a-z]+))?:/ ) { ($backend) = $1; } else { confess_or_die "invalid repository, doesn't start with xxx: or xxx+yyy:"; } my $module = find_module(__PACKAGE__, $backend); unless ( $module ) { confess_or_die "Couldn't find backend implementing '$backend'"; } $module->require or confess_or_die "Couldn't load module '$module'" ." implementing backend '$backend': $@"; return $module->new(%args); } 1; __END__