From: Brian O'Connor Date: Thu, 15 Jan 2004 20:40:15 +0000 (+0000) Subject: Added a method based to the template to correctly reformat module names to include... X-Git-Tag: v0.06~238 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bed83b64c3cd7673055171e8aebff6a455b7f7cf;p=dbsrgits%2FSQL-Translator.git Added a method based to the template to correctly reformat module names to include cap chars after a '_' in the Turnkey producer embedded templates. --- diff --git a/lib/SQL/Translator/Producer/Turnkey.pm b/lib/SQL/Translator/Producer/Turnkey.pm index 1d800f6..5024a82 100644 --- a/lib/SQL/Translator/Producer/Turnkey.pm +++ b/lib/SQL/Translator/Producer/Turnkey.pm @@ -1,7 +1,7 @@ package SQL::Translator::Producer::Turnkey; # ------------------------------------------------------------------- -# $Id: Turnkey.pm,v 1.19 2004-01-09 02:41:35 boconnor Exp $ +# $Id: Turnkey.pm,v 1.20 2004-01-15 20:40:15 boconnor Exp $ # ------------------------------------------------------------------- # Copyright (C) 2003 Allen Day , # Brian O'Connor . @@ -23,7 +23,7 @@ package SQL::Translator::Producer::Turnkey; use strict; use vars qw[ $VERSION $DEBUG ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.19 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.20 $ =~ /(\d+)\.(\d+)/; $DEBUG = 1 unless defined $DEBUG; use SQL::Translator::Schema::Constants; @@ -58,6 +58,8 @@ sub produce { my %meta = ( format_fk => $t->format_fk_name, + format_package => $t->format_package_name, + format_module => $t->format_module_name, template => $args->{'template'} || '', baseclass => $baseclass, db_dsn => $args->{'db_dsn'} || '', @@ -462,7 +464,7 @@ EOF [% FOREACH node = nodes %] [% IF !node.value.is_trivial_link %] - + [%- END -%] [% END %] @@ -471,12 +473,12 @@ EOF [% FOREACH focus_atom = nodes %] [% IF !focus_atom.value.is_trivial_link %] [% FOREACH link_atom = focus_atom.value.hyperedges %] - + [%- END -%] [% previous = "" %] [% FOREACH link_atom = focus_atom.value.edges %] [% IF link_atom.type == 'export' && previous != link_atom.thatnode.table.name && link_atom.thatnode.table.name != "" %] - + [% previous = link_atom.thatnode.table.name %] [% END %] [%- END %] @@ -487,18 +489,18 @@ EOF [% FOREACH focus_atom = nodes %] [% IF !focus_atom.value.is_trivial_link %] - + [% FOREACH link_atom = focus_atom.value.hyperedges %] - + [%- END%] [% previous = "" %] [% FOREACH link_atom = focus_atom.value.edges %] [% IF link_atom.type == 'export' && previous != link_atom.thatnode.table.name %] - + [% previous = link_atom.thatnode.table.name %] [% END %] [%- END %] - + [%- END %] [% END %] @@ -511,7 +513,7 @@ EOF [% FOREACH focus_atom = nodes %] [% IF !focus_atom.value.is_trivial_link %] - + [%- END -%] [% END %] @@ -588,8 +590,8 @@ EOF [% MACRO renderatom(atom, dbobject) SWITCH atom.name %] [- FOREACH node = nodes -] [- IF !node.value.is_trivial_link -] - [% CASE '[- node.key FILTER ucfirst -]' %] - [% render[- node.key FILTER ucfirst -]Atom(atom,dbobject) %] + [% CASE '[- format_module(node.key) -]' %] + [% render[- format_module(node.key) -]Atom(atom,dbobject) %] [- END -] [- END -] [% CASE DEFAULT %] @@ -597,13 +599,13 @@ EOF [% END %] [- FOREACH node = nodes -] [- IF !node.value.is_trivial_link -] -[% MACRO render[- node.key FILTER ucfirst -]Atom(atom, dbobject) BLOCK %] +[% MACRO render[- format_module(node.key) -]Atom(atom, dbobject) BLOCK %] [% lstArr = atom.render(dbobject) %] [% rowcount = 0 %] [% IF atom.focus == "yes" %] [% FOREACH record = lstArr %] [% fields = record.data %] - [- pname = node.key FILTER ucfirst -] + [- pname = format_module(node.key) -] [- pkey = "Turnkey::Model::${pname}" -] [- FOREACH field = node.value.data_fields -] [- IF field != "1" -]