rebot

package
v0.0.0-...-6f8e8b2 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2017 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exit

func Exit()

Exit 指示退出程序

func Run

func Run()

Run 启动

Types

type CommentMsg

type CommentMsg struct {
	Owner    string
	Repo     string
	Body     string
	Issue    int
	TryCount int
}

CommentMsg Comment信息

type GithubWorker

type GithubWorker struct {
	// contains filtered or unexported fields
}

GithubWorker Github相关处理

func NewGithubWorker

func NewGithubWorker() (*GithubWorker, error)

NewGithubWorker 创建实例,必须存在密钥

func (*GithubWorker) GithubHookHandler

func (s *GithubWorker) GithubHookHandler(w http.ResponseWriter, r *http.Request)

GithubHookHandler Github Web Hook回调处理入口

func (*GithubWorker) StartWorker

func (s *GithubWorker) StartWorker()

StartWorker 启动Event监控处理

type Hugo

type Hugo struct {
	// contains filtered or unexported fields
}

Hugo 处理Hugo结构相关

func (Hugo) Commit

func (h Hugo) Commit(file, message string) error

Commit 提交Hugo项目文件到Git

func (Hugo) CreatePage

func (h Hugo) CreatePage(section, filename string, content []byte) (file string, err error)

CreatePage 在本地创建Page文件,并返回文件路径 按照所指定的分类,在本地对应目录下创建md文件

1.article : root/content/articles/YYYYMM
2.news: 	root/content/news/YYYY
3.book:	root/content/books
4.job:		root/content/jobs/YYYY
5.pkg:		root/content/packages/

func (Hugo) GenPageContent

func (h Hugo) GenPageContent(category string, page PageInfo, issue *github.Issue) ([]byte, error)

GenPageContent 将Issue转换为指定的文章内容

type Key

type Key struct {
	*ini.Key
}

Key ini key 扩展

func (Key) GetStrings

func (k Key) GetStrings() []string

GetStrings 获取[]string,按中英文逗号和空格,以及# 进行分割处理

func (Key) GetValue

func (k Key) GetValue(valueType reflect.Type) interface{}

GetValue 获取数据值

type PageInfo

type PageInfo struct {
	Title   string   `ini:"title" ck:"required"`
	URL     string   `ini:"url" ck:"required"`
	Tags    []string `ini:"tags"`
	Content string   `ini:"content"`
}

PageInfo 可从Issue comment中提炼出的信息。

func NewPageInfo

func NewPageInfo(comment string) (PageInfo, error)

NewPageInfo 根据section节点信息创建Page对象,如果内容不符合条件则返回错误信息

func (PageInfo) ToIni

func (p PageInfo) ToIni() string

ToIni 将Page内容转换为Ini 转换时只显示内容不为空的部分

Jump to

Keyboard shortcuts

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