From b1ee31c58f5d37d6372f01e5b874fc8466e8bb1e Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Fri, 20 Dec 2024 08:08:55 +0000 Subject: [PATCH] Give upload a main --- src/upload.raku | 54 ++++++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/src/upload.raku b/src/upload.raku index 21a040f..e7037a4 100755 --- a/src/upload.raku +++ b/src/upload.raku @@ -4,21 +4,8 @@ use paths; use File::Temp; use DOM::Tiny; -# Find and collect all of our idris files -my @idris-files = - paths("src", :file(-> $a {$a.ends-with(".idr") || $a.ends-with(".md")})) - .map: *.IO.relative("src/".IO); - - -# Do a pack clean build so we can find the ttms -exit -1 unless run ; -exit -1 unless run ; - -# find our ttc folder -my $build-path = "build/ttc/".IO.dir[0]; - -# Get a temporary directory to work in -my $dir = tempdir().IO; +my $build-path; +my $dir; my constant $background-css = ' body { @@ -63,14 +50,31 @@ sub render-idris-file($idr) { $out-file.spurt: $contents; } -# For each of our idris files, find the ttm, and generate the output in the -# temporary directory -for @idris-files.hyper -> $idr { - render-idris-file $idr; - # TODO : Build index +sub MAIN() { + # Find and collect all of our idris files + my @idris-files = + paths("src", :file(-> $a {$a.ends-with(".idr") || $a.ends-with(".md")})) + .map: *.IO.relative("src/".IO); + + + # Do a pack clean build so we can find the ttms + exit -1 unless run ; + exit -1 unless run ; + + # find our ttc folder + $build-path = "build/ttc/".IO.dir[0]; + + # Get a temporary directory to work in + $dir = tempdir().IO; + + # For each of our idris files, find the ttm, and generate the output in the + # temporary directory + for @idris-files.hyper -> $idr { + render-idris-file $idr; + # TODO : Build index + } + + # Upload files + run , "$dir/", + "ubuntu@129.153.226.221:/var/www/static.stranger.systems/AoC/2024"; } - -# Upload files -run , "$dir/", -"ubuntu@129.153.226.221:/var/www/static.stranger.systems/AoC/2024"; -