From: Devin Austin Date: Mon, 23 Jan 2012 02:32:01 +0000 (-0700) Subject: removed Method::Signatures::Simple X-Git-Tag: v0.001006~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6e2665d32fec2eb9c168202abaf45e26fa87470e;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git removed Method::Signatures::Simple --- diff --git a/Changes b/Changes index 2e3ff02..4e14685 100644 --- a/Changes +++ b/Changes @@ -5,6 +5,7 @@ Revision history for {{$dist->name}} - croak on a couple errors that should be fatal - Stop deleting the wrong version (for downgrades) - Fix documentation for in the Cookbook (moltar) + - removed Method::Signatures::Simple stuff (dhoss) 0.001005 2011-04-13 15:21:08 CST6CDT - Add _any "version" for running code for all versions diff --git a/dist.ini b/dist.ini index f35abe6..6294636 100644 --- a/dist.ini +++ b/dist.ini @@ -29,7 +29,6 @@ File::Path = 2.08 File::Touch = 0.08 DBIx::Class = 0.08121 Moose = 1.0 -Method::Signatures::Simple = 0.05 MooseX::Role::Parameterized = 0.18 Try::Tiny = 0 SQL::Translator = 0.11005 diff --git a/lib/DBIx/Class/DeploymentHandler/Dad.pm b/lib/DBIx/Class/DeploymentHandler/Dad.pm index 1fb3520..6c92ab2 100644 --- a/lib/DBIx/Class/DeploymentHandler/Dad.pm +++ b/lib/DBIx/Class/DeploymentHandler/Dad.pm @@ -3,7 +3,6 @@ package DBIx::Class::DeploymentHandler::Dad; # ABSTRACT: Parent class for DeploymentHandlers use Moose; -use Method::Signatures::Simple; require DBIx::Class::Schema; # loaded for type constraint use Carp::Clan '^DBIx::Class::DeploymentHandler'; use DBIx::Class::DeploymentHandler::Logger; @@ -41,7 +40,8 @@ has schema_version => ( sub _build_schema_version { $_[0]->schema->schema_version } -method install { +sub install { + my $self = shift; log_info { 'installing version ' . $self->to_version }; croak 'Install not possible as versions table already exists in database' if $self->version_storage_is_installed; @@ -88,7 +88,8 @@ sub downgrade { log_warn { 'no version to run downgrade' } unless $ran_once; } -method backup { +sub backup { + my $self = shift; log_info { 'backing up' }; $self->storage->backup($self->backup_directory) } diff --git a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm index 1fbf933..167e455 100644 --- a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm +++ b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm @@ -11,7 +11,6 @@ use Log::Contextual qw(:log :dlog), -package_logger => env_prefix => 'DBICDH' }); -use Method::Signatures::Simple; use Try::Tiny; use SQL::Translator; @@ -49,7 +48,8 @@ has storage => ( lazy_build => 1, ); -method _build_storage { +sub _build_storage { + my $self = shift; my $s = $self->schema->storage; $s->_determine_driver; $s @@ -89,9 +89,13 @@ has schema_version => ( # this will probably never get called as the DBICDH # will be passing down a schema_version normally, which # is built the same way, but we leave this in place -method _build_schema_version { $self->schema->schema_version } +sub _build_schema_version { + my $self = shift; + $self->schema->schema_version +} -method __ddl_consume_with_prefix($type, $versions, $prefix) { +sub __ddl_consume_with_prefix { + my ($self, $type, $versions, $prefix) = @_; my $base_dir = $self->script_directory; my $main = catfile( $base_dir, $type ); @@ -137,15 +141,18 @@ method __ddl_consume_with_prefix($type, $versions, $prefix) { return [@files{sort keys %files}] } -method _ddl_initialize_consume_filenames($type, $version) { +sub _ddl_initialize_consume_filenames { + my ($self, $type, $version) = @_; $self->__ddl_consume_with_prefix($type, [ $version ], 'initialize') } -method _ddl_schema_consume_filenames($type, $version) { +sub _ddl_schema_consume_filenames { + my ($self, $type, $version) = @_; $self->__ddl_consume_with_prefix($type, [ $version ], 'deploy') } -method _ddl_protoschema_deploy_consume_filenames($version) { +sub _ddl_protoschema_deploy_consume_filenames { + my ($self, $version) = @_; my $base_dir = $self->script_directory; my $dir = catfile( $base_dir, '_source', 'deploy', $version); @@ -158,7 +165,8 @@ method _ddl_protoschema_deploy_consume_filenames($version) { return [@files{sort keys %files}] } -method _ddl_protoschema_upgrade_consume_filenames($versions) { +sub _ddl_protoschema_upgrade_consume_filenames { + my ($self, $versions) = @_; my $base_dir = $self->script_directory; my $dir = catfile( $base_dir, '_preprocess_schema', 'upgrade', join q(-), @{$versions}); @@ -172,7 +180,8 @@ method _ddl_protoschema_upgrade_consume_filenames($versions) { return [@files{sort keys %files}] } -method _ddl_protoschema_downgrade_consume_filenames($versions) { +sub _ddl_protoschema_downgrade_consume_filenames { + my ($self, $versions) = @_; my $base_dir = $self->script_directory; my $dir = catfile( $base_dir, '_preprocess_schema', 'downgrade', join q(-), @{$versions}); @@ -186,29 +195,34 @@ method _ddl_protoschema_downgrade_consume_filenames($versions) { return [@files{sort keys %files}] } -method _ddl_protoschema_produce_filename($version) { +sub _ddl_protoschema_produce_filename { + my ($self, $version) = @_; my $dirname = catfile( $self->script_directory, '_source', 'deploy', $version ); mkpath($dirname) unless -d $dirname; return catfile( $dirname, '001-auto.yml' ); } -method _ddl_schema_produce_filename($type, $version) { +sub _ddl_schema_produce_filename { + my ($self, $type, $version) = @_; my $dirname = catfile( $self->script_directory, $type, 'deploy', $version ); mkpath($dirname) unless -d $dirname; return catfile( $dirname, '001-auto.sql' ); } -method _ddl_schema_upgrade_consume_filenames($type, $versions) { +sub _ddl_schema_upgrade_consume_filenames { + my ($self, $type, $versions) = @_; $self->__ddl_consume_with_prefix($type, $versions, 'upgrade') } -method _ddl_schema_downgrade_consume_filenames($type, $versions) { +sub _ddl_schema_downgrade_consume_filenames { + my ($self, $type, $versions) = @_; $self->__ddl_consume_with_prefix($type, $versions, 'downgrade') } -method _ddl_schema_upgrade_produce_filename($type, $versions) { +sub _ddl_schema_upgrade_produce_filename { + my ($self, $type, $versions) = @_; my $dir = $self->script_directory; my $dirname = catfile( $dir, $type, 'upgrade', join q(-), @{$versions}); @@ -217,14 +231,16 @@ method _ddl_schema_upgrade_produce_filename($type, $versions) { return catfile( $dirname, '001-auto.sql' ); } -method _ddl_schema_downgrade_produce_filename($type, $versions, $dir) { +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; return catfile( $dirname, '001-auto.sql'); } -method _run_sql_array($sql) { +sub _run_sql_array { + my ($self, $sql) = @_; my $storage = $self->storage; $sql = [grep { @@ -250,12 +266,14 @@ method _run_sql_array($sql) { return join "\n", @$sql } -method _run_sql($filename) { +sub _run_sql { + my ($self, $filename) = @_; log_debug { "Running SQL from $filename" }; return $self->_run_sql_array($self->_read_sql_file($filename)); } -method _run_perl($filename, $versions) { +sub _run_perl { + my ($self, $filename, $versions) = @_; log_debug { "Running Perl from $filename" }; my $filedata = do { local( @ARGV, $/ ) = $filename; <> }; @@ -273,7 +291,8 @@ method _run_perl($filename, $versions) { } } -method _run_sql_and_perl($filenames, $sql_to_run, $versions) { +sub _run_sql_and_perl { + my ($self, $filenames, $sql_to_run, $versions) = @_; my @files = @{$filenames}; my $guard = $self->schema->txn_scope_guard if $self->txn_wrap; @@ -349,7 +368,8 @@ sub initialize { } } -method _sqldiff_from_yaml($from_version, $to_version, $db, $direction) { +sub _sqldiff_from_yaml { + my ($self, $from_version, $to_version, $db, $direction) = @_; my $dir = $self->script_directory; my $sqltargs = { add_drop_table => 1, @@ -419,7 +439,8 @@ method _sqldiff_from_yaml($from_version, $to_version, $db, $direction) { )]; } -method _sql_from_yaml($sqltargs, $from_file, $db) { +sub _sql_from_yaml { + my ($self, $sqltargs, $from_file, $db) = @_; my $schema = $self->schema; my $version = $self->schema_version; @@ -557,12 +578,14 @@ sub prepare_downgrade { ); } -method _coderefs_per_files($files) { +sub _coderefs_per_files { + my ($self, $files) = @_; no warnings 'redefine'; [map eval do { local( @ARGV, $/ ) = $_; <> }, @$files] } -method _prepare_changegrade($from_version, $to_version, $version_set, $direction) { +sub _prepare_changegrade { + my ($self, $from_version, $to_version, $version_set, $direction) = @_; my $schema = $self->schema; my $databases = $self->databases; my $dir = $self->script_directory; @@ -586,7 +609,8 @@ method _prepare_changegrade($from_version, $to_version, $version_set, $direction } } -method _read_sql_file($file) { +sub _read_sql_file { + my ($self, $file) = @_; return unless $file; open my $fh, '<', $file;