File Coverage

blib/lib/Module/Release/OpenRepository.pm
Criterion Covered Total %
statement 12 25 48.0
branch 0 2 0.0
condition 0 4 0.0
subroutine 4 5 80.0
pod 1 1 100.0
total 17 37 45.9


line stmt bran cond sub pod time code
1             package Module::Release::OpenRepository;
2              
3 1     1   1209 use 5.006001;
  1         4  
  1         47  
4 1     1   6 use strict;
  1         2  
  1         32  
5 1     1   6 use warnings;
  1         2  
  1         70  
6 1     1   6 use parent qw(Exporter);
  1         3  
  1         7  
7              
8             our @EXPORT = qw(open_upload);
9              
10             our $VERSION = '0.101';
11             $VERSION = eval { return $VERSION };
12              
13             =head1 NAME
14              
15             Module::Release::OpenRepository - Import release into the Open Repository.
16              
17             =head1 DESCRIPTION
18              
19             The release-csjewell script will automatically load this module if it thinks that you
20             want to upload to the Open Repository at http://svn.ali.as/.
21              
22             =head1 SYNOPSIS
23              
24             use Module::Release '2.00_04';
25              
26             # ...
27             $release->load_mixin( 'Module::Release::OpenRepository' );
28             # ...
29             last if $release->debug;
30              
31             # ...
32             $release->open_upload;
33              
34             =head1 INTERFACE
35              
36             =over 4
37              
38             =item open_upload
39              
40             Looks in local_name to get the name and version of the distribution file.
41              
42             =cut
43              
44             sub open_upload {
45 0     0 1   my $self = shift;
46              
47 0   0       my $no_upload = $self->config->openrepository_noupload || 0;
48 0 0         return if $no_upload;
49              
50 0           my $local_file = $self->local_file;
51 0           my $remote_file = "http://svn.ali.as/cpan/releases/$local_file";
52 0   0       my $bot_name = $self->config->upload_bot_name
53             || 'Module::Release::OpenRepository';
54 0           my ( $release, $version ) =
55             $self->local_file =~ m/([\w-]+)-([\d_\.]+).tar.gz/msx;
56 0           $release =~ s/-/::/gms;
57 0           my $message = "[$bot_name] Importing upload file for $release $version";
58              
59 0           $self->_print("Committing release file to OpenRepository.\n");
60 0           $self->_debug("Commit Message: $message\n");
61 0           $self->run(qq(svn import $local_file $remote_file -m "$message" 2>&1));
62              
63 0           return;
64             } ## end sub open_upload
65              
66             =back
67              
68             =head1 SEE ALSO
69              
70             L<Module::Release>
71              
72             =head1 SOURCE AVAILABILITY
73              
74             This source is on the Open Repository:
75              
76             L<http://svn.ali.as/cpan/trunk/Module-Release-CSJEWELL/>
77              
78             =head1 CONFIGURATION AND ENVIRONMENT
79              
80             =head2 .releaserc or releaserc file
81              
82             These two entries are read from the releaserc file to configure whether
83             the file is imported into the repository or not, and what bot :
84              
85             openrepository_noupload 1
86             upload_bot_name CSJewell_bot
87              
88             If openrepository_noupload is true, importing the distribution file will
89             be skipped.
90              
91             upload_bot_name will default to "Module::Release::OpenRepository" if not
92             set, and will be used along with the distribution name and version to create
93             the commit message.
94              
95             =head1 AUTHOR
96              
97             Curtis Jewell, C<< <csjewell@cpan.org> >>
98              
99             =head1 LICENSE AND COPYRIGHT
100              
101             Copyright (c) 2009, Curtis Jewell C<< <csjewell@cpan.org> >>. All rights reserved.
102              
103             This module is free software; you can redistribute it and/or
104             modify it under the same terms as Perl itself, either version
105             5.8.1 or any later version. See L<perlartistic> and L<perlgpl>.
106              
107             The full text of the license can be found in the
108             LICENSE file included with this module.
109              
110             =head1 DISCLAIMER OF WARRANTY
111              
112             BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
113             FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
114             OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
115             PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
116             EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
117             WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
118             ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
119             YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
120             NECESSARY SERVICING, REPAIR, OR CORRECTION.
121              
122             IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
123             WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
124             REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE
125             LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
126             OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
127             THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
128             RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
129             FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
130             SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
131             SUCH DAMAGES.
132              
133             =cut
134              
135             1;