/
install.go
40 lines (35 loc) · 923 Bytes
/
install.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
package supermarket
import (
"github.com/chef/go-chef-cli/core"
)
type InstallArtifact struct {
// artifact install location
Location string
// artifact name for download
ArtifactName string
da DownloadArtifact
}
type InstallProvider interface {
Install(ui core.UI, config core.Config)
InstallDeps() bool
ChangeArtifactName(artifactName string)
}
func NewInstallProvider(cookbookName, url, location, defaultBranch, artifact string, installDeps, useCurrentBranch bool) InstallProvider {
if artifact == ArtifactCookbook {
return CookbookInstall{
UseCurrentBranch: useCurrentBranch,
DefaultBranch: defaultBranch,
InstallDep: installDeps,
InstallArtifact: InstallArtifact{
Location: location,
ArtifactName: cookbookName,
da: DownloadArtifact{
Location: location,
ArtifactName: cookbookName,
Url: url,
},
},
}
}
return nil
}