Lines 19-57
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
use Test::More tests => 1; |
21 |
use Test::More tests => 1; |
22 |
use File::Find; |
22 |
use File::Slurp qw( read_file ); |
23 |
|
23 |
|
24 |
my @themes; |
24 |
my @files; |
25 |
|
25 |
|
26 |
# OPAC themes |
26 |
# OPAC |
27 |
my $opac_dir = 'koha-tmpl/opac-tmpl'; |
27 |
push @files, `git ls-files 'koha-tmpl/opac-tmpl/bootstrap/en/*.tt'`; |
28 |
opendir ( my $dh, $opac_dir ) or die "can't opendir $opac_dir: $!"; |
28 |
push @files, `git ls-files 'koha-tmpl/opac-tmpl/bootstrap/en/*.inc'`; |
29 |
for my $theme ( grep { not /^\.|lib|js|xslt/ } readdir($dh) ) { |
|
|
30 |
push @themes, "$opac_dir/$theme/en"; |
31 |
} |
32 |
close $dh; |
33 |
|
29 |
|
34 |
# STAFF themes |
30 |
# Staff |
35 |
my $staff_dir = 'koha-tmpl/intranet-tmpl'; |
31 |
push @files, `git ls-files 'koha-tmpl/intranet-tmpl/prog/en/*.tt'`; |
36 |
opendir ( $dh, $staff_dir ) or die "can't opendir $staff_dir: $!"; |
32 |
push @files, `git ls-files 'koha-tmpl/intranet-tmpl/prog/en/*.inc'`; |
37 |
for my $theme ( grep { not /^\.|lib|js/ } readdir($dh) ) { |
|
|
38 |
push @themes, "$staff_dir/$theme/en"; |
39 |
} |
40 |
close $dh; |
41 |
|
33 |
|
42 |
my @files; |
34 |
my @errors; |
43 |
find( |
35 |
for my $file ( @files ) { |
44 |
sub { |
36 |
chomp $file; |
45 |
open my $fh, '<', $_ or die "Could not open $_: $!"; |
37 |
my @lines = sort grep /\_\(\'/, read_file($file); |
46 |
my @lines = sort grep /\_\(\'/, <$fh>; |
38 |
push @errors, { name => $file, lines => \@lines } if @lines; |
47 |
push @files, { name => "$_", lines => \@lines } if @lines; |
39 |
} |
48 |
}, |
|
|
49 |
@themes |
50 |
); |
51 |
|
40 |
|
52 |
ok( !@files, "Files do not contain single quotes _(' " ) |
41 |
ok( !@errors, "Files do not contain single quotes _(' " ) |
53 |
or diag( |
42 |
or diag( |
54 |
"Files list: \n", |
43 |
"Files list: \n", |
55 |
join( "\n", |
44 |
join( "\n", |
56 |
map { $_->{name} . ': ' . join( ', ', @{ $_->{lines} } ) } @files ) |
45 |
map { $_->{name} . ': ' . join( ', ', @{ $_->{lines} } ) } @errors ) |
57 |
); |
46 |
); |
58 |
- |
|
|