summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/ponzu/main.go6
-rw-r--r--cmd/ponzu/options.go41
2 files changed, 27 insertions, 20 deletions
diff --git a/cmd/ponzu/main.go b/cmd/ponzu/main.go
index 48aef9e..234d3b6 100644
--- a/cmd/ponzu/main.go
+++ b/cmd/ponzu/main.go
@@ -11,6 +11,7 @@ import (
"github.com/bosssauce/ponzu/system/admin"
"github.com/bosssauce/ponzu/system/api"
+ "github.com/bosssauce/ponzu/system/api/analytics"
"github.com/bosssauce/ponzu/system/db"
"github.com/bosssauce/ponzu/system/tls"
)
@@ -169,6 +170,11 @@ func main() {
case "serve", "s":
db.Init()
+ defer db.Close()
+
+ analytics.Init()
+ defer analytics.Close()
+
if len(args) > 1 {
services := strings.Split(args[1], ",")
diff --git a/cmd/ponzu/options.go b/cmd/ponzu/options.go
index 6f42f0c..b23ab2d 100644
--- a/cmd/ponzu/options.go
+++ b/cmd/ponzu/options.go
@@ -75,30 +75,11 @@ type {{ .name }} struct {
Title string ` + "`json:" + `"title"` + "`" + `
Content string ` + "`json:" + `"content"` + "`" + `
Author string ` + "`json:" + `"author"` + "`" + `
- Photo string ` + "`json:" + `"picture"` + "`" + `
+ Photo string ` + "`json:" + `"photo"` + "`" + `
Category []string ` + "`json:" + `"category"` + "`" + `
Theme string ` + "`json:" + `"theme"` + "`" + `
}
-func init() {
- Types["{{ .name }}"] = func() interface{} { return new({{ .name }}) }
-}
-
-// SetContentID partially implements editor.Editable
-func ({{ .initial }} *{{ .name }}) SetContentID(id int) { {{ .initial }}.ID = id }
-
-// ContentID partially implements editor.Editable
-func ({{ .initial }} *{{ .name }}) ContentID() int { return {{ .initial }}.ID }
-
-// ContentName partially implements editor.Editable
-func ({{ .initial }} *{{ .name }}) ContentName() string { return {{ .initial }}.Title }
-
-// SetSlug partially implements editor.Editable
-func ({{ .initial }} *{{ .name }}) SetSlug(slug string) { {{ .initial }}.Slug = slug }
-
-// Editor partially implements editor.Editable
-func ({{ .initial }} *{{ .name }}) Editor() *editor.Editor { return &{{ .initial }}.editor }
-
// MarshalEditor writes a buffer of html to edit a {{ .name }} and partially implements editor.Editable
func ({{ .initial }} *{{ .name }}) MarshalEditor() ([]byte, error) {
view, err := editor.Form({{ .initial }},
@@ -152,6 +133,26 @@ func ({{ .initial }} *{{ .name }}) MarshalEditor() ([]byte, error) {
return view, nil
}
+
+func init() {
+ Types["{{ .name }}"] = func() interface{} { return new({{ .name }}) }
+}
+
+// SetContentID partially implements editor.Editable
+func ({{ .initial }} *{{ .name }}) SetContentID(id int) { {{ .initial }}.ID = id }
+
+// ContentID partially implements editor.Editable
+func ({{ .initial }} *{{ .name }}) ContentID() int { return {{ .initial }}.ID }
+
+// ContentName partially implements editor.Editable
+func ({{ .initial }} *{{ .name }}) ContentName() string { return {{ .initial }}.Title }
+
+// SetSlug partially implements editor.Editable
+func ({{ .initial }} *{{ .name }}) SetSlug(slug string) { {{ .initial }}.Slug = slug }
+
+// Editor partially implements editor.Editable
+func ({{ .initial }} *{{ .name }}) Editor() *editor.Editor { return &{{ .initial }}.editor }
+
`
func newProjectInDir(path string) error {