forked from gobuffalo/buffalo
/
updater.go
40 lines (32 loc) · 798 Bytes
/
updater.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 updater
import (
"bufio"
"fmt"
"os"
"strings"
)
// Version is the current Buffalo version. It is set here by the cmd package.
// This is due to circular dependencies
var Version string
var replace = map[string]string{
"github.com/markbates/pop": "github.com/gobuffalo/pop",
"github.com/markbates/validate": "github.com/gobuffalo/validate",
"github.com/satori/go.uuid": "github.com/gobuffalo/uuid",
}
var ic = ImportConverter{
Data: replace,
}
var checks = []Check{
ic.Process,
WebpackCheck,
PackageJSONCheck,
DepEnsure,
DeprecrationsCheck,
}
func ask(q string) bool {
fmt.Printf("? %s [y/n]\n", q)
reader := bufio.NewReader(os.Stdin)
text, _ := reader.ReadString('\n')
text = strings.ToLower(strings.TrimSpace(text))
return text == "y" || text == "yes"
}