summaryrefslogtreecommitdiff
path: root/lib/WebCoso.pm
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2015-09-05 13:50:48 +0100
committerdakkar <dakkar@thenautilus.net>2015-09-05 13:50:48 +0100
commit1cad72ceecfdd03fed63c7424cf0a04a8aa3d5a4 (patch)
tree0f372bd0b06b621244473e07cd36621b73a8d39b /lib/WebCoso.pm
downloadWebCoso-p6-1cad72ceecfdd03fed63c7424cf0a04a8aa3d5a4.tar.gz
WebCoso-p6-1cad72ceecfdd03fed63c7424cf0a04a8aa3d5a4.tar.bz2
WebCoso-p6-1cad72ceecfdd03fed63c7424cf0a04a8aa3d5a4.zip
first attempt
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;
+ }
+}