Skip to content

Commit b705caf

Browse files
feat: Add Build function
1 parent f7ba06a commit b705caf

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

quarto/main.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,18 @@ func (m *Quarto) Container() *dagger.Container {
5656
return m.Ctr
5757
}
5858

59+
// Build runs the quarto render command exporting to a directory
60+
func (m *Quarto) Build(
61+
// source directory.
62+
source *dagger.Directory,
63+
) *dagger.Directory {
64+
65+
return m.Container().
66+
WithDirectory("/tmp", source).
67+
WithWorkdir("/tmp").
68+
WithExec([]string{"quarto", "render"}).Directory("/tmp/_book")
69+
}
70+
5971
// Render runs the quarto render command
6072
func (m *Quarto) Render(
6173
// source directory.

quarto/main_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package main_test
33
import (
44
"context"
55
"flag"
6-
"fmt"
76
"os"
87
"testing"
98

@@ -50,9 +49,8 @@ func Test_Quarto(t *testing.T) {
5049
files, err := os.ReadDir(outputDir)
5150
require.NoError(t, err)
5251

53-
fmt.Println(files)
5452
for _, file := range files {
55-
require.Regexp(t, `\.pdf\s*$`, file)
53+
require.Regexp(t, `\.pdf$`, file)
5654
}
5755

5856
err = os.RemoveAll(outputDir)

0 commit comments

Comments
 (0)