[Bps-public-commit] r10219 - in bpsbuilder/BPB/lib/BPB: .

sunnavy at bestpractical.com sunnavy at bestpractical.com
Tue Jan 1 00:03:51 EST 2008


Author: sunnavy
Date: Tue Jan  1 00:03:47 2008
New Revision: 10219

Added:
   bpsbuilder/BPB/lib/BPB/Source/SVK.pm
Modified:
   bpsbuilder/BPB/lib/BPB/Source.pm
   bpsbuilder/BPB/lib/BPB/Source/SVN.pm

Log:
added svk source, and a colon is enough, for both svn and svk

Modified: bpsbuilder/BPB/lib/BPB/Source.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Source.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Source.pm	Tue Jan  1 00:03:47 2008
@@ -61,9 +61,12 @@
     elsif ( $source =~ m{^\s*ftp://} ) {
         return 'FTP';
     }
-    elsif ( $source =~ m{^\s*svn::} ) {
+    elsif ( $source =~ m{^\s*svn:} ) {
         return 'SVN';
     }
+    elsif ( $source =~ m{^\s*svk:} ) {
+        return 'SVK';
+    }
     else {
         return 'CPAN';
     }

Added: bpsbuilder/BPB/lib/BPB/Source/SVK.pm
==============================================================================
--- (empty file)
+++ bpsbuilder/BPB/lib/BPB/Source/SVK.pm	Tue Jan  1 00:03:47 2008
@@ -0,0 +1,123 @@
+package BPB::Source::SVK;
+
+use warnings;
+use strict;
+use Carp;
+use File::Spec;
+
+use base qw/BPB::Source::Base/;
+
+sub new {
+    my $class = shift;
+    my $self  = $class->SUPER::new(@_);
+    my $s     = $self->source;
+    $s =~ s!^\s*svk:!!;
+    $self->source($s);
+    return $self;
+}
+
+=head2 run
+
+=cut
+
+sub run {
+    my $self = shift;
+    $self->_run;
+    my $s;
+    if ( $self->_is_compressed ) {
+        require BPB::Source::Compressed;
+        $s = BPB::Source::Compressed->new(%$self);
+    }
+    else {
+        require BPB::Source::Directory;
+        $s = BPB::Source::Directory->new(%$self);
+    }
+    $s->run(@_);
+}
+
+=head2 _run
+
+=cut
+
+sub _run {
+    my $self   = shift;
+    my $source = $self->source;
+    my @cmds;
+    push @cmds, join ' ', 'svk co ', $self->source,
+      File::Spec->catfile( $self->download_directory,
+        $self->name || $self->path );
+    push @cmds, join ' ', 'svk co -d',
+      File::Spec->catfile( $self->download_directory,
+        $self->name || $self->path );
+
+    $self->source(
+        File::Spec->catfile(
+            $self->download_directory, $self->name || $self->path
+        )
+    );
+    system($_) for @cmds;
+
+}
+
+sub path {
+    my $self = shift;
+    if ( $self->source =~ m{.*/(.+)\.(tar.(gz|bz2)|tgz)$} ) {
+        return $1;
+    }
+    elsif ( $self->source =~ m{.*/(.+)/?$} ) {
+        return $1;
+    }
+    else {
+        croak "invalid source, I can't guess the path";
+    }
+}
+
+sub _is_compressed {
+    my $self = shift;
+    return 1 if $self->source =~ m{.*/(.+)\.(tar.(gz|bz2)|tgz)$};
+    return;
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+BPB::Source::SVK - 
+
+
+=head1 SYNOPSIS
+
+  
+=head1 DESCRIPTION
+
+
+=head1 INTERFACE 
+
+
+=head1 DEPENDENCIES
+
+None.
+
+
+=head1 INCOMPATIBILITIES
+
+None reported.
+
+
+=head1 BUGS AND LIMITATIONS
+
+No bugs have been reported.
+
+=head1 AUTHOR
+
+sunnavy  C<< <sunnavy at bestpractical.com> >>
+
+
+=head1 LICENCE AND COPYRIGHT
+
+Copyright 2007 Best Practical Solutions.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.

Modified: bpsbuilder/BPB/lib/BPB/Source/SVN.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Source/SVN.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Source/SVN.pm	Tue Jan  1 00:03:47 2008
@@ -11,7 +11,7 @@
     my $class = shift;
     my $self  = $class->SUPER::new(@_);
     my $s     = $self->source;
-    $s =~ s/^\s*svn:://;
+    $s =~ s!^\s*svn:!!;
     $self->source($s);
     return $self;
 }



More information about the Bps-public-commit mailing list