--- /dev/null
+Revision history for DBIx-Class-Fixtures
+
+
--- /dev/null
+Changes
+MANIFEST
+Makefile.PL
+README
+lib/DBIx/Class/Fixtures.pm
+t/00-load.t
--- /dev/null
+use strict;
+use warnings;
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+ NAME => 'DBIx::Class::Fixtures',
+ AUTHOR => 'Luke Saunders <luke@shadowcatsystems.co.uk>',
+ VERSION_FROM => 'lib/DBIx/Class/Fixtures.pm',
+ PL_FILES => {},
+ PREREQ_PM => {
+ 'Test::More' => 0,
+ },
+ dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
+ clean => { FILES => 'DBIx-Class-Fixtures-*' },
+);
--- /dev/null
+DBIx-Class-Fixtures
+
+INSTALLATION
+
+To install this module, run the following commands:
+
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+COPYRIGHT AND LICENCE
+
+Development sponsored by takkle.com
+
+Copyright (C) 2008 Luke Saunders <luke at shadowcatsystems.com>, some rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
--- /dev/null
+package DBIx::Class::Fixtures;
+
+use strict;
+use warnings;
+
+use DBIx::Class::Exception;
+use Class::Accessor;
+use Path::Class qw(dir file);
+use FindBin;
+use JSON::Syck qw(LoadFile);
+use Data::Dumper;
+
+use base qw(Class::Accessor);
+
+__PACKAGE__->mk_accessors(qw(config_dir));
+
+=head1 VERSION
+
+Version 1.000
+
+=cut
+
+our $VERSION = '1.000';
+
+=head1 NAME
+
+=head1 SYNOPSIS
+
+ use DBIx::Class::Fixtures;
+
+ ...
+
+ my $fixtures = DBIx::Class::Fixtures->new({ config_dir => '/home/me/app/fixture_configs' });
+
+ $fixtures->dump({
+ config => 'set_config.json',
+ schema => $source_dbic_schema,
+ directory => '/home/me/app/fixtures'
+ });
+
+ $fixtures->populate({
+ directory => '/home/me/app/fixtures',
+ ddl => '/home/me/app/sql/ddl.sql',
+ connection_details => ['dbi:mysql:dbname=app_dev', 'me', 'password']
+ });
+
+=head1 DESCRIPTION
+
+=head1 AUTHOR
+
+=head1 CONTRIBUTORS
+
+=cut
+
+
+sub new {
+ my $class = shift;
+
+ my ($params) = @_;
+ unless (ref $params eq 'HASH') {
+ return DBIx::Class::Exception->throw('first arg to DBIx::Class::Fixtures->new() must be hash ref');
+ }
+
+ unless ($params->{config_dir}) {
+ return DBIx::Class::Exception->throw('config_dir param not specified');
+ }
+
+ my $config_dir = dir($params->{config_dir});
+ unless (-e $params->{config_dir}) {
+ return DBIx::Class::Exception->throw('config_dir directory doesn\'t exist');
+ }
+
+ my $self = {
+ config_dir => $config_dir
+ };
+
+ bless $self, $class;
+
+ return $self;
+}
+
+1;
--- /dev/null
+#!perl -T
+
+use Test::More tests => 1;
+
+BEGIN {
+ use_ok( 'DBIx::Class::Fixtures' );
+}
+
+diag( "Testing DBIx::Class::Fixtures $DBIx::Class::Fixtures::VERSION, Perl $], $^X" );
--- /dev/null
+#!perl
+
+use DBIx::Class::Fixtures;
+use Test::More tests => 3;
+
+my $config_dir = 't/var/configs';
+my $imaginary_config_dir = 't/var/not_there';
+
+eval {
+ DBIx::Class::Fixtures->new({ });
+};
+ok($@, 'new errors without config dir');
+
+eval {
+ DBIx::Class::Fixtures->new({ config_dir => $imaginary_config_dir });
+};
+ok($@, 'new errors with non-existent config dir');
+
+ok(my $fixtures = DBIx::Class::Fixtures->new({ config_dir => $config_dir }), 'object created with correct config dir');