cmd

package
v0.0.0-...-dfd7d1f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2015 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InstallCommand cli.Command = cli.Command{
	Name:  "install",
	Usage: "install ablog engine",
	Action: func(_ *cli.Context) {

		if core.Config.HasFile() {
			core.Log.Fatal("ABlog has been installed")
		}

		if err := core.Config.WriteFile(); err != nil {
			core.Log.Fatal("instaill fail : %v", err)
		}

		core.PrepareDB()

		createAdminUser()

		core.Log.Info("ABlog is installed successfully !!")
	},
}
View Source
var ServerCommand cli.Command = cli.Command{
	Name:  "server",
	Usage: "run ablog web server",
	Action: func(ctx *cli.Context) {

		if core.Db == nil || core.Web == nil {
			core.Log.Fatal("did you install ABlog?")
		}

		if err := model.Register(); err != nil {
			panic(err)
		}

		controller.Register()

		core.Web.Run()
	},
}
View Source
var TestCommand cli.Command = cli.Command{
	Name:  "test",
	Usage: "ablog functionalities testing",
	Action: func(ctx *cli.Context) {
		fmt.Println(core.Model.Save(&User{
			Id:    66,
			Email: "test@qq.com",
			Name:  "test",
			Role:  "admin",
		}))
		fmt.Println(core.Model.Register(new(User)))

	},
}

Functions

This section is empty.

Types

type User

type User struct {
	Id           int64  `model:"pk"`
	Name         string `model:"unique"`
	Password     string
	PasswordSalt string

	NickName string
	Email    string `model:"unique"`
	Url      string
	Bio      string

	CreateTime    time.Time
	LastLoginTime time.Time

	Role   string `model:"index"`
	Social map[string]string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL