Commit 20349741 authored by Xavier Guimard's avatar Xavier Guimard

Move files that should be used only by jsongenerator.pl in Manager/Build

git-svn-id: svn://svn.forge.objectweb.org/svnroot/lemonldap/trunk@4080 1dbb9719-a921-0410-b57f-c3a383c2c641
parent ac4cb6f8
......@@ -120,8 +120,8 @@ ERASECONFIG=1 # Set to 0 if you do not want to replace your configuration
# GENERATED SRC FILESlemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/DefaultValues.pm
MANAGERJSONSRC=$(SRCMANAGERDIR)/scripts/jsongenerator.pl \
$(SRCMANAGERDIR)/lib/Lemonldap/NG/Manager/Attributes.pm \
$(SRCMANAGERDIR)/lib/Lemonldap/NG/Manager/Tree.pm
$(SRCMANAGERDIR)/lib/Lemonldap/NG/Manager/Build/Attributes.pm \
$(SRCMANAGERDIR)/lib/Lemonldap/NG/Manager/Build/Tree.pm
MANAGERJSONDST=$(SRCMANAGERDIR)/site/static/struct.json \
$(SRCMANAGERDIR)/site/static/js/conftree.js \
$(SRCMANAGERDIR)/lib/Lemonldap/NG/Manager/Constants.pm \
......
......@@ -7,15 +7,16 @@ eg/manager-server.psgi
KINEMATIC.md
lib/Lemonldap/NG/Manager.pm
lib/Lemonldap/NG/Manager/Attributes.pm
lib/Lemonldap/NG/Manager/Build/Attributes.pm
lib/Lemonldap/NG/Manager/Build/CTrees.pm
lib/Lemonldap/NG/Manager/Build/Tree.pm
lib/Lemonldap/NG/Manager/Conf.pm
lib/Lemonldap/NG/Manager/Conf/Tests.pm
lib/Lemonldap/NG/Manager/ConfParser.pm
lib/Lemonldap/NG/Manager/Constants.pm
lib/Lemonldap/NG/Manager/CTrees.pm
lib/Lemonldap/NG/Manager/Lib.pm
lib/Lemonldap/NG/Manager/Notifications.pm
lib/Lemonldap/NG/Manager/Sessions.pm
lib/Lemonldap/NG/Manager/Tree.pm
Makefile.PL
MANIFEST This list of files
META.yml
......
......@@ -2,11 +2,6 @@
* Check for eval with SAML
* Icon picker for application logo
* Change documentation lang when changing language
## Bugs
* SAML IDP/SP exported attributes not working
## Configuration management
......@@ -15,10 +10,8 @@
### Struct & datas
* Tests for new confs
* default values: TODO, deliver a "0" conf when no conf is available
* Forms:
* file: load from URL + download
* Grant session rule
* OpenID white/black list
* POST replay fields
......@@ -31,11 +24,6 @@
## Sessions explorer
## Optimization
* Use JSON to store datas:
* sessions: new Apache::Session::Serialize::JSON module
## Doc
* Wiki doc
......
......@@ -121,8 +121,8 @@ Lemonldap::NG Manager contains 4 parts:
=head2 Generation of static files
The `scripts/jsongenerator.pl` file uses Lemonldap::NG::Manager::Attributes,
Lemonldap::NG::Manager::Tree and Lemonldap::NG::Manager::CTrees to generate
The `scripts/jsongenerator.pl` file uses Lemonldap::NG::Manager::Build::Attributes,
Lemonldap::NG::Manager::Build::Tree and Lemonldap::NG::Manager::Build::CTrees to generate
=over
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -8,11 +8,11 @@
#
# Conf parameters are just strings in the `nodes` array
#
# All other ideas have to be set in Common/Conf/Attributes.pm !
# All other ideas have to be set in Manager/Build/Attributes.pm !
# DON'T FORGET TO RUN jsongenerator.pl AFTER EACH CHANGE
package Lemonldap::NG::Manager::CTrees;
package Lemonldap::NG::Manager::Build::CTrees;
sub cTrees {
return {
......
......@@ -7,11 +7,11 @@
#
# Conf parameters are just strings in the `nodes` array
#
# All other ideas have to be set in Common/Conf/Attributes.pm !
# All other ideas have to be set in Manager/Build/Attributes.pm !
# DON'T FORGET TO RUN jsongenerator.pl AFTER EACH CHANGE
package Lemonldap::NG::Manager::Tree;
package Lemonldap::NG::Manager::Build::Tree;
our $VERSION = '1.9.0';
......
......@@ -2,9 +2,9 @@
use strict;
use Lemonldap::NG::Manager::Attributes;
use Lemonldap::NG::Manager::Tree;
use Lemonldap::NG::Manager::CTrees;
use Lemonldap::NG::Manager::Build::Attributes;
use Lemonldap::NG::Manager::Build::Tree;
use Lemonldap::NG::Manager::Build::CTrees;
#use Lemonldap::NG::Manager;
use Data::Dumper;
......@@ -29,6 +29,7 @@ my $confTreeFile = "site/static/js/conftree.js";
my $managerConstants = "lib/Lemonldap/NG/Manager/Constants.pm";
my $defaultValuesFile =
"../lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/DefaultValues.pm";
my $managerAttributesFile = 'lib/Lemonldap/NG/Manager/Attributes.pm';
my @simpleHashKeys;
my @sessionTypes;
my @cnodesKeys;
......@@ -51,7 +52,7 @@ $Data::Dumper::Sortkeys = sub {
];
};
my $attributes = Lemonldap::NG::Manager::Attributes::attributes();
my $attributes = Lemonldap::NG::Manager::Build::Attributes::attributes();
my $jsonEnc = JSON->new()->allow_nonref;
my $mainTree;
my @ignoreKeys;
......@@ -62,7 +63,7 @@ $jsonEnc->canonical(1);
# 1. confTree.js
unless ( $opts{f} ) {
$mainTree = Lemonldap::NG::Manager::CTrees::cTrees();
$mainTree = Lemonldap::NG::Manager::Build::CTrees::cTrees();
my $script =
'function templates(tpl,key){'
......@@ -75,7 +76,7 @@ unless ( $opts{f} ) {
. 'switch(tpl){';
# To build confTree.js, each special node is scanned from
# Lemonldap::NG::Manager::CTrees
# Lemonldap::NG::Manager::Build::CTrees
foreach my $node ( sort keys $mainTree ) {
@cnodesKeys = ();
my $jsonTree = [];
......@@ -111,7 +112,7 @@ unless ( $opts{f} ) {
}
# 2. struct.json
$mainTree = Lemonldap::NG::Manager::Tree::tree();
$mainTree = Lemonldap::NG::Manager::Build::Tree::tree();
my $jsonTree = [];
&scanTree( $mainTree, $jsonTree, '', '' );
my $script = 'function setScopeVars(scope){';
......@@ -144,7 +145,7 @@ use strict;
use Exporter 'import';
use base qw(Exporter);
our \$VERSION = '$Lemonldap::NG::Manager::Attributes::VERSION';
our \$VERSION = '$Lemonldap::NG::Manager::Build::Attributes::VERSION';
our %EXPORT_TAGS = ( 'all' => [qw($exportedVars)] );
our \@EXPORT_OK = ( \@{ \$EXPORT_TAGS{'all'} } );
......@@ -183,11 +184,35 @@ my $defaultValues = {
} keys(%$attributes)
};
my $defaultAttr = Dumper($defaultValues);
my $managerAttr = {
map {
my @r;
foreach my $f (qw(keyTest type test msgFail default)) {
push @r, $f, $attributes->{$_}->{$f}
if ( defined $attributes->{$_}->{$f} );
}
( $_ => {@r} );
} keys(%$attributes)
};
$managerAttr = Dumper($managerAttr);
$managerAttr =~ s/^\$VAR1\s*=/sub attributes {\n return/;
my $managerTypes = Dumper(Lemonldap::NG::Manager::Build::Attributes::types());
$managerTypes =~ s/^\$VAR1\s*=/sub types {\n return/;
$managerAttr = "# This file is generated by $0. Don't modify it by hand
package Lemonldap::NG::Manager::Attributes;
our \$VERSION = '$Lemonldap::NG::Manager::Build::Attributes::VERSION';
$managerTypes}
$managerAttr}
";
$defaultAttr =~ s/^\$VAR1\s*=/sub defaultValues {\n return/;
$defaultAttr = "# This file is generated by $0. Don't modify it by hand
package Lemonldap::NG::Common::Conf::DefaultValues;
our \$VERSION = '$Lemonldap::NG::Manager::Attributes::VERSION';
our \$VERSION = '$Lemonldap::NG::Manager::Build::Attributes::VERSION';
$defaultAttr}
......@@ -198,6 +223,17 @@ my $dst;
eval {
require Perl::Tidy;
Perl::Tidy::perltidy(
source => IO::String->new($managerAttr),
destination => \$dst
);
};
$dst = $managerAttr if ($@);
open( F, "> $managerAttributesFile" ) or die($!);
print F $dst;
close F;
eval {
Perl::Tidy::perltidy(
source => IO::String->new($defaultAttr),
destination => \$dst
......@@ -273,7 +309,8 @@ sub scanTree {
if ( $leaf =~ s/^\*// ) {
push @angularScopeVars, [ $leaf, "$path._nodes[$ord]" ];
}
push @sessionTypes, $1 if ( $leaf =~ /^(.*)(?<!notification)StorageOptions$/ );
push @sessionTypes, $1
if ( $leaf =~ /^(.*)(?<!notification)StorageOptions$/ );
my $attr = $attributes->{$leaf} or die("Missing attribute $leaf");
$jleaf = { id => "$prefix$leaf", title => $leaf };
unless ( $attr->{type} ) {
......
......@@ -3,10 +3,10 @@
This files contains the form used to expose configuration attributes. The form
is chosen by looking at the *type* property of the current data.
This property is defined in `Lemonldap::NG::Manager::Attributes` package.
This property is defined in `Lemonldap::NG::Manager::Build::Attributes` package.
By default, it is set to *text*.
`Lemonldap::NG::Manager::Attributes` is compiled into JSON/JS files by
`Lemonldap::NG::Manager::Build::Attributes` is compiled into JSON/JS files by
`jsongenerator.pl`script.
## 1. Form file architecture
......
......@@ -7,9 +7,9 @@ use 5.10.0;
my $formDir = 'site/static/forms';
my $count = 0;
use_ok('Lemonldap::NG::Manager::Tree');
use_ok('Lemonldap::NG::Manager::CTrees');
use_ok('Lemonldap::NG::Manager::Attributes');
use_ok('Lemonldap::NG::Manager::Build::Tree');
use_ok('Lemonldap::NG::Manager::Build::CTrees');
use_ok('Lemonldap::NG::Manager::Build::Attributes');
$count += 3;
ok( opendir( D, $formDir ), 'Found forms dir' );
......@@ -20,9 +20,9 @@ delete $forms{white};
delete $forms{restore};
my ( @types, $attr, $tree, $ctrees );
ok( $tree = Lemonldap::NG::Manager::Tree::tree(), 'Get tree' );
ok( $ctrees = Lemonldap::NG::Manager::CTrees::cTrees(), 'Get cTrees' );
ok( $attr = Lemonldap::NG::Manager::Attributes::attributes(),
ok( $tree = Lemonldap::NG::Manager::Build::Tree::tree(), 'Get tree' );
ok( $ctrees = Lemonldap::NG::Manager::Build::CTrees::cTrees(), 'Get cTrees' );
ok( $attr = Lemonldap::NG::Manager::Build::Attributes::attributes(),
'Get attributes' );
$count += 4;
......
......@@ -8,9 +8,9 @@ use 5.10.0;
my $langDir = 'site/static/languages';
my $count = 0;
use_ok('Lemonldap::NG::Manager::Tree');
use_ok('Lemonldap::NG::Manager::CTrees');
use_ok('Lemonldap::NG::Manager::Attributes');
use_ok('Lemonldap::NG::Manager::Build::Tree');
use_ok('Lemonldap::NG::Manager::Build::CTrees');
use_ok('Lemonldap::NG::Manager::Build::Attributes');
$count += 3;
ok( opendir( D, $langDir ), 'Found languages dir' );
......@@ -60,7 +60,7 @@ foreach my $lang (@langs) {
}
my $tree;
ok( $tree = Lemonldap::NG::Manager::Tree::tree(), 'Get tree' );
ok( $tree = Lemonldap::NG::Manager::Build::Tree::tree(), 'Get tree' );
my @nodes = @{ getNodes($tree) };
my @unTr;
......@@ -75,7 +75,7 @@ $count += 2;
my ( $type, $ctrees );
@unTr = ();
ok( $ctrees = Lemonldap::NG::Manager::CTrees::cTrees(), 'Get cTrees' );
ok( $ctrees = Lemonldap::NG::Manager::Build::CTrees::cTrees(), 'Get cTrees' );
while ( ( $type, $tree ) = each %$ctrees ) {
@nodes = @{ getNodes($tree) };
foreach (@nodes) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment