summaryrefslogtreecommitdiff
path: root/lib/WebCoso/Maker.pm
blob: e9564fa93492aca0426fbc75b0497e53ecdfabd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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{$langand
                                 %dsts{$lang}.modified after $src.modified;
            my $processed-contents = .process-contents($src.slurp);
            %dsts{$lang} = $!wc.put-file($.dir,$.basename,$lang,$to,
                                         $processed-contents)
        }
    }
}