autodie = 0
namespace::autoclean = 0
Log::Contextual = 0.004200
-File::Path = 2.08
+Path::Class = 0.26
DBIx::Class = 0.08121
Moose = 1.0
MooseX::Role::Parameterized = 0.18
require DBIx::Class::Storage; # loaded for type constraint
use DBIx::Class::DeploymentHandler::Types;
-use File::Path 'mkpath';
-use File::Spec::Functions;
+use Path::Class qw(file dir);
with 'DBIx::Class::DeploymentHandler::HandlesDeploy';
my ($self, $type, $versions, $prefix) = @_;
my $base_dir = $self->script_directory;
- my $main = catfile( $base_dir, $type );
+ my $main = dir( $base_dir, $type );
my $common =
- catfile( $base_dir, '_common', $prefix, join q(-), @{$versions} );
+ dir( $base_dir, '_common', $prefix, join q(-), @{$versions} );
my $common_any =
- catfile( $base_dir, '_common', $prefix, '_any' );
+ dir( $base_dir, '_common', $prefix, '_any' );
my $dir;
if (-d $main) {
- $dir = catfile($main, $prefix, join q(-), @{$versions})
+ $dir = dir($main, $prefix, join q(-), @{$versions})
} else {
if ($self->ignore_ddl) {
return []
croak "$main does not exist; please write/generate some SQL"
}
}
- my $dir_any = catfile($main, $prefix, '_any');
+ my $dir_any = dir($main, $prefix, '_any');
my %files;
try {
};
for my $dirname (grep { -d $_ } $common, $common_any, $dir_any) {
opendir my($dh), $dirname;
- for my $filename (grep { /\.(?:sql|pl)$/ && -f catfile($dirname,$_) } readdir $dh) {
+ for my $filename (grep { /\.(?:sql|pl)$/ && -f file($dirname,$_) } readdir $dh) {
unless ($files{$filename}) {
- $files{$filename} = catfile($dirname,$filename);
+ $files{$filename} = file($dirname,$filename);
}
}
closedir $dh;
my ($self, $version) = @_;
my $base_dir = $self->script_directory;
- my $dir = catfile( $base_dir, '_source', 'deploy', $version);
+ my $dir = dir( $base_dir, '_source', 'deploy', $version);
return [] unless -d $dir;
opendir my($dh), $dir;
my ($self, $versions) = @_;
my $base_dir = $self->script_directory;
- my $dir = catfile( $base_dir, '_preprocess_schema', 'upgrade', join q(-), @{$versions});
+ my $dir = dir( $base_dir, '_preprocess_schema', 'upgrade', join q(-), @{$versions});
return [] unless -d $dir;
my ($self, $versions) = @_;
my $base_dir = $self->script_directory;
- my $dir = catfile( $base_dir, '_preprocess_schema', 'downgrade', join q(-), @{$versions});
+ my $dir = dir( $base_dir, '_preprocess_schema', 'downgrade', join q(-), @{$versions});
return [] unless -d $dir;
sub _ddl_protoschema_produce_filename {
my ($self, $version) = @_;
- my $dirname = catfile( $self->script_directory, '_source', 'deploy', $version );
- mkpath($dirname) unless -d $dirname;
+ my $dirname = dir( $self->script_directory, '_source', 'deploy', $version );
+ $dirname->mkpath unless -d $dirname;
- return catfile( $dirname, '001-auto.yml' );
+ return "" . file( $dirname, '001-auto.yml' );
}
sub _ddl_schema_produce_filename {
my ($self, $type, $version) = @_;
- my $dirname = catfile( $self->script_directory, $type, 'deploy', $version );
- mkpath($dirname) unless -d $dirname;
+ my $dirname = dir( $self->script_directory, $type, 'deploy', $version );
+ $dirname->mkpath unless -d $dirname;
- return catfile( $dirname, '001-auto.sql' );
+ return "" . file( $dirname, '001-auto.sql' );
}
sub _ddl_schema_upgrade_consume_filenames {
my ($self, $type, $versions) = @_;
my $dir = $self->script_directory;
- my $dirname = catfile( $dir, $type, 'upgrade', join q(-), @{$versions});
- mkpath($dirname) unless -d $dirname;
+ my $dirname = dir( $dir, $type, 'upgrade', join q(-), @{$versions});
+ $dirname->mkpath unless -d $dirname;
- return catfile( $dirname, '001-auto.sql' );
+ return "" . file( $dirname, '001-auto.sql' );
}
sub _ddl_schema_downgrade_produce_filename {
my ($self, $type, $versions, $dir) = @_;
- my $dirname = catfile( $dir, $type, 'downgrade', join q(-), @{$versions} );
- mkpath($dirname) unless -d $dirname;
+ my $dirname = dir( $dir, $type, 'downgrade', join q(-), @{$versions} );
+ $dirname->mkpath unless -d $dirname;
- return catfile( $dirname, '001-auto.sql');
+ return "" . file( $dirname, '001-auto.sql');
}
sub _run_sql_array {
my $sql = ($sql_to_run)?join ";\n", @$sql_to_run:'';
FILENAME:
- for my $filename (@files) {
- if ($self->ignore_ddl && $filename =~ /^[^_]*-auto.*\.sql$/) {
+ for my $filename (map file($_), @files) {
+ if ($self->ignore_ddl && $filename->basename =~ /^[^_]*-auto.*\.sql$/) {
next FILENAME
} elsif ($filename =~ /\.sql$/) {
$sql .= $self->_run_sql($filename)
my ($self, $source_name) = @_;
return sub {
my ($self, $type, $version) = @_;
- my $dirname = catfile( $self->script_directory, $type, 'deploy', $version );
- mkpath($dirname) unless -d $dirname;
+ my $dirname = dir( $self->script_directory, $type, 'deploy', $version );
+ $dirname->mkpath unless -d $dirname;
- return catfile( $dirname, "001-auto-$source_name.sql" );
+ return "" . file( $dirname, "001-auto-$source_name.sql" );
}
}
my ($self, $source_name) = @_;
return sub {
my ($self, $version) = @_;
- my $dirname = catfile( $self->script_directory, '_source', 'deploy', $version );
- mkpath($dirname) unless -d $dirname;
+ my $dirname = dir( $self->script_directory, '_source', 'deploy', $version );
+ $dirname->mkpath unless -d $dirname;
- return catfile( $dirname, "001-auto-$source_name.yml" );
+ return "" . file( $dirname, "001-auto-$source_name.yml" );
}
}
use DBIx::Class::DeploymentHandler;
use aliased 'DBIx::Class::DeploymentHandler', 'DH';
-use File::Path 'remove_tree';
use Test::More;
use File::Temp 'tempdir';
use Test::Fatal qw(lives_ok dies_ok);
use DBIx::Class::DeploymentHandler;
use aliased 'DBIx::Class::DeploymentHandler', 'DH';
-use File::Path 'remove_tree';
use Test::More;
use File::Temp 'tempdir';
use Test::Fatal qw(lives_ok dies_ok);
use DBIx::Class::DeploymentHandler;
use aliased 'DBIx::Class::DeploymentHandler', 'DH';
-use File::Path 'remove_tree';
use Test::More;
use File::Temp 'tempdir';
use Test::Fatal qw(lives_ok dies_ok);
use DBICDHTest;
use aliased 'DBIx::Class::DeploymentHandler::Deprecated';
-use File::Path 'remove_tree';
use Test::More;
use File::Temp 'tempdir';
use Test::Fatal qw(lives_ok dies_ok);
use DBIx::Class::DeploymentHandler;
use aliased 'DBIx::Class::DeploymentHandler', 'DH';
-use File::Path qw(remove_tree mkpath);
+use Path::Class 'dir';
use Test::More;
use File::Temp 'tempdir';
ok !$s->storage->connected, 'creating handler did not connect';
ok($handler, 'DBIx::Class::DeploymentHandler w/1 instantiates correctly');
- mkpath("$sql_dir/SQLite/initialize/1");
+ dir($sql_dir, qw(SQLite initialize 1))->mkpath;
$handler->initialize({ version => 1, storage_type => 'SQLite' });
ok !$s->storage->connected, 'creating schema did not connect';
}
use DBIx::Class::DeploymentHandler;
use aliased 'DBIx::Class::DeploymentHandler', 'DH';
-use File::Path 'remove_tree';
use Test::More;
use File::Temp 'tempdir';
use Test::Fatal qw(lives_ok dies_ok);
use lib 't/lib';
use DBICDHTest;
use aliased 'DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator';
-use File::Spec::Functions qw(catfile splitdir);
-use File::Path qw(rmtree mkpath);
+use Path::Class qw(dir file);
use File::Temp qw(tempfile tempdir);
my $dbh = DBICDHTest::dbh();
my (undef, $stuffthatran_fn) = tempfile(OPEN => 0);
for (qw(initialize upgrade downgrade deploy)) {
- mkpath(catfile(splitdir($sql_dir), '_common', $_, '_any' ));
+ dir($sql_dir, '_common', $_, '_any')->mkpath;
open my $fh, '>',
- catfile(splitdir($sql_dir), '_common', $_, qw(_any 000-win.pl ));
+ file($sql_dir, '_common', $_, qw(_any 000-win.pl ));
print {$fh} qq^sub {open my \$fh, ">>", '$stuffthatran_fn'; use Data::Dumper::Concise; print {\$fh} join(",", \@{\$_[1]||[]}) . "\\n"; }^;
close $fh;
}
for (qw(initialize upgrade downgrade deploy)) {
- mkpath(catfile(splitdir($sql_dir), 'SQLite', $_, '_any' ));
+ dir($sql_dir, 'SQLite', $_, '_any')->mkpath;
open my $fh, '>',
- catfile(splitdir($sql_dir), 'SQLite', $_, qw(_any 000-win2.pl ));
+ file($sql_dir, 'SQLite', $_, qw(_any 000-win2.pl ));
print {$fh} qq^sub {open my \$fh, ">>", '$stuffthatran_fn'; use Data::Dumper::Concise; print {\$fh} join(",", \@{\$_[1]||[]}) . "\\n"; }^;
close $fh;
}
$dm->prepare_deploy;
- mkpath(catfile(splitdir($sql_dir), qw(SQLite initialize 1.0 )));
+ dir($sql_dir, qw(SQLite initialize 1.0 ))->mkpath;
open my $prerun, '>',
- catfile(splitdir($sql_dir), qw(SQLite initialize 1.0 003-semiautomatic.pl ));
+ file($sql_dir, qw(SQLite initialize 1.0 003-semiautomatic.pl ));
my (undef, $fn) = tempfile(OPEN => 0);
print {$prerun} "sub { open my \$fh, '>', '$fn'}";
close $prerun;
dies_ok {$dm->prepare_deploy} 'prepare_deploy dies if you run it twice' ;
ok(
- -f catfile(splitdir($sql_dir), qw(SQLite deploy 1.0 001-auto.sql )),
+ -f file($sql_dir, qw(SQLite deploy 1.0 001-auto.sql )),
'1.0 schema gets generated properly'
);
my $version = $s->schema_version();
$dm->prepare_deploy;
ok(
- -f catfile(splitdir($sql_dir), qw(SQLite deploy 2.0 001-auto.sql )),
+ -f file($sql_dir, qw(SQLite deploy 2.0 001-auto.sql )),
'2.0 schema gets generated properly'
);
- mkpath(catfile(splitdir($sql_dir), qw(SQLite upgrade 1.0-2.0 )));
+ dir($sql_dir, qw(SQLite upgrade 1.0-2.0 ))->mkpath;
$dm->prepare_upgrade({
from_version => '1.0',
to_version => '2.0',
ok( $warned, 'prepare_upgrade with a bogus preversion warns' );
}
ok(
- -f catfile(splitdir($sql_dir), qw(SQLite upgrade 1.0-2.0 001-auto.sql )),
+ -f file($sql_dir, qw(SQLite upgrade 1.0-2.0 001-auto.sql )),
'1.0-2.0 diff gets generated properly and default start and end versions get set'
);
- mkpath(catfile(splitdir($sql_dir), qw(SQLite downgrade 2.0-1.0 )));
+ dir($sql_dir, qw(SQLite downgrade 2.0-1.0 ))->mkpath;
$dm->prepare_downgrade({
from_version => $version,
to_version => '1.0',
version_set => [$version, '1.0']
});
ok(
- -f catfile(splitdir($sql_dir), qw(SQLite downgrade 2.0-1.0 001-auto.sql )),
+ -f file($sql_dir, qw(SQLite downgrade 2.0-1.0 001-auto.sql )),
'2.0-1.0 diff gets generated properly'
);
dies_ok {
})
} 'schema not uppgrayyed';
- mkpath catfile(splitdir($sql_dir), qw(_common upgrade 1.0-2.0 ));
+ dir($sql_dir, qw(_common upgrade 1.0-2.0 ))->mkpath;
open my $common, '>',
- catfile(splitdir($sql_dir), qw(_common upgrade 1.0-2.0 002-semiautomatic.sql ));
+ file($sql_dir, qw(_common upgrade 1.0-2.0 002-semiautomatic.sql ));
print {$common} qq<INSERT INTO Foo (bar, baz) VALUES ("hello", "world");\n\n>;
close $common;
open my $common_pl, '>',
- catfile(splitdir($sql_dir), qw(_common upgrade 1.0-2.0 003-semiautomatic.pl ));
+ file($sql_dir, qw(_common upgrade 1.0-2.0 003-semiautomatic.pl ));
print {$common_pl} q|
sub {
my $schema = shift;
my $version = $s->schema_version();
$dm->prepare_deploy;
ok(
- -f catfile(splitdir($sql_dir), qw(SQLite deploy 3.0 001-auto.sql )),
+ -f file($sql_dir, qw(SQLite deploy 3.0 001-auto.sql )),
'2.0 schema gets generated properly'
);
$dm->prepare_downgrade({
version_set => [$version, '1.0']
});
ok(
- -f catfile(splitdir($sql_dir), qw(SQLite downgrade 3.0-1.0 001-auto.sql )),
+ -f file($sql_dir, qw(SQLite downgrade 3.0-1.0 001-auto.sql )),
'3.0-1.0 diff gets generated properly'
);
$dm->prepare_upgrade({
version_set => ['1.0', $version]
});
ok(
- -f catfile(splitdir($sql_dir), qw(SQLite upgrade 1.0-3.0 001-auto.sql )),
+ -f file($sql_dir, qw(SQLite upgrade 1.0-3.0 001-auto.sql )),
'1.0-3.0 diff gets generated properly'
);
$dm->prepare_upgrade({
}
'prepare_upgrade dies if you clobber an existing upgrade file' ;
ok(
- -f catfile(splitdir($sql_dir), qw(SQLite upgrade 1.0-2.0 001-auto.sql )),
+ -f file($sql_dir, qw(SQLite upgrade 1.0-2.0 001-auto.sql )),
'2.0-3.0 diff gets generated properly'
);
dies_ok {
use aliased
'DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::Deprecated';
-use File::Spec::Functions qw(catfile splitdir);
+use Path::Class 'file';
use File::Temp 'tempdir';
my $dbh = DBICDHTest::dbh();
$dm->prepare_deploy;
ok(
- -f catfile(splitdir($sql_dir), qw(DBICVersion-Schema-1.0-SQLite.sql )),
+ -f file($sql_dir, qw(DBICVersion-Schema-1.0-SQLite.sql )),
'1.0 schema gets generated properly'
);
use lib 't/lib';
use DBICDHTest;
use aliased 'DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator';
-use File::Spec::Functions qw(catfile splitdir);
-use File::Path qw(rmtree mkpath);
+use Path::Class qw(dir file);
use File::Temp qw(tempfile tempdir);
my $dbh = DBICDHTest::dbh();
});
$dm->prepare_deploy;
- mkpath(catfile(splitdir($sql_dir), qw(_preprocess_schema upgrade 1.0-2.0 )));
+ dir($sql_dir, qw(_preprocess_schema upgrade 1.0-2.0 ))->mkpath;
open my $prerun, '>',
- catfile(splitdir($sql_dir), qw(_preprocess_schema upgrade 1.0-2.0 003-semiautomatic.pl ));
+ file($sql_dir, qw(_preprocess_schema upgrade 1.0-2.0 003-semiautomatic.pl ));
my (undef, $fn) = tempfile(OPEN => 0);
print {$prerun}
qq^sub {
use strict;
use warnings;
-use File::Path 'remove_tree';
use DBI;
sub dbh {
use strict;
use warnings;
-use File::Path 'remove_tree';
-use Test::More;
-
-sub ready {
- if (-d 't/sql') {
- remove_tree('t/sql');
- mkdir 't/sql';
- }
-}
-
sub dbh {
DBI->connect('dbi:SQLite::memory:', undef, undef, { RaiseError => 1 })
}