Add ipkg path to idrispost
This commit is contained in:
parent
addce4f87c
commit
56833369ce
2 changed files with 20 additions and 0 deletions
7
blog
7
blog
|
@ -25,6 +25,9 @@ my IO::Path:D $default-db-dir =
|
||||||
#| The default output directory
|
#| The default output directory
|
||||||
my IO::Path:D $default-site-dir = $default-blog-dir.add('site/');
|
my IO::Path:D $default-site-dir = $default-blog-dir.add('site/');
|
||||||
|
|
||||||
|
#| The default idris ipkg
|
||||||
|
my IO::Path:D $default-ipkg = $default-blog-dir.add('projects/Idris/Idris.ipkg');
|
||||||
|
|
||||||
#| Initalize the database
|
#| Initalize the database
|
||||||
multi MAIN(
|
multi MAIN(
|
||||||
"db",
|
"db",
|
||||||
|
@ -92,6 +95,8 @@ multi MAIN(
|
||||||
"idris",
|
"idris",
|
||||||
#| The path to the idris file
|
#| The path to the idris file
|
||||||
IO::Path(Str) $source,
|
IO::Path(Str) $source,
|
||||||
|
#| The path to the ipkg file
|
||||||
|
IO::Path(Str) :$ipkg = $default-ipkg,
|
||||||
#| The path of the database file
|
#| The path of the database file
|
||||||
IO::Path(Str) :$db-dir = $default-db-dir,
|
IO::Path(Str) :$db-dir = $default-db-dir,
|
||||||
#| The date/time the post should be recorded as posted at
|
#| The date/time the post should be recorded as posted at
|
||||||
|
@ -99,6 +104,7 @@ multi MAIN(
|
||||||
#| Should the post be hidden from the archive?
|
#| Should the post be hidden from the archive?
|
||||||
Bool :$hidden = False,
|
Bool :$hidden = False,
|
||||||
) {
|
) {
|
||||||
|
say $default-ipkg;
|
||||||
my $db = read-db $db-dir;
|
my $db = read-db $db-dir;
|
||||||
my $id =
|
my $id =
|
||||||
$db.insert-post:
|
$db.insert-post:
|
||||||
|
@ -106,6 +112,7 @@ multi MAIN(
|
||||||
source => $source.absolute.IO,
|
source => $source.absolute.IO,
|
||||||
posted-at => $posted-at,
|
posted-at => $posted-at,
|
||||||
hidden => $hidden,
|
hidden => $hidden,
|
||||||
|
ipkg => $ipkg.absolute.IO,
|
||||||
);
|
);
|
||||||
$db.write: $db-dir;
|
$db.write: $db-dir;
|
||||||
say 'Post inserted with id ', $id;
|
say 'Post inserted with id ', $id;
|
||||||
|
|
|
@ -13,6 +13,14 @@ unit class IdrisPost does Post is json(:pretty);
|
||||||
#| cheaty way
|
#| cheaty way
|
||||||
has Bool:D $.idris = True;
|
has Bool:D $.idris = True;
|
||||||
|
|
||||||
|
#| Location of the ipkg for the package containing the post
|
||||||
|
has IO::Path:D $.ipkg
|
||||||
|
is required
|
||||||
|
is json(
|
||||||
|
:to-json(*.Str),
|
||||||
|
:from-json(*.IO)
|
||||||
|
);
|
||||||
|
|
||||||
method title(--> Str:D) {
|
method title(--> Str:D) {
|
||||||
markdown-title($!source)
|
markdown-title($!source)
|
||||||
}
|
}
|
||||||
|
@ -20,5 +28,10 @@ method title(--> Str:D) {
|
||||||
# Use katla to highlight our file, mangle the resulting output, and then pass it
|
# Use katla to highlight our file, mangle the resulting output, and then pass it
|
||||||
# through to pandoc for html generation
|
# through to pandoc for html generation
|
||||||
method render-html(--> Str:D) {
|
method render-html(--> Str:D) {
|
||||||
|
# Do a pack build to make sure we have the needed files
|
||||||
|
# TODO: Figure out how to only do this once
|
||||||
|
|
||||||
|
# Run through katla
|
||||||
|
# Send output
|
||||||
die "Not implemented";
|
die "Not implemented";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue