No longer require katla config to be in project
This commit is contained in:
parent
a4dcd397c9
commit
35ba371711
|
@ -29,7 +29,7 @@ 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) {
|
sub render-idris-file($idr, $katla-config) {
|
||||||
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("src/".IO)).resolve;
|
||||||
|
@ -40,9 +40,17 @@ sub render-idris-file($idr) {
|
||||||
return unless $ttm-file ~~ :e;
|
return unless $ttm-file ~~ :e;
|
||||||
# Generate the html
|
# Generate the html
|
||||||
# TODO: Stop relying on the config for now and just colorize it in regexs
|
# TODO: Stop relying on the config for now and just colorize it in regexs
|
||||||
my $katla = run <katla html --config>, "katla/katla.dhall",
|
my $katla = run <katla html --config>, $katla-config,
|
||||||
$source-file, $ttm-file, :out;
|
$source-file, $ttm-file, :out;
|
||||||
my $contents = $katla.out.slurp :close;
|
my $contents = $katla.out.slurp :close;
|
||||||
|
say $source-file;
|
||||||
|
say $ttm-file;
|
||||||
|
say $katla-config;
|
||||||
|
if $katla.exitcode != 0 {
|
||||||
|
say "Katla Error:";
|
||||||
|
say $contents;
|
||||||
|
exit $katla.exitcode;
|
||||||
|
}
|
||||||
$contents = stylize $contents;
|
$contents = stylize $contents;
|
||||||
# Make sure the directory exists and write the contents to it
|
# Make sure the directory exists and write the contents to it
|
||||||
$out-file.dirname.IO.mkdir;
|
$out-file.dirname.IO.mkdir;
|
||||||
|
@ -96,6 +104,8 @@ 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
|
||||||
|
"/home/nathan/Projects/Idris/.scripts/src/katla.dhall",
|
||||||
) {
|
) {
|
||||||
# cd to the projet directory if needed
|
# cd to the projet directory if needed
|
||||||
if $project_dir ~~ Str {
|
if $project_dir ~~ Str {
|
||||||
|
@ -125,7 +135,7 @@ sub MAIN(
|
||||||
# temporary directory
|
# temporary directory
|
||||||
my %index = %();
|
my %index = %();
|
||||||
for @idris-files.hyper :batch(1) -> $idr {
|
for @idris-files.hyper :batch(1) -> $idr {
|
||||||
my $out = render-idris-file $idr;
|
my $out = render-idris-file $idr, $katla-config.IO;
|
||||||
%index.&add-path($idr, $out.relative($dir)) when $out ~~ IO;
|
%index.&add-path($idr, $out.relative($dir)) when $out ~~ IO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue