From: Matt S Trout Date: Tue, 25 Oct 2011 08:42:26 +0000 (+0000) Subject: make generator (a) provide output (b) accept arguments to restrict what it generates X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=581526556280ae8db00f9466052eef4d0d43a1a7;p=scpubgit%2FSCS.git make generator (a) provide output (b) accept arguments to restrict what it generates --- diff --git a/lib/SCSite.pm b/lib/SCSite.pm index f8c8ac1..2b75229 100755 --- a/lib/SCSite.pm +++ b/lib/SCSite.pm @@ -186,11 +186,17 @@ around _run_cli => sub { }; sub _run_cli_generate { - my ($self, $to) = @_; + my ($self, $to, @spec) = @_; die "generate requires a directory to generate to" unless $to and -d $to; my $out = io($to); + my $check = do { + if (@spec) { '^('.join('|',map quotemeta($_),@spec).')' } + else { '.' } + }; foreach my $path ('', $self->pages->all_paths) { + next unless "$path/" =~ /$check/; + print "Generating ${path}\n"; my $dir = $out->catdir($path); $dir->mkpath; $dir->catfile('index.html')->print( @@ -198,6 +204,8 @@ sub _run_cli_generate { ); } foreach my $path (map "/feed/$_/", keys %{$self->_feed_configs}) { + next unless "$path/" =~ /$check/; + print "Generating ${path}\n"; my $dir = $out->catdir($path); $dir->mkpath; $dir->catfile('index.atom')->print(