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 $build-path;
|
||||||
my $dir;
|
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 = '
|
my constant $background-css = '
|
||||||
body {
|
body {
|
||||||
color: #b9b9b9;
|
color: #b9b9b9;
|
||||||
|
@ -51,8 +55,10 @@ sub render-idris-file($idr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub MAIN(
|
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 {
|
if $project_dir ~~ Str {
|
||||||
$*CWD = $project_dir.IO.resolve;
|
$*CWD = $project_dir.IO.resolve;
|
||||||
};
|
};
|
||||||
|
@ -83,7 +89,15 @@ sub MAIN(
|
||||||
# TODO : Build index
|
# 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
|
# Upload files
|
||||||
run <rsync -rvh>, "$dir/",
|
run <rsync -rvh --mkpath --delete>, "$dir/", "$remote:$web-base/$dest";
|
||||||
"ubuntu@129.153.226.221:/var/www/static.stranger.systems/AoC/2024";
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue