Make upload path generic across projects
This commit is contained in:
parent
f916a94c64
commit
9909840b65
|
@ -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 <rsync -rvh>, "$dir/",
|
||||
"ubuntu@129.153.226.221:/var/www/static.stranger.systems/AoC/2024";
|
||||
run <rsync -rvh --mkpath --delete>, "$dir/", "$remote:$web-base/$dest";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue