summaryrefslogtreecommitdiffhomepage
path: root/magefile.go
diff options
context:
space:
mode:
Diffstat (limited to 'magefile.go')
-rw-r--r--magefile.go35
1 files changed, 34 insertions, 1 deletions
diff --git a/magefile.go b/magefile.go
index 19485b2be..04f0499a2 100644
--- a/magefile.go
+++ b/magefile.go
@@ -15,6 +15,9 @@ import (
"sync"
"time"
+ "github.com/gohugoio/hugo/codegen"
+ "github.com/gohugoio/hugo/resources/page/page_generate"
+
"github.com/magefile/mage/mg"
"github.com/magefile/mage/sh"
)
@@ -64,7 +67,37 @@ func flagEnv() map[string]string {
}
func Generate() error {
- return sh.RunWith(flagEnv(), goexe, "generate", path.Join(packageName, "tpl/tplimpl/embedded/generate"))
+ generatorPackages := []string{
+ "tpl/tplimpl/embedded/generate",
+ //"resources/page/generate",
+ }
+
+ for _, pkg := range generatorPackages {
+ if err := sh.RunWith(flagEnv(), goexe, "generate", path.Join(packageName, pkg)); err != nil {
+ return err
+ }
+ }
+
+ dir, _ := os.Getwd()
+ c := codegen.NewInspector(dir)
+
+ if err := page_generate.Generate(c); err != nil {
+ return err
+ }
+
+ goFmtPatterns := []string{
+ // TODO(bep) check: stat ./resources/page/*autogen*: no such file or directory
+ "./resources/page/page_marshaljson.autogen.go",
+ "./resources/page/page_wrappers.autogen.go",
+ }
+
+ for _, pattern := range goFmtPatterns {
+ if err := sh.Run("gofmt", "-w", filepath.FromSlash(pattern)); err != nil {
+ return err
+ }
+ }
+
+ return nil
}
// Build hugo without git info