forked from NikolaLohinski/terraform-provider-freebox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmagefile.go
53 lines (43 loc) · 875 Bytes
/
magefile.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
//go:build mage
// +build mage
package main
import (
"fmt"
"os"
"path"
"path/filepath"
// mage:import
"github.com/nikolalohinski/terraform-provider-freebox/spellbook"
"github.com/magefile/mage/mg"
"github.com/magefile/mage/sh"
)
var Default = Verify
func init() {
name, err := os.Getwd()
if err != nil {
panic(err)
}
p, err := filepath.Abs(path.Join(name, "tools", "bin"))
if err != nil {
panic(err)
}
if err := os.Setenv("MAGEFILE_VERBOSE", "true"); err != nil {
panic(err)
}
if err = os.Setenv("PATH", fmt.Sprintf("%s:%s", p, os.Getenv("PATH"))); err != nil {
panic(err)
}
}
// Fetch and installs tooling for development
func Install() error {
return sh.RunV("mage", "-d", "./tools")
}
// Validate code base
func Verify() {
mg.SerialDeps(
spellbook.Docs.Build,
spellbook.Book.Build,
spellbook.Go.Tidy,
spellbook.Go.Cover,
)
}