X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=scripts%2Frose_auto_create_model.pl;h=14e4ba0fcd5a97cf73f3d98581e95b3b8f038c91;hb=ba9e8d21c38c501c24f3c9b5d2b33c01dc2d9ea7;hp=2aaac2beb0bf9998db48986b5f0c44f95eabc2bf;hpb=fd6e2de4d2753ee73574abfaff1d37c0916fea3a;p=kivitendo-erp.git diff --git a/scripts/rose_auto_create_model.pl b/scripts/rose_auto_create_model.pl index 2aaac2beb..14e4ba0fc 100755 --- a/scripts/rose_auto_create_model.pl +++ b/scripts/rose_auto_create_model.pl @@ -31,7 +31,6 @@ my %blacklist = SL::DB::Helper::Mappings->get_blacklist; my %package_names = SL::DB::Helper::Mappings->get_package_names; our $form; -our $cgi; our $auth; our %lx_office_conf; @@ -56,13 +55,13 @@ sub setup { usage(); } - $::lxdebug = LXDebug->new(); + $::lxdebug = LXDebug->new(); $::locale = Locale->new("de"); $::form = new Form; - $::cgi = new CGI(''); $::auth = SL::Auth->new(); - $::user = User->new($login); - %::myconfig = $auth->read_user($login); + $::user = User->new(login => $login); + %::myconfig = $auth->read_user(login => $login); + $::request = { cgi => CGI->new({}) }; $form->{script} = 'rose_meta_data.pl'; $form->{login} = $login; @@ -161,14 +160,13 @@ CODE sub parse_args { my ($options) = @_; GetOptions( - 'login|user=s' => \ my $login, - all => \ my $all, - sugar => \ my $sugar, - 'no-commit' => \ my $nocommit, - 'dry-run' => \ my $nocommit, - help => sub { pod2usage(verbose => 99, sections => 'NAME|SYNOPSIS|OPTIONS') }, - verbose => \ my $verbose, - diff => \ my $diff, + 'login|user=s' => \ my $login, + all => \ my $all, + sugar => \ my $sugar, + 'no-commit|dry-run' => \ my $nocommit, + help => sub { pod2usage(verbose => 99, sections => 'NAME|SYNOPSIS|OPTIONS') }, + verbose => \ my $verbose, + diff => \ my $diff, ); $options->{login} = $login if $login; @@ -296,12 +294,19 @@ database connection, and the piece of mind that comes from knowing that your class is stable, and won't change behind your back in response to an "action at a distance" (i.e., a database schema update).> -Unfortunately this ready easier than it is, since classes need to get in the -right package and directory, certain stuff need to be adjusted and table names +Unfortunately this reads easier than it is, since classes need to go into the +right package and directory, certain stuff needs to be adjusted and table names need to be translated into their class names. This script will wrap all that behind a few simple options. -In the most basic version, just give it a login and +In the most basic version, just give it a login and a table name, and it will +load the schema information for this table and create the appropriate class +files, or update them if already present. + +Each table has two associated files. A C class, which is +a perl version of the schema definition, and a C class file. The +first one will be updated if the schema changes, the second one will only be +created if it does not exist. =head1 OPTIONS @@ -328,12 +333,12 @@ you debug schema awareness of the RDBO layer. =item C<--dry-run> Do not write back generated files. This will do everything as usual but not -actually modify any files. +actually modify any file. =item C<--diff> -Displays diff for selected file, if file is present and never file is -different. bware, does not imply C. +Displays diff for selected file, if file is present and newer file is +different. Beware, does not imply C<--no-commit>. =item C<--help, -h>