diff --git a/Makefile b/Makefile index dcfd31c9..c6ce22b7 100644 --- a/Makefile +++ b/Makefile @@ -84,13 +84,14 @@ coverage: # generate documentation for Statup functions docs: - godoc2md github.com/hunterlong/statup/core > dev/README.md - godoc2md github.com/hunterlong/statup/cmd >> dev/README.md - godoc2md github.com/hunterlong/statup/handlers >> dev/README.md - godoc2md github.com/hunterlong/statup/notifiers >> dev/README.md - godoc2md github.com/hunterlong/statup/source >> dev/README.md - godoc2md github.com/hunterlong/statup/types >> dev/README.md - godoc2md github.com/hunterlong/statup/utils >> dev/README.md + godoc2md -ex github.com/hunterlong/statup/cmd >> dev/README.md + godoc2md -ex github.com/hunterlong/statup/core > dev/README.md + godoc2md -ex github.com/hunterlong/statup/handlers >> dev/README.md + godoc2md -ex github.com/hunterlong/statup/notifiers >> dev/README.md + godoc2md -ex github.com/hunterlong/statup/plugin >> dev/README.md + godoc2md -ex github.com/hunterlong/statup/source >> dev/README.md + godoc2md -ex github.com/hunterlong/statup/types >> dev/README.md + godoc2md -ex github.com/hunterlong/statup/utils >> dev/README.md gocov-html coverage.json > dev/COVERAGE.html revive -formatter stylish > dev/LINT.md diff --git a/dev/COVERAGE.html b/dev/COVERAGE.html index faa78bc5..6e722e20 100644 --- a/dev/COVERAGE.html +++ b/dev/COVERAGE.html @@ -128,7 +128,7 @@
Coverage Report
-
Generated on 06 Oct 18 03:05 -0700 with gocov-html
Report Overview
+
Generated on 06 Oct 18 03:10 -0700 with gocov-html
Report Overview
diff --git a/dev/README.md b/dev/README.md index 39f21202..84e3f909 100644 --- a/dev/README.md +++ b/dev/README.md @@ -1391,26 +1391,6 @@ Update will update the user's record in database -> cmd -Package main for building the Statup CLI binary application. This package -connects to all the other packages to make a runnable binary for multiple -operating system. - -To build Statup from source, run the follow command in the root directory: -// go build -o statup ./cmd - -Remember that you'll need to compile the static assets using Rice: -// cd source && rice embed-go - -More info on: https://github.com/hunterlong/statup - - - - - - - - # handlers `import "github.com/hunterlong/statup/handlers"` @@ -1533,11 +1513,286 @@ and learn how to create your own custom notifier. +# plugin +`import "github.com/hunterlong/statup/plugin"` + +* [Overview](#pkg-overview) +* [Index](#pkg-index) + +## Overview +Package plugin contains the interfaces to build your own Golang Plugin that will receive triggers on Statup events. + + + + +## Index +* [Variables](#pkg-variables) +* [func SetDatabase(database *gorm.DB)](#SetDatabase) +* [type AdvancedNotifier](#AdvancedNotifier) +* [type Database](#Database) +* [type Databaser](#Databaser) +* [type Info](#Info) +* [type Notifier](#Notifier) +* [type Plugin](#Plugin) +* [type PluginDatabase](#PluginDatabase) +* [type PluginInfo](#PluginInfo) + * [func (p *PluginInfo) Form() string](#PluginInfo.Form) +* [type PluginObject](#PluginObject) + * [func Add(p Pluginer) *PluginObject](#Add) + * [func (p *PluginObject) AddRoute(s string, i string, f http.HandlerFunc)](#PluginObject.AddRoute) +* [type Pluginer](#Pluginer) +* [type Router](#Router) +* [type Routing](#Routing) + + +#### Package files +[doc.go](https://github.com/hunterlong/statup/tree/master/plugin/doc.go) [main.go](https://github.com/hunterlong/statup/tree/master/plugin/main.go) + + + +## Variables +``` go +var ( + AllPlugins []*PluginObject +) +``` +``` go +var ( + DB *gorm.DB +) +``` + + +## func [SetDatabase](https://github.com/hunterlong/statup/tree/master/plugin/main.go?s=1991:2026#L107) +``` go +func SetDatabase(database *gorm.DB) +``` + + + +## type [AdvancedNotifier](https://github.com/hunterlong/statup/tree/master/plugin/main.go?s=1440:1583#L67) +``` go +type AdvancedNotifier interface { + notifier.Notifier + notifier.BasicEvents + notifier.UserEvents + notifier.CoreEvents + notifier.NotifierEvents +} +``` + + + + + + + + + +## type [Database](https://github.com/hunterlong/statup/tree/master/plugin/main.go?s=1796:1818#L91) +``` go +type Database *gorm.DB +``` + + + + + + + + + +## type [Databaser](https://github.com/hunterlong/statup/tree/master/plugin/main.go?s=1237:1291#L54) +``` go +type Databaser interface { + StatupDatabase(*gorm.DB) +} +``` + + + + + + + + + +## type [Info](https://github.com/hunterlong/statup/tree/master/plugin/main.go?s=1714:1794#L85) +``` go +type Info struct { + Name string + Description string + Form string +} + +``` + + + + + + + + + +## type [Notifier](https://github.com/hunterlong/statup/tree/master/plugin/main.go?s=1370:1438#L62) +``` go +type Notifier interface { + notifier.Notifier + notifier.BasicEvents +} +``` + + + + + + + + + +## type [Plugin](https://github.com/hunterlong/statup/tree/master/plugin/main.go?s=1820:1882#L93) +``` go +type Plugin struct { + Name string + Description string +} + +``` + + + + + + + + + +## type [PluginDatabase](https://github.com/hunterlong/statup/tree/master/plugin/main.go?s=1884:1952#L98) +``` go +type PluginDatabase interface { + Database(gorm.DB) + Update() error +} +``` + + + + + + + + + +## type [PluginInfo](https://github.com/hunterlong/statup/tree/master/plugin/main.go?s=1954:1989#L103) +``` go +type PluginInfo struct { + // contains filtered or unexported fields +} + +``` + + + + + + + + + +### func (\*PluginInfo) [Form](https://github.com/hunterlong/statup/tree/master/plugin/main.go?s=2047:2081#L111) +``` go +func (p *PluginInfo) Form() string +``` + + + +## type [PluginObject](https://github.com/hunterlong/statup/tree/master/plugin/main.go?s=977:1003#L36) +``` go +type PluginObject struct{} + +``` + + + + + + +### func [Add](https://github.com/hunterlong/statup/tree/master/plugin/main.go?s=1042:1076#L42) +``` go +func Add(p Pluginer) *PluginObject +``` + + + + +### func (\*PluginObject) [AddRoute](https://github.com/hunterlong/statup/tree/master/plugin/main.go?s=1106:1177#L46) +``` go +func (p *PluginObject) AddRoute(s string, i string, f http.HandlerFunc) +``` + + + +## type [Pluginer](https://github.com/hunterlong/statup/tree/master/plugin/main.go?s=1184:1235#L50) +``` go +type Pluginer interface { + Select() *PluginObject +} +``` + + + + + + + + + +## type [Router](https://github.com/hunterlong/statup/tree/master/plugin/main.go?s=1293:1368#L58) +``` go +type Router interface { + AddRoute(string, string, http.HandlerFunc) error +} +``` + + + + + + + + + +## type [Routing](https://github.com/hunterlong/statup/tree/master/plugin/main.go?s=1607:1712#L79) +``` go +type Routing struct { + URL string + Method string + Handler func(http.ResponseWriter, *http.Request) +} + +``` + + + + + + + + + + + + + + + # source `import "github.com/hunterlong/statup/source"` * [Overview](#pkg-overview) * [Index](#pkg-index) +* [Examples](#pkg-examples) ## Overview Package source holds all the assets for Statup. This includes @@ -1564,6 +1819,9 @@ More info on: https://github.com/ * [func SaveAsset(data []byte, folder, file string) error](#SaveAsset) * [func UsingAssets(folder string) bool](#UsingAssets) +#### Examples +* [OpenAsset](#example_OpenAsset) +* [SaveAsset](#example_SaveAsset) #### Package files [doc.go](https://github.com/hunterlong/statup/tree/master/source/doc.go) [rice-box.go](https://github.com/hunterlong/statup/tree/master/source/rice-box.go) [source.go](https://github.com/hunterlong/statup/tree/master/source/source.go) @@ -1645,6 +1903,13 @@ OpenAsset returns a file's contents as a string +#### Example + +Code: +``` go +OpenAsset("js", "main.js") +``` + ## func [SaveAsset](https://github.com/hunterlong/statup/tree/master/source/source.go?s=3910:3964#L131) ``` go func SaveAsset(data []byte, folder, file string) error @@ -1653,6 +1918,14 @@ SaveAsset will save an asset to the '/assets/' folder. +#### Example + +Code: +``` go +data := []byte("alert('helloooo')") +SaveAsset(data, "js", "test.js") +``` + ## func [UsingAssets](https://github.com/hunterlong/statup/tree/master/source/source.go?s=3365:3401#L111) ``` go func UsingAssets(folder string) bool
github.com/hunterlong/statup/cmd31.37%48/153
github.com/hunterlong/statup/core53.01%485/915
github.com/hunterlong/statup/core/notifier72.73%152/209