LEMONLDAP::NG : new utility to convert configuration file into SQL instructions

environments/ppa-mbqj77/deployments/1
Xavier Guimard 18 years ago
parent 2523a54943
commit 8807ddea7e
  1. 1
      modules/lemonldap-ng-manager/MANIFEST
  2. 5
      modules/lemonldap-ng-manager/META.yml
  3. 3
      modules/lemonldap-ng-manager/Makefile.PL
  4. 2
      modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager.pm
  5. 2
      modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/SOAP.pm
  6. 2
      modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Help.pm
  7. 109
      modules/lemonldap-ng-manager/scripts/lmConfig_File2MySQL

@ -64,6 +64,7 @@ Makefile.PL
MANIFEST
META.yml Module meta-data (added by MakeMaker)
README
scripts/lmConfig_File2MySQL
TODO
t/Lemonldap-NG-Manager.t
t/Lemonldap-NG-Manager-Conf.t

@ -1,12 +1,13 @@
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: Lemonldap-NG-Manager
version: 0.04
version: 0.5
version_from: lib/Lemonldap/NG/Manager.pm
installdirs: site
requires:
CGI: 0
CGI: 3.08
DBI: 0
LWP::UserAgent: 0
Storable: 0
XML::Simple: 0

@ -11,6 +11,9 @@ WriteMakefile(
'XML::Simple' => 0,
'LWP::UserAgent' => 0,
}, # e.g., Module::Name => 1.1
EXE_FILES => [
'scripts/lmConfig_File2MySQL',
],
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM => 'lib/Lemonldap/NG/Manager.pm', # retrieve abstract from module
AUTHOR => 'Xavier Guimard <x.guimard@free.fr>') : ()),

@ -13,7 +13,7 @@ use LWP::UserAgent;
our @ISA = qw(Lemonldap::NG::Manager::Base);
our $VERSION = '0.44';
our $VERSION = '0.5';
sub new {
my ( $class, $args ) = @_;

@ -3,7 +3,7 @@ package Lemonldap::NG::Manager::Conf::SOAP;
use strict;
use SOAP::Lite;
our $VERSION = 0.1;
our $VERSION = 0.11;
sub prereq {
my $self = shift;

@ -24,6 +24,8 @@ sub import {
}
}
# TODO: Help in English
1;
__END__

@ -0,0 +1,109 @@
#!/usr/bin/perl
use Getopt::Std;
use Lemonldap::NG::Manager::Conf;
use strict;
# Get ARGS
my %opts;
getopts( 'cau:p:t:', \%opts );
usage("configuration file required")
unless ( $ARGV[0] );
usage(qq#$ARGV[0] is not readable#)
unless ( -r $ARGV[0] );
my $table = $opts{t} || 'lmConfig';
if($opts{c}) {
print "CREATE TABLE $table (
cfgNum int not null primary key,
locationRules text,
exportedHeaders text,
globalStorage text,
globalStorageOptions text,
macros text,
groups text,
portal text,
domain text,
ldapServer text,
ldapPort int,
ldapBase text,
securedCookie int,
cookieName text,
authentication text,
exportedVars text,
managerDn text,
managerPassword text,
whatToTrace text\n);\n";
}
my $fields;
open FILE, $ARGV[0];
$/ = "";
while (<FILE>) {
my ( $k, $v ) = split /\n\s+/;
chomp $k;
next unless($k);
$v =~ s/\n*$//;
$fields->{$k} = $v;
}
print "INSERT INTO "
. $table . " (\n\t"
. join( ",\n\t", keys(%$fields) )
. ")\n VALUES (\n\t"
. join( ",\n\t", values(%$fields) )
. "\n );\n";
close FILE;
sub usage {
print STDERR shift;
print STDERR "\nusage: $0 <options> file
Options:
-t table : name of the table (default: lmConfig)
-c : add 'create table' instruction\n";
exit 1;
}
1;
__END__
=head1 NAME
lmConfig_File2MySQL - Perl utility to convert Lemonldap::NG configuration file
into MySQL SQL file.
=head1 SYNOPSIS
lmConf_File2MySQL <options> /path/to/lmConf-1
=head1 DESCRIPTION
Use this software to convert Lemonldap::NG configuration file into SQL
instructions.
=head2 Options
=over
=item * -c : add "create table" instruction
=item * -t : name of the table (lmConfig by default)
=back
=head1 SEE ALSO
Lemonldap::NG::Manager
=head1 AUTHOR
Xavier Guimard, E<lt>x.guimard@free.frE<gt>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2007 by LCL Guimard
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.8 or,
at your option, any later version of Perl 5 you may have available.
=cut
Loading…
Cancel
Save