@@ -6,6 +6,7 @@ use DocSite::Documentable;
6
6
use DocSite::Documentable::Registry;
7
7
use DocSite::TypeGraph::Viz;
8
8
use DocSite::TypeGraph;
9
+ use File::Find;
9
10
use Pod ::Convenience;
10
11
use Pod ::Htmlify;
11
12
use Term::ProgressBar;
@@ -187,41 +188,23 @@ method !process-pod-in (Str $dir) {
187
188
@ files = @ files [^ (@ files / $ ! sparse ). ceiling ];
188
189
}
189
190
191
+ method ! process-pod-in (Str $ dir ) {
190
192
self ! maybe-say(" Reading and processing $ dir pod files ..." );
193
+ my $ files = self ! find-pod-files-in($ dir );
191
194
self ! run-with-progress(
192
- @ files ,
195
+ $ files ,
193
196
sub ($ file ) {
194
197
self ! process-one-pod($ file );
195
198
}
196
199
);
197
200
}
198
201
199
- method ! find-pod-files-in (Str $ dir ) {
202
+ method ! find-pod-files-in (Str $ in ) {
203
+ my $ dir = $ * SPEC . catdir( $ ! root , ' doc' , $ in );
200
204
self ! maybe-say: " Finding pod sources in $ dir ..." ;
201
- return gather {
202
- for self ! recursive-files-in($ dir ) -> $ file {
203
- take $ file if $ file . path ~~ / '.pod' $ /;
204
- }
205
- }
206
- }
207
-
208
- method ! recursive-files-in ($ dir ) {
209
- my @ todo = $ * SPEC . catdir( $ ! root , ' doc' , $ dir );
210
- return gather {
211
- while @ todo {
212
- my $ d = @ todo . shift ;
213
- for dir($ d ) -> $ f {
214
- if $ f . f {
215
- self ! maybe-say: " ... found $ f" ;
216
- take $ f ;
217
- }
218
- else {
219
- self ! maybe-say: " ... descending into $ f" ;
220
- @ todo . append ( $ f . path );
221
- }
222
- }
223
- }
224
- }
205
+ my $ files = find( : dir($ dir ), : name( rx { '.pod' $ } ) ). cache;
206
+ self ! maybe-say(" ... found $ _" ) for $ files . values ;
207
+ return $ files ;
225
208
}
226
209
227
210
method ! process-one-pod (IO ::Path $ pod-file ) {
@@ -247,8 +230,13 @@ method !run-with-progress ($items, Routine $sub, Str $msg = q{ done}) {
247
230
my $ prog = Term::ProgressBar. new ( : count( $ items . elems ), : p )
248
231
if $ ! verbose ;
249
232
233
+ my $ to-run =
234
+ $ ! sparse
235
+ ?? $ items . pick ( ( $ items . list. elems / $ ! sparse ). ceiling )
236
+ !! $ items ;
237
+
250
238
my $ i = 1 ;
251
- my $ supply = $ items . Supply . throttle(
239
+ my $ supply = $ to-run . Supply . throttle(
252
240
$ ! threads ,
253
241
-> $ item {
254
242
$ sub ($ item );
0 commit comments