Dist-Zilla-BeLike-CSJEWELL

changeset 12:1fe391f06a8e

uploading tarball-to-svn-repo plugin.
author Curtis Jewell <csjewell@cpan.org>
date Fri Aug 13 10:19:12 2010 -0600 (2010-08-13)
parents 101ce8648cb6
children 35f52d796bbe
files lib/Dist/Zilla/Plugin/CSJEWELL/SubversionDist.pm
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/lib/Dist/Zilla/Plugin/CSJEWELL/SubversionDist.pm	Fri Aug 13 10:19:12 2010 -0600
     1.3 @@ -0,0 +1,146 @@
     1.4 +package Dist::Zilla::Plugin::CSJEWELL::SubversionDist;
     1.5 +
     1.6 +use 5.008003;
     1.7 +use Moose;
     1.8 +with 'Dist::Zilla::Role::Releaser';
     1.9 +
    1.10 +our $VERSION = '0.900';
    1.11 +$VERSION =~ s/_//sm;
    1.12 +
    1.13 +has directory => (
    1.14 +  is   => 'ro',
    1.15 +  isa  => 'Str',
    1.16 +  required => 1,
    1.17 +);
    1.18 +
    1.19 +has name => (
    1.20 +  is   => 'ro',
    1.21 +  isa  => 'Str',
    1.22 +  default => 'DZ::Plugin::CSJEWELL::SubversionDist',
    1.23 +);
    1.24 +
    1.25 +has debug => (
    1.26 +  is   => 'ro',
    1.27 +  isa  => 'Bool',
    1.28 +  default => 0,
    1.29 +);
    1.30 +
    1.31 +sub release {
    1.32 +	my ($self, $archive) = @_;
    1.33 +
    1.34 +	my $zilla = $self->zilla();
    1.35 +	
    1.36 +	$self->log($archive);
    1.37 +
    1.38 +	my $remote_file = $self->directory() . $archive;
    1.39 +	my $bot_name    = $self->name();
    1.40 +	my ( $release, $version ) =
    1.41 +	  $archive =~ m/([\w-]+)-([\d_\.]+).tar.gz/msx;
    1.42 +	$release =~ s/-/::/gms;
    1.43 +	my $message = "[$bot_name] Importing upload file for $release $version";
    1.44 +
    1.45 +	my $command = qq(svn import $archive $remote_file -m "$message" 2>&1); 
    1.46 +	if ($self->fake_release()) {
    1.47 +		$self->log($command);
    1.48 +	} else {
    1.49 +		system $command;
    1.50 +	}
    1.51 +
    1.52 +	$self->log('Release file committed to SVN.');
    1.53 +	
    1.54 +	return 1;
    1.55 +}
    1.56 +
    1.57 +__PACKAGE__->meta()->make_immutable();
    1.58 +no Moose;
    1.59 +1;
    1.60 +
    1.61 +__END__
    1.62 +
    1.63 +=pod
    1.64 +
    1.65 +=head1 NAME
    1.66 +
    1.67 +Dist::Zilla::Plugin::CSJEWELL::SubversionDist - Upload tarball to a Subversion repository
    1.68 +
    1.69 +=head1 VERSION
    1.70 +
    1.71 +This document describes Dist::Zilla::Plugin::CSJEWELL::SubversionDist version 0.900.
    1.72 +
    1.73 +=head1 DESCRIPTION
    1.74 +
    1.75 +	; in dzil.ini
    1.76 +	[CSJEWELL::SubversionDist]
    1.77 +	directory    = http://svn.ali.as/cpan/release/
    1.78 +	fake_release = 0
    1.79 +	name         = DZ
    1.80 +
    1.81 +=head1 INTERFACE
    1.82 +
    1.83 +=head2 dzil.ini file
    1.84 +
    1.85 +The dzil.ini file takes 3 parameters, one of which is required.
    1.86 +
    1.87 +=head3 directory
    1.88 +
    1.89 +The location in the Subversion repository to upload to.
    1.90 +
    1.91 +=head3 directory
    1.92 +
    1.93 +The directory on the FTP site to upload the tarball to.
    1.94 +
    1.95 +=head3 name
    1.96 +
    1.97 +The name appended to the commit message. Defaults to C<DZ::Plugin::CSJEWELL::SubversionDist>.
    1.98 +
    1.99 +=head3 debug
   1.100 +
   1.101 +Whether to just log the command line rather than executing it.  Defaults to 0.
   1.102 +
   1.103 +=for Pod::Coverage release
   1.104 +
   1.105 +=head1 AUTHOR
   1.106 +
   1.107 +Curtis Jewell <CSJewell@cpan.org>
   1.108 +
   1.109 +=head1 SEE ALSO
   1.110 +
   1.111 +L<Dist::Zilla::BeLike::CSJEWELL|Dist::Zilla::BeLike::CSJEWELL>
   1.112 +
   1.113 +=head1 LICENSE AND COPYRIGHT
   1.114 +
   1.115 +Copyright (c) 2010, Curtis Jewell C<< CSJewell@cpan.org >>.
   1.116 +
   1.117 +This module is free software; you can redistribute it and/or
   1.118 +modify it under the same terms as Perl itself, either version
   1.119 +5.8.1 or any later version. See L<perlartistic|perlartistic> 
   1.120 +and L<perlgpl|perlgpl>.
   1.121 +
   1.122 +The full text of the license can be found in the
   1.123 +LICENSE file included with this module.
   1.124 +
   1.125 +=head1 DISCLAIMER OF WARRANTY
   1.126 +
   1.127 +BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
   1.128 +FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
   1.129 +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
   1.130 +PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
   1.131 +EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   1.132 +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
   1.133 +ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
   1.134 +YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
   1.135 +NECESSARY SERVICING, REPAIR, OR CORRECTION.
   1.136 +
   1.137 +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
   1.138 +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
   1.139 +REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE
   1.140 +LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
   1.141 +OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
   1.142 +THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
   1.143 +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
   1.144 +FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
   1.145 +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
   1.146 +SUCH DAMAGES.
   1.147 +
   1.148 +=cut
   1.149 +