1+ # -----------------------------------------------------------------------
2+ # This file is part of MoonScript
3+ #
4+ # MoonSript is free software: you can redistribute it and/or modify
5+ # it under the terms of the GNU General Public License as published by
6+ # the Free Software Foundation, either version 3 of the License, or
7+ # (at your option) any later version.
8+ #
9+ # MoonSript is distributed in the hope that it will be useful,
10+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+ # GNU General Public License for more details.
13+ #
14+ # You should have received a copy of the GNU General Public License
15+ # along with MoonSript. If not, see <https://www.gnu.org/licenses/>.
16+ #
17+ # Copyright (C) 2025 Krisna Pranav, MoonScript Developers
18+ # -----------------------------------------------------------------------
19+
20+ module MoonScript
21+ module SourceFile
22+ extend self
23+
24+ def globs (jsons: Array (MoonJson ), * , include_tests = false ) : Array (String )
25+ jsons.flat_map { |json | globs(json, include_tests: include_tests) }
26+ end
27+
28+ def globs (json: MoonJson , * , include_tests = false ) : Array (String )
29+ if include_tests
30+ json.source_directories | json.test_directories
31+ else
32+ json.source_directories
33+ end .map { |dir | glob_pattern(File .dirname(json.path), dir )}
34+ end
35+ end
36+ end
0 commit comments