Dist-Zilla-Plugin-Subversion

 view release on metacpan or  search on metacpan

t/svn.t  view on Meta::CPAN

#!perl
use 5.010;
use strict;
use warnings;
use utf8;


use Cwd;
use Dist::Zilla::Tester 4.101550;
use English qw(-no_match_vars);
use File::Temp;
use Modern::Perl;
use Path::Class qw(dir file);
use SVN::Client;
use SVN::Repos;
use Test::Most;
use Test::Moose;
use Text::Template;
use Readonly;

our %MODULES;
my $tests = 12;

BEGIN {
    Readonly our %MODULES => (
        'Dist::Zilla::Plugin::Subversion::ReleaseDist' => 'release',
        'Dist::Zilla::Plugin::Subversion::Tag'         => 'after_release',
    );
    for ( keys %MODULES ) { use_ok($ARG) }
}

for my $module ( keys %MODULES ) {
    isa_ok( $module, 'Moose::Object', $module );
    for (qw(svn_user svn_password working_url)) {
        has_attribute_ok( $module, $ARG, "$module has the $ARG attribute" );
    }
    can_ok( $module, $MODULES{$module} );
}

my $wc       = File::Temp->newdir();
my $repo_dir = File::Temp->newdir();
my $repo_uri = URI::file->new_abs("$repo_dir");
{
    ## no critic (ProhibitCallsToUnexportedSubs)
    my $repos = SVN::Repos::create( "$repo_dir", undef, undef, undef, undef );
}
dir( "$wc", 'trunk' )->mkpath();
my $ini_file = file( "$wc", qw(trunk dist.ini) );
my $ini_template
    = Text::Template->new( type => 'string', source => <<'END_INI');
name     = test
author   = test user
abstract = test release
license  = BSD
version  = 1.{$version || 0}
copyright_holder = test holder

{$repository_plugin}
[Subversion::ReleaseDist]
{ join "\n", @ini_lines }
[Subversion::Tag]
{ join "\n", @ini_lines }
END_INI

my $fh = $ini_file->openw();
print $fh $ini_template->fill_in();
close $fh;
for (qw(tags branches)) { dir( "$wc", $ARG )->mkpath() }

my $test_client = SVN::Client->new();
$test_client->import( "$wc", "$repo_uri", 0 );
for (qw(trunk tags branches)) { dir( "$wc", $ARG )->rmtree() }

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.478 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )