-
Notifications
You must be signed in to change notification settings - Fork 25
/
gen-module-list.pl
executable file
·34 lines (31 loc) · 1.19 KB
/
gen-module-list.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use strict;
use warnings;
use JSON;
my @extra_modules = ('mod-codex-inventory','mod-codex-ekb','mod-rtac');
# Some modules don't have mod descriptors in the central repo
my @exclude_modules = ('eslint-config-stripes','platform-complete','platform-core','react-big-calendar','react-githubish-mentions','react-intl-safe-html','stripes-smart-components');
my $input_dir = $ARGV[0];
die "Directory $input_dir not readable\n" unless (-r $input_dir && -d $input_dir);
opendir(INPUTDIR,$input_dir) or die "Can't open input directory $input_dir: $!\n";
my @mod_descrs = grep { /^(?!\.).+/ && -f "$input_dir/$_" } readdir(INPUTDIR);
closedir(INPUTDIR);
my @enable;
foreach my $i (@mod_descrs) {
my $exclude;
foreach my $j (@exclude_modules) {
$exclude = 1 if $i =~ /$j/;
}
unless ($exclude) {
open(MODDESCR, "<:encoding(UTF-8)", "$input_dir/$i")
or warn("Can't open $input_dir/$i: $!\n");
local $/= undef;
my $mod_descr = decode_json(<MODDESCR>);
close(MODDESCR);
push(@enable,({ id => $$mod_descr{id}, action => "enable" }));
}
}
foreach my $i (@extra_modules) {
push(@enable,({ id => $i, action => 'enable' }));
}
print encode_json(\@enable) . "\n";
exit;