-
Notifications
You must be signed in to change notification settings - Fork 338
/
descriptor.go
57 lines (48 loc) · 1.21 KB
/
descriptor.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*----------------------------------------------------------------
* Copyright (c) ThoughtWorks, Inc.
* Licensed under the Apache License, Version 2.0
* See LICENSE in the project root for license information.
*----------------------------------------------------------------*/
package plugin
import (
"strings"
"github.com/getgauge/gauge/version"
)
type pluginCapability string
const (
gRPCSupportCapability pluginCapability = "grpc_support"
)
type PluginDescriptor struct {
ID string
Version string
Name string
Description string
Command struct {
Windows []string
Linux []string
Darwin []string
}
Scope []string
GaugeVersionSupport version.VersionSupport
pluginPath string
Capabilities []string
}
func (pd *PluginDescriptor) hasScope(scope pluginScope) bool {
for _, s := range pd.Scope {
if strings.ToLower(s) == string(scope) {
return true
}
}
return false
}
func (pd *PluginDescriptor) hasAnyScope() bool {
return len(pd.Scope) > 0
}
func (pd *PluginDescriptor) hasCapability(capability pluginCapability) bool {
for _, c := range pd.Capabilities {
if strings.ToLower(c) == string(capability) {
return true
}
}
return false
}