Skip to content

Commit 1655582

Browse files
committed
lua-releng: removed the dependencies File::Slurp and ack.
1 parent 6bac338 commit 1655582

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

lua-releng

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
use strict;
44
use warnings;
55

6-
use File::Slurp qw(read_file);
7-
86
sub file_contains ($$);
97

108
my $version;
@@ -44,16 +42,22 @@ for my $file (map glob, qw{ *.lua lib/*.lua lib/*/*.lua lib/*/*/*.lua lib/*/*/*/
4442
print "Checking use of Lua global variables in file $file ...\n";
4543
system("luac -p -l $file | grep ETGLOBAL | grep -vE 'require|type|tostring|error|ngx|ndk|jit|setmetatable|getmetatable|string|table|io|os|print|tonumber|math|pcall|xpcall|unpack|pairs|ipairs|assert|module|package|coroutine|[gs]etfenv|next'");
4644
#file_contains($file, "attempt to write to undeclared variable");
45+
system("grep -H -n -E --color '.{81}' $file");
4746
}
4847

4948
sub file_contains ($$) {
5049
my ($file, $regex) = @_;
51-
my $content = read_file($file);
50+
open my $in, $file
51+
or die "Cannot open $file fo reading: $!\n";
52+
my $content = do { local $/; <$in> };
53+
close $in;
5254
#print "$content";
5355
return scalar ($content =~ /$regex/);
5456
}
5557

56-
system("ack '.{81}' `find lib -name '*.lua'`");
57-
system(q{ack '\b(?:ONLY|LAST)\b' t});
58-
system(q{ack -l '\r\n' t});
58+
if (-d 't') {
59+
for my $file (map glob, qw{ t/*.t t/*/*.t t/*/*/*.t }) {
60+
system(qq{grep -H -n --color -E '\\--- ?(ONLY|LAST)' $file});
61+
}
62+
}
5963

0 commit comments

Comments
 (0)