summaryrefslogtreecommitdiff
path: root/lib/WebCoso/Maker.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/WebCoso/Maker.pm')
-rw-r--r--lib/WebCoso/Maker.pm21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/WebCoso/Maker.pm b/lib/WebCoso/Maker.pm
new file mode 100644
index 0000000..e9564fa
--- /dev/null
+++ b/lib/WebCoso/Maker.pm
@@ -0,0 +1,21 @@
+# -*- mode: perl6 -*-
+role Maker[:$from,:$to] {
+ has $!wc;
+ has $.basename;
+ has $.dir;
+
+ method process-contents(:$from-contents) { ... }
+
+ method get-files() {
+ my %dsts = $!wc.get-files($.dir,$.basename,$from);
+ my %srcs = $!wc.get-files($.dir,$.basename,$to);
+ for %srcs.keys -> $lang {
+ my $src = %srcs{$lang};
+ next if %dsts{$lang} and
+ %dsts{$lang}.modified after $src.modified;
+ my $processed-contents = .process-contents($src.slurp);
+ %dsts{$lang} = $!wc.put-file($.dir,$.basename,$lang,$to,
+ $processed-contents)
+ }
+ }
+}