summaryrefslogtreecommitdiff
path: root/katana.raku
diff options
context:
space:
mode:
Diffstat (limited to 'katana.raku')
-rwxr-xr-xkatana.raku24
1 files changed, 7 insertions, 17 deletions
diff --git a/katana.raku b/katana.raku
index 2b9b4fd..48e7202 100755
--- a/katana.raku
+++ b/katana.raku
@@ -8,11 +8,6 @@ sub prefix:<❱>(*@args) {
sub prefix:<⁉>(*@args) { ❱ @args unless @args[*-1].IO.f }
-class Template {
- has Str %!vars;
- has Str $!frame = 'frame.html';
-}
-
class Image {
has Str $.filename;
has Str $!source;
@@ -39,16 +34,15 @@ class Image {
method large_tag { "<img class='large' src='./large/{$.filename}' />" }
}
-sub dist-dirs(Str $dist-dir --> List) {
- $dist-dir <<~>> </large /blur /thumb>
-}
+sub dist-dirs(Str $dist-dir --> List) { $dist-dir <<~>> </large /blur /thumb> }
+sub make-mr-proper(Str $dist-dir) { ❱ ['rm', '-rf', $dist-dir] if $dist-dir.IO.d }
-sub ensure-directories(Str :$dist-dir) {
+sub ensure-directories(Str $dist-dir) {
mkdir $dist-dir unless $dist-dir.IO.d;
mkdir $_ unless .IO.d for dist-dirs $dist-dir;
}
-sub cleanup-nonexistent (Str :$dist-dir, :@images) {
+sub cleanup-nonexistent (Str $dist-dir, @images) {
my $images = set @images.map:{ $_.filename };
for dist-dirs $dist-dir -> $dir {
unlink $_ if .IO.basename ∉ $images
@@ -56,10 +50,6 @@ sub cleanup-nonexistent (Str :$dist-dir, :@images) {
}
}
-sub make-mr-proper(Str :$dist-dir) {
- ❱ ['rm', '-rf', $dist-dir] if $dist-dir.IO.d;
-}
-
multi MAIN(
Bool :$mr-proper, #= Clean output dir
Str :$in-dir = './in', #= Input dir
@@ -75,9 +65,9 @@ multi MAIN(
@images = @images.pick: * if $randomize;
say "Found {@images.elems} images";
- cleanup-nonexistent :$dist-dir, :@images;
- make-mr-proper :$dist-dir if $mr-proper;
- ensure-directories :$dist-dir;
+ cleanup-nonexistent $dist-dir, @images;
+ make-mr-proper $dist-dir if $mr-proper;
+ ensure-directories $dist-dir;
@images.hyper.map: { .generate: :$thumb-geometry, :$bg-blur };
}