Files.pm 1.21 KB
Newer Older
1 2 3 4 5 6
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
7

8 9 10

package Support::Files;

11 12
use File::Find;

13
@additional_files = ();
14

15 16
@files = glob('*');
find(sub { push(@files, $File::Find::name) if $_ =~ /\.pm$/;}, 'Bugzilla');
17
push(@files, 'extensions/create.pl');
18

19 20 21
@extensions =
    grep { $_ ne 'extensions/create.pl' && ! -e "$_/disabled" }
    glob('extensions/*');
22

23
foreach my $extension (@extensions) {
24 25 26
    find(sub { push(@files, $File::Find::name) if $_ =~ /\.pm$/;}, $extension);
}

27 28
@test_files = glob('t/*.t');

29
sub isTestingFile {
30 31
    my ($file) = @_;
    my $exclude;
32

33 34 35 36 37 38 39 40
    if ($file =~ /\.cgi$|\.pl$|\.pm$/) {
        return 1;
    }
    my $additional;
    foreach $additional (@additional_files) {
        if ($file eq $additional) { return 1; }
    }
    return undef;
41 42 43
}

foreach $currentfile (@files) {
44 45 46
    if (isTestingFile($currentfile)) {
        push(@testitems,$currentfile);
    }
47
    push(@module_files, $currentfile) if $currentfile =~ /\.pm$/;
48 49
}

50 51

1;