forked from imjerrybao/apex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugin.go
36 lines (28 loc) · 837 Bytes
/
plugin.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package function
import "github.com/apex/apex/archive"
// A Plugin is a chunk of isolated(ish) logic which reacts to various
// hooks within the system in order to implement specific features
// such as runtime inference or environment variable support.
type Plugin interface{}
// Opener reacts to the Open hook.
type Opener interface {
Open(*Function) error
}
// Builder reacts to the Build hook.
type Builder interface {
Build(*Function, *archive.Zip) error
}
// Cleaner reacts to the Clean hook.
type Cleaner interface {
Clean(*Function) error
}
// Deployer reacts to the Deploy hook.
type Deployer interface {
Deploy(*Function) error
}
// Registered plugins.
var plugins = make(map[string]Plugin)
// RegisterPlugin registers `plugin` by `name`.
func RegisterPlugin(name string, plugin Plugin) {
plugins[name] = plugin
}