Make work with tests too
This commit is contained in:
parent
b019deea7a
commit
ebefccec74
|
@ -29,10 +29,10 @@ sub stylize($katla-output) {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Renders the file at the given location to the temporary directory
|
# Renders the file at the given location to the temporary directory
|
||||||
sub render-idris-file($idr, $katla-config) {
|
sub render-idris-file($idr, $katla-config, $base-dir = "src/".IO) {
|
||||||
say "Converting $idr";
|
say "Converting $idr";
|
||||||
# Figure out our file paths
|
# Figure out our file paths
|
||||||
my $source-file = IO::Path.new($idr, :CWD("src/".IO)).resolve;
|
my $source-file = IO::Path.new($idr, :CWD($base-dir)).resolve;
|
||||||
my $ttm-file =
|
my $ttm-file =
|
||||||
IO::Path.new($idr, :CWD($build-path)).extension("ttm").resolve;
|
IO::Path.new($idr, :CWD($build-path)).extension("ttm").resolve;
|
||||||
my $out-file = IO::Path.new($idr, :CWD($dir)).extension("html").resolve;
|
my $out-file = IO::Path.new($idr, :CWD($dir)).extension("html").resolve;
|
||||||
|
@ -94,7 +94,7 @@ my method render-index(%index:) {
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
$dest_dir?, #= Destination directory on the remote
|
||||||
$katla-config = #= Configuration file to pass to katla
|
$katla-config = #= Configuration file to pass to katla
|
||||||
"/home/nathan/Projects/Idris/.scripts/src/katla.dhall",
|
"/home/nathan/Projects/Idris/.scripts/src/katla.dhall",
|
||||||
|
@ -108,6 +108,10 @@ sub MAIN(
|
||||||
my @idris-files =
|
my @idris-files =
|
||||||
paths("src", :file(-> $a {$a.ends-with(".idr") || $a.ends-with(".md")}))
|
paths("src", :file(-> $a {$a.ends-with(".idr") || $a.ends-with(".md")}))
|
||||||
.map: *.IO.relative("src/".IO);
|
.map: *.IO.relative("src/".IO);
|
||||||
|
# Find and collect all of our test files
|
||||||
|
my @test-files =
|
||||||
|
paths("test/src", :file(-> $a {$a.ends-with(".idr") || $a.ends-with(".md")}))
|
||||||
|
.map: *.IO.relative("test/src/".IO);
|
||||||
|
|
||||||
# Clean if there is more than one ttc folder, easiest way to locate the
|
# Clean if there is more than one ttc folder, easiest way to locate the
|
||||||
# correct one
|
# correct one
|
||||||
|
@ -118,6 +122,13 @@ sub MAIN(
|
||||||
exit -1 unless run <pack build>;
|
exit -1 unless run <pack build>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Now do the same for the test directory
|
||||||
|
$ttc-path = "test/build/ttc".IO;
|
||||||
|
if !($ttc-path ~~ :e) || $ttc-path.dir.elems != 1 {
|
||||||
|
exit -1 unless run <pack clean test/test.ipkg>;
|
||||||
|
exit -1 unless run <pack build test/test.ipkg>;
|
||||||
|
}
|
||||||
|
|
||||||
# find our ttc folder
|
# find our ttc folder
|
||||||
$build-path = "build/ttc/".IO.dir[0];
|
$build-path = "build/ttc/".IO.dir[0];
|
||||||
|
|
||||||
|
@ -132,7 +143,17 @@ sub MAIN(
|
||||||
%index.&add-path($idr, $out.relative($dir)) when $out ~~ IO;
|
%index.&add-path($idr, $out.relative($dir)) when $out ~~ IO;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $index = %index.&render-index();
|
# Now repeat for the test directory
|
||||||
|
my %test-index = %();
|
||||||
|
$build-path = "test/build/ttc/".IO.dir[0];
|
||||||
|
for @test-files.hyper :batch(1) -> $idr {
|
||||||
|
my $out = render-idris-file $idr, $katla-config.IO, "test/src".IO;
|
||||||
|
%test-index.&add-path($idr, $out.relative($dir)) when $out ~~ IO;
|
||||||
|
}
|
||||||
|
|
||||||
|
my %final-index = ("src" => %index, "test" => ("src" => %test-index));
|
||||||
|
|
||||||
|
my $index = %final-index.&render-index();
|
||||||
my $title = $*CWD.basename;
|
my $title = $*CWD.basename;
|
||||||
$index = html-en
|
$index = html-en
|
||||||
head(Map,
|
head(Map,
|
||||||
|
|
Loading…
Reference in a new issue