Rename lmConf-*.js to lmConf-*.json (fix: #1090)

This commit is contained in:
Xavier Guimard 2017-01-27 11:58:46 +00:00
parent c52bbcb527
commit 1e4c6da389
14 changed files with 28 additions and 22 deletions

View File

@ -193,7 +193,7 @@ MANAGERJSONDST=$(SRCMANAGERDIR)/site/static/struct.json \
$(SRCCOMMONDIR)/lib/Lemonldap/NG/Common/Conf/ReConstants.pm \
$(SRCCOMMONDIR)/lib/Lemonldap/NG/Common/Conf/DefaultValues.pm \
$(SRCCOMMONDIR)/lib/Lemonldap/NG/Common/Conf/Constants.pm \
_example/conf/lmConf-1.js
_example/conf/lmConf-1.json
# Javascript and CSS to minify
JSSRCFILES:=$(shell find */site/static/js $(SRCPORTALDIR)/site/htdocs/static -type f -name '*.js' ! -name '*.min.js') \
@ -384,11 +384,11 @@ prepare_test_server:
INITDIR=`pwd`/e2e-tests/conf/init \
ETCDEFAULTDIR=`pwd`/e2e-tests/conf/def
@cp -f e2e-tests/index.* e2e-tests/conf/
@cp e2e-tests/lmConf-1.js e2e-tests/lemonldap-ng.ini e2e-tests/env.conf e2e-tests/test-nginx.conf e2e-tests/conf/
@cp e2e-tests/lmConf-1.json e2e-tests/lemonldap-ng.ini e2e-tests/env.conf e2e-tests/test-nginx.conf e2e-tests/conf/
@cp e2e-tests/form.html e2e-tests/conf/site
@perl -i -pe 'BEGIN{$$p=`pwd`;chomp $$p}s#__pwd__#$$p#;s#__port__#$(TESTWEBSERVERPORT)#;s#__FASTCGISOCKDIR__#$(FASTCGISOCKDIR)#;' \
e2e-tests/conf/lemonldap-ng.ini \
e2e-tests/conf/lmConf-1.js \
e2e-tests/conf/lmConf-1.json \
e2e-tests/conf/env.conf \
e2e-tests/conf/test-nginx.conf
@ -731,11 +731,11 @@ install_conf_dir: install_sessions_dir install_notif_dir install_captcha_dir
cp -f $(SRCCOMMONDIR)/$(CONFFILENAME) $(RCONFDIR); \
$(PERL) -i -pe 's#^dirName\s*=\s*.*#dirName = $(FILECONFIGDIR)#g' $(RCONFDIR)/$(CONFFILENAME); \
fi
@cp _example/conf/lmConf-1.js $(RFILECONFIGDIR)
@cp _example/conf/lmConf-1.json $(RFILECONFIGDIR)
@$(PERL) -i -pe 's/__DNSDOMAIN__/$(DNSDOMAIN)/g;\
s#__SESSIONDIR__#$(APACHESESSIONFILEDIR)#g;\
s#__PSESSIONDIR__#$(APACHEPSESSIONFILEDIR)#g;\
s#__NOTIFICATIONDIR__#$(APACHEFILENOTIFDIR)#g;' $(RFILECONFIGDIR)/lmConf-1.js
s#__NOTIFICATIONDIR__#$(APACHEFILENOTIFDIR)#g;' $(RFILECONFIGDIR)/lmConf-1.json
@if [ "$(APACHEUSER)" != "" ]; then \
chown $(APACHEUSER) $(RFILECONFIGDIR) || exit 1; \
if [ "$(APACHEGROUP)" != "" ]; then \

View File

@ -15,7 +15,7 @@ sub Lemonldap::NG::Common::Conf::_lock {
sub Lemonldap::NG::Common::Conf::_file {
my ( $self, $cfgNum ) = @_;
return "$self->{dirName}/lmConf-$cfgNum.js";
return "$self->{dirName}/lmConf-$cfgNum.json";
}
sub prereq {
@ -40,7 +40,7 @@ sub available {
closedir D;
@conf =
sort { $a <=> $b }
map { /lmConf-(\d+)(?:\.js)?/ ? ( $1 + 0 ) : () } @conf;
map { /lmConf-(\d+)(?:\.js(?:on))?/ ? ( $1 + 0 ) : () } @conf;
return @conf;
}
@ -96,11 +96,17 @@ sub store {
sub load {
my ( $self, $cfgNum, $fields ) = @_;
my $f;
my ($f,$filename);
if ( -e $self->_file($cfgNum) ) {
$filename = $self->_file($cfgNum);
}
elsif ( -e "$self->{dirName}/lmConf-$cfgNum.js" ) {
$filename = "$self->{dirName}/lmConf-$cfgNum.js";
}
if($filename) {
local $/ = '';
my $ret;
unless ( open FILE, $self->_file($cfgNum) ) {
unless ( open FILE, $filename ) {
$Lemonldap::NG::Common::Conf::msg .= "Read error: $!$@";
return undef;
}

View File

@ -45,7 +45,7 @@ for ( my $i = 0 ; $i < @test ; $i++ ) {
$count++;
if ( -x '/usr/bin/file' ) {
eval {
open F, 'file t/lmConf-1.js |';
open F, 'file t/lmConf-1.json |';
$_ = join( '', <F> );
close F;
ok( /(ascii|utf-?8)/si, "File is $1 encoded" );
@ -60,6 +60,6 @@ for ( my $i = 0 ; $i < @test ; $i++ ) {
$count += 2;
}
#unlink 't/lmConf-1.js';
unlink 't/lmConf-1.json';
done_testing($count);

View File

@ -48,7 +48,7 @@ t/61-Lemonldap-NG-Handler-PSGI-Server.t
t/62-Lemonldap-NG-Handler-Nginx.t
t/63-Lemonldap-NG-Handler-PSGI-Try.t
t/99-pod.t
t/lmConf-1.js
t/lmConf-1.json
t/sessions/lock/Apache-Session-f5eec18ebb9bc96352595e2d8ce962e8ecf7af7c9a98cb9a43f9cd181cf4b545.lock
t/test-psgi-lib.pm
t/test.pm

View File

@ -171,7 +171,7 @@ t/50-notifications.t
t/80-attributes.t
t/90-translations.t
t/99-pod.t
t/conf/lmConf-1.js
t/conf/lmConf-1.json
t/jsonfiles/01-base-tree.json
t/jsonfiles/02-base-tree-all-nodes-opened.json
t/jsonfiles/12-modified.json

View File

@ -38,7 +38,7 @@ WriteMakefile(
: ()
),
clean => {
FILES => 't/conf/lmConf-2.js',
FILES => 't/conf/lmConf-2.json',
},
);

View File

@ -621,7 +621,7 @@ system.
managerConstantsFile => "lib/Lemonldap/NG/Common/Conf/ReConstants.pm",
managerAttributesFile => 'lib/Lemonldap/NG/Manager/Attributes.pm',
defaultValuesFile => "lib/Lemonldap/NG/Common/Conf/DefaultValues.pm",
firstLmConfFile => "_example/conf/lmConf-1.js",
firstLmConfFile => "_example/conf/lmConf-1.json",
reverseTreeFile => "site/static/reverseTree.json",
);
@ -679,7 +679,7 @@ constants used to read configuration;
parameters attributes used by the manager during configuration upload;
=item lmConf-1.js:
=item lmConf-1.json:
first configuration in file format;

View File

@ -11,7 +11,7 @@ require 't/test-lib.pm';
my @struct =
qw[t/jsonfiles/01-base-tree.json t/jsonfiles/02-base-tree-all-nodes-opened.json];
my @desc = ( 'Unopened conf', 'Unchanged conf with all nodes opened' );
my $confFiles = [ 't/conf/lmConf-1.js', 't/conf/lmConf-2.js' ];
my $confFiles = [ 't/conf/lmConf-1.json', 't/conf/lmConf-2.json' ];
sub body {
return 0 unless (@struct);
@ -19,7 +19,7 @@ sub body {
return IO::File->new( $t, 'r' );
}
# Delete lmConf-2.js if exists
# Delete lmConf-2.json if exists
eval { unlink $confFiles->[1]; };
mkdir 't/sessions';

View File

@ -10,13 +10,13 @@ use Data::Dumper;
require 't/test-lib.pm';
my $struct = 't/jsonfiles/12-modified.json';
my $confFiles = [ 't/conf/lmConf-1.js', 't/conf/lmConf-2.js' ];
my $confFiles = [ 't/conf/lmConf-1.json', 't/conf/lmConf-2.json' ];
sub body {
return IO::File->new( $struct, 'r' );
}
# Delete lmConf-2.js if exists
# Delete lmConf-2.json if exists
eval { unlink $confFiles->[1]; };
mkdir 't/sessions';

View File

@ -14,7 +14,7 @@ sub body {
return IO::File->new( $struct, 'r' );
}
unlink 't/conf/lmConf-2.js';
unlink 't/conf/lmConf-2.json';
my ( $res, $resBody );
ok( $res = &client->_post( '/confs/', 'cfgNum=1', &body, 'application/json' ),
@ -35,4 +35,4 @@ count(5);
done_testing( count() );
unlink 't/conf/lmConf-2.js';
unlink 't/conf/lmConf-2.json';