Skip to content

Instantly share code, notes, and snippets.

@yanick
Last active September 5, 2019 00:11
Show Gist options
  • Save yanick/35a6a2b5e1c818bba6a86bc3cfb05fc8 to your computer and use it in GitHub Desktop.
Save yanick/35a6a2b5e1c818bba6a86bc3cfb05fc8 to your computer and use it in GitHub Desktop.
use App::Dothe::DSL;
use Path::Tiny::Glob pathglob => { all => 1 };
task feeds => (
deps => [qw/ entries summary /],
generates => [ map { './static/feed.'.$_ } qw/ atom json rss /],
sources => './static/entries.json',
cmds => './scripts/gen_feed.js'
);
task summary => (
deps => 'entries',
generates => './static/entries.json',
sources => [ pathglob './entry/*/README.md' ],
cmds => 'perl ./export_summary.pl',
);
task entries => ( deps => [
map {
task "entry:$_" => (
quiet => 1,
sources => $_,
generates => "pages/$_" =~ s#/README.md#.vue#r,
cmds => "./export_entry.pl $_",
)
} pathglob './entry/*/README.md'
]);
task sync_files => [
'fd -t d files entry -x mkdir -p static/"{//}"',
'fd -t d files entry -x rsync -av --delete "{}"/ static/"{//}"'
];
1;
### or
tasks:
feeds:
deps: [ entries summary ]
generates: [ './static/feed.atom', './static/feed.json', './static/feed.rss' ]
sources: ./static/entries.json
cmds: ./scripts/gen_feed.js
summary:
deps: entries
generates: ./static/entries.json
sources: !glob ./entry/*/README.md
cmds: perl ./export_summary.pl
entries:
sources: !glob ./entry/*/README.md
foreach: sources
cmds:
- task: entry
var:
path: !perl $_
entry:
adhoc: 1
sources: !perl $_
generates: !perl "pages/$_" =~ s#/README.md#.vue#r
cmds: !perl "./export_entry.pl $_"
sync_files:
cmds:
- fd -t d files entry -x mkdir -p static/"{//}"
- fd -t d files entry -x rsync -av --delete "{}"/ static/"{//}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment