summaryrefslogtreecommitdiff
path: root/lib/WebCoso.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/WebCoso.pm')
-rw-r--r--lib/WebCoso.pm38
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/WebCoso.pm b/lib/WebCoso.pm
new file mode 100644
index 0000000..5202745
--- /dev/null
+++ b/lib/WebCoso.pm
@@ -0,0 +1,38 @@
+# -*- mode: perl6 -*-
+class WebCoso {
+ has $.srcdir;
+ has $.destdir;
+ has $!tmpdir = $*SPEC.tmpdir.child('abcde');
+ has @!docs;
+
+ method get-files($dir,$basename,$ext) {
+ my %files = gather {
+ for my $base ($.srcdir,$!tmpdir) {
+ my @files = $base.child($dir).dir(
+ test => /$basename \. .+? \. $ext/,
+ );
+ take map {
+ (.name ~~ /$basename \. (.+?) \. $ext/)[0]
+ =>
+ $_
+ } @files;
+ }
+ }
+ return %files;
+ }
+
+ method put-file($dir,$basename,$lang,$ext,$contents) {
+ $!tmpdir.child($dir).child("${basename}.${lang}.${ext}").spurt($contents);
+ return;
+ }
+
+ method new-doc(:$dir) {
+ @!docs.push(Document.new(:$dir,wc=>self);
+ }
+ method new-feed(:$dir) {
+ @!docs.push(Feed.new(:$dir,wc=>self);
+ }
+ method run() {
+ .make() for @!docs;
+ }
+}