From: Luke Saunders Date: Sat, 2 Feb 2008 00:07:48 +0000 (+0000) Subject: ported all system commands to perl for portability X-Git-Tag: v1.001002~48 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6116de112a21f133344715a4afcd1bba6cf8c267;p=dbsrgits%2FDBIx-Class-Fixtures.git ported all system commands to perl for portability --- diff --git a/Makefile.PL b/Makefile.PL index 65229ec..e83e604 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -12,9 +12,8 @@ WriteMakefile( 'DBIx::Class' => 0, 'Class::Accessor' => 0, 'Path::Class' => 0, - 'Config::Any' => 0, + 'Config::Any::JSON' => 0, 'Data::Dump::Streamer' => 0, - 'File::Slurp' => 0, 'Hash::Merge' => 0, }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, diff --git a/lib/DBIx/Class/Fixtures.pm b/lib/DBIx/Class/Fixtures.pm index 495c841..044c537 100644 --- a/lib/DBIx/Class/Fixtures.pm +++ b/lib/DBIx/Class/Fixtures.pm @@ -6,12 +6,13 @@ use warnings; use DBIx::Class::Exception; use Class::Accessor; use Path::Class qw(dir file); +use File::Slurp; use Config::Any::JSON; use Data::Dump::Streamer; use Data::Visitor::Callback; -use File::Slurp; use File::Path; use File::Copy::Recursive qw/dircopy/; +use File::Copy qw/move/; use Hash::Merge qw( merge ); use Data::Dumper; @@ -55,6 +56,8 @@ DBIx::Class::Fixtures =head1 AUTHOR +Luke Saunders + =head1 CONTRIBUTORS =head1 METHODS @@ -129,14 +132,12 @@ sub dump { $self->msg("generating fixtures"); my $tmp_output_dir = dir($output_dir, '-~dump~-'); - unless (-e $tmp_output_dir) { - $self->msg("- creating $tmp_output_dir"); - mkdir($tmp_output_dir, 0777); - }else { + if (-e $tmp_output_dir) { $self->msg("- clearing existing $tmp_output_dir"); - # delete existing fixture set - system("rm -rf $tmp_output_dir/*"); + $tmp_output_dir->rmtree; } + $self->msg("- creating $tmp_output_dir"); + $tmp_output_dir->mkpath; # write version file (for the potential benefit of populate) my $version_file = file($tmp_output_dir, '_dumper_version'); @@ -189,7 +190,7 @@ sub dump { } $self->msg("- moving temp dir to $output_dir"); - system("mv $tmp_output_dir/* $output_dir/"); + move($_, dir($output_dir, $_->relative($_->parent)->stringify)) for $tmp_output_dir->children; if (-e $output_dir) { $self->msg("- clearing tmp dir $tmp_output_dir"); # delete existing fixture set diff --git a/lib/DBIx/Class/Fixtures/Versioned.pm b/lib/DBIx/Class/Fixtures/Versioned.pm index 3533688..48f29f4 100644 --- a/lib/DBIx/Class/Fixtures/Versioned.pm +++ b/lib/DBIx/Class/Fixtures/Versioned.pm @@ -4,6 +4,7 @@ use strict; use warnings; use base qw/DBIx::Class::Fixtures/; +use DBIx::Class::Fixtures::SchemaVersioned; use Class::C3; =head1 VERSION