Manage Common/Constants.pm with jsongenerator and add $hashParameters constant

This commit is contained in:
Xavier Guimard 2016-01-11 06:27:16 +00:00
parent 64099c2ca3
commit c65fd986f5
4 changed files with 80 additions and 13 deletions

View File

@ -129,6 +129,7 @@ MANAGERJSONDST=$(SRCMANAGERDIR)/site/static/struct.json \
$(SRCMANAGERDIR)/lib/Lemonldap/NG/Manager/Attributes.pm \
$(SRCMANAGERDIR)/lib/Lemonldap/NG/Manager/Constants.pm \
$(SRCCOMMONDIR)/lib/Lemonldap/NG/Common/Conf/DefaultValues.pm \
$(SRCCOMMONDIR)/lib/Lemonldap/NG/Common/Conf/Constants.pm \
_example/conf/lmConf-1.js
PERLCOMMONSRC:=$(shell find $(SRCCOMMONDIR)/lib -name '*.pm')
PERLCOMMONDST=$(SRCCOMMONDIR)/blib/lib/Lemonldap/NG/Common.pm

View File

@ -1,11 +1,11 @@
# This file is generated by Lemonldap::NG::Manager::Build. Don't modify it by hand
package Lemonldap::NG::Common::Conf::Constants;
use strict;
use utf8;
use Exporter 'import';
use base qw(Exporter);
our $VERSION = '1.0.2';
our $VERSION = '1.9.0';
# CONSTANTS
@ -23,6 +23,8 @@ use constant HANDLERSECTION => "handler";
use constant MANAGERSECTION => "manager";
use constant SESSIONSEXPLORERSECTION => "sessionsExplorer";
use constant APPLYSECTION => "apply";
our $hashParameters = '(?:(?:g(?:r(?:antSessionRule|oup)|lobalStorageOption|oogleExportedVar)|l(?:o(?:calSessionStorageOption|goutService)|dapExportedVar)|ca(?:s(?:StorageOption|Attribute)|ptchaStorageOption)|(?:(?:d(?:emo|bi)|facebook|webID)E|e)xportedVar|p(?:ersistentStorageOption|ortalSkinRule)|re(?:moteGlobalStorageOption|loadUrl)|notificationStorageOption|CAS_proxiedService|macro)s|s(?:aml(?:S(?:PMetaDataNode|torageOptions)|IDPMetaDataNode)|essionDataToRemember|laveExportedVars)|o(?:idc(?:S(?:erviceMetaDataAuthnContext|torageOptions)|[OR]PMetaDataNode)|penIdExportedVars)|a(?:uthChoiceModules|pplicationList)|virtualHost)';
our %EXPORT_TAGS = (
'all' => [
@ -41,13 +43,11 @@ our %EXPORT_TAGS = (
MANAGERSECTION
SESSIONSEXPLORERSECTION
APPLYSECTION
$hashParameters
)
]
);
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
our @EXPORT = ( @{ $EXPORT_TAGS{'all'} } );
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
our @EXPORT = ( @{ $EXPORT_TAGS{'all'} } );
1;
__END__

View File

@ -18,6 +18,7 @@ has confTreeFile => ( isa => 'Str', is => 'ro', required => 1 );
has managerConstantsFile => ( isa => 'Str', is => 'ro', required => 1 );
has managerAttributesFile => ( isa => 'Str', is => 'ro', required => 1 );
has defaultValuesFile => ( isa => 'Str', is => 'ro', required => 1 );
has confConstantsFile => ( isa => 'Str', is => 'ro', required => 1 );
has firstLmConfFile => ( isa => 'Str', is => 'ro', required => 1 );
my @managerAttrKeys = qw(keyTest select type test msgFail default);
@ -216,6 +217,70 @@ $defaultAttr}
close F;
print STDERR "done\n";
printf STDERR $format, $self->confConstantsFile;
$ra = Regexp::Assemble->new;
foreach ( @simpleHashKeys, sort keys %cnodesRe ) {
$ra->add($_);
}
my $confConstants = "our \$hashParameters = '" . $ra->as_string . "';\n";
open( F, ">", $self->confConstantsFile ) or die($!);
print F <<EOF;
# This file is generated by $module. Don't modify it by hand
package Lemonldap::NG::Common::Conf::Constants;
use strict;
use Exporter 'import';
use base qw(Exporter);
our \$VERSION = '$Lemonldap::NG::Manager::Build::Attributes::VERSION';
# CONSTANTS
use constant CONFIG_WAS_CHANGED => -1;
use constant UNKNOWN_ERROR => -2;
use constant DATABASE_LOCKED => -3;
use constant UPLOAD_DENIED => -4;
use constant SYNTAX_ERROR => -5;
use constant DEPRECATED => -6;
use constant DEFAULTCONFFILE => "/usr/local/lemonldap-ng/etc/lemonldap-ng.ini";
use constant DEFAULTSECTION => "all";
use constant CONFSECTION => "configuration";
use constant PORTALSECTION => "portal";
use constant HANDLERSECTION => "handler";
use constant MANAGERSECTION => "manager";
use constant SESSIONSEXPLORERSECTION => "sessionsExplorer";
use constant APPLYSECTION => "apply";
$confConstants
our %EXPORT_TAGS = (
'all' => [
qw(
CONFIG_WAS_CHANGED
UNKNOWN_ERROR
DATABASE_LOCKED
UPLOAD_DENIED
SYNTAX_ERROR
DEPRECATED
DEFAULTCONFFILE
DEFAULTSECTION
CONFSECTION
PORTALSECTION
HANDLERSECTION
MANAGERSECTION
SESSIONSEXPLORERSECTION
APPLYSECTION
\$hashParameters
)
]
);
our \@EXPORT_OK = ( \@{ \$EXPORT_TAGS{'all'} } );
our \@EXPORT = ( \@{ \$EXPORT_TAGS{'all'} } );
1;
EOF
close F;
print STDERR "done\n";
printf STDERR $format, $self->managerAttributesFile;
my $managerAttr = {
map {

View File

@ -3,11 +3,12 @@
use Lemonldap::NG::Manager::Build;
Lemonldap::NG::Manager::Build->run(
structFile => "lemonldap-ng-manager/site/static/struct.json",
confTreeFile => "lemonldap-ng-manager/site/static/js/conftree.js",
managerConstantsFile => "lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Constants.pm",
structFile => 'lemonldap-ng-manager/site/static/struct.json',
confTreeFile => 'lemonldap-ng-manager/site/static/js/conftree.js',
managerConstantsFile => 'lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Constants.pm',
managerAttributesFile => 'lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Attributes.pm',
defaultValuesFile => "lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/DefaultValues.pm",
firstLmConfFile => "_example/conf/lmConf-1.js",
defaultValuesFile => 'lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/DefaultValues.pm',
confConstantsFile => 'lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Constants.pm',
firstLmConfFile => '_example/conf/lmConf-1.js',
);