diff --git a/src/upload.raku b/src/upload.raku index e95959d..bd3767c 100755 --- a/src/upload.raku +++ b/src/upload.raku @@ -7,6 +7,10 @@ use DOM::Tiny; my $build-path; my $dir; +my constant $remote = "ubuntu@static.stranger.systems"; +my constant $web-base = "/var/www/static.stranger.systems"; + +# Color values for foreground and background my constant $background-css = ' body { color: #b9b9b9; @@ -51,8 +55,10 @@ sub render-idris-file($idr) { } sub MAIN( - $project_dir? #= Base directory of project to upload, defaults to %*CWD + $project_dir?, #= Base directory of project to upload, defaults to %*CWD + $dest_dir?, #= Destination directory on the remote ) { + # cd to the projet directory if needed if $project_dir ~~ Str { $*CWD = $project_dir.IO.resolve; }; @@ -83,7 +89,15 @@ sub MAIN( # TODO : Build index } + # Figure out our destination + my $dest = do if $dest_dir ~~ Str { + $dest_dir + } else { + my $fst = $*CWD.basename; + my $snd = $*CWD.parent.basename; + "Projects/$snd/$fst" + }; + # Upload files - run , "$dir/", - "ubuntu@129.153.226.221:/var/www/static.stranger.systems/AoC/2024"; + run , "$dir/", "$remote:$web-base/$dest"; }