-
Notifications
You must be signed in to change notification settings - Fork 12
/
update.go
41 lines (33 loc) · 947 Bytes
/
update.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
package cli
import (
"fmt"
"github.com/bitrise-io/go-utils/log"
"github.com/bitrise-io/stepman/stepman"
"github.com/urfave/cli"
)
func update(c *cli.Context) error {
var collectionURIs []string
// StepSpec collection path
collectionURI := c.String(CollectionKey)
if collectionURI == "" {
log.Infof("No StepLib specified, update all...")
collectionURIs = stepman.GetAllStepCollectionPath()
} else {
collectionURIs = []string{collectionURI}
}
if len(collectionURIs) == 0 {
log.Infof("No local StepLib found, nothing to update...")
}
for _, URI := range collectionURIs {
log.Infof("Update StepLib (%s)...", URI)
if err := UpdateLibrary(URI, log.NewDefaultLogger(false)); err != nil {
return fmt.Errorf("Failed to update StepLib (%s), error: %s", URI, err)
}
}
return nil
}
// UpdateLibrary ...
func UpdateLibrary(uri string, log stepman.Logger) error {
_, err := stepman.UpdateLibrary(uri, log)
return err
}