mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
parent
9536f7cd05
commit
f711b170e4
1 changed files with 16 additions and 16 deletions
32
magefile.go
32
magefile.go
|
@ -32,14 +32,14 @@ func init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func govendor() error {
|
func getDep() error {
|
||||||
return sh.Run(goexe, "get", "github.com/kardianos/govendor")
|
return sh.Run(goexe, "get", "-u", "github.com/golang/dep/cmd/dep")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Install govendor and sync Hugo's vendored dependencies
|
// Install Go Dep and sync Hugo's vendored dependencies
|
||||||
func Vendor() error {
|
func Vendor() error {
|
||||||
mg.Deps(govendor)
|
mg.Deps(getDep)
|
||||||
return sh.Run("govendor", "sync", packageName)
|
return sh.Run("dep", "ensure")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build hugo binary
|
// Build hugo binary
|
||||||
|
@ -103,19 +103,19 @@ func Check() {
|
||||||
|
|
||||||
// Run tests in 32-bit mode
|
// Run tests in 32-bit mode
|
||||||
func Test386() error {
|
func Test386() error {
|
||||||
return sh.RunWith(map[string]string{"GOARCH": "386"}, "govendor", "test", "+local")
|
return sh.RunWith(map[string]string{"GOARCH": "386"}, goexe, "test", "./...")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run tests
|
// Run tests
|
||||||
func Test() error {
|
func Test() error {
|
||||||
mg.Deps(govendor)
|
mg.Deps(getDep)
|
||||||
return sh.Run("govendor", "test", "+local")
|
return sh.Run(goexe, "test", "./...")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run tests with race detector
|
// Run tests with race detector
|
||||||
func TestRace() error {
|
func TestRace() error {
|
||||||
mg.Deps(govendor)
|
mg.Deps(getDep)
|
||||||
return sh.Run("govendor", "test", "-race", "+local")
|
return sh.Run(goexe, "test", "-race", "./...")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run gofmt linter
|
// Run gofmt linter
|
||||||
|
@ -159,8 +159,8 @@ func Fmt() error {
|
||||||
var pkgPrefixLen = len("github.com/gohugoio/hugo")
|
var pkgPrefixLen = len("github.com/gohugoio/hugo")
|
||||||
|
|
||||||
func hugoPackages() ([]string, error) {
|
func hugoPackages() ([]string, error) {
|
||||||
mg.Deps(govendor)
|
mg.Deps(getDep)
|
||||||
s, err := sh.Output("govendor", "list", "-no-status", "+local")
|
s, err := sh.Output(goexe, "list", "./...")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -194,8 +194,8 @@ func Lint() error {
|
||||||
|
|
||||||
// Run go vet linter
|
// Run go vet linter
|
||||||
func Vet() error {
|
func Vet() error {
|
||||||
mg.Deps(govendor)
|
mg.Deps(getDep)
|
||||||
if err := sh.Run("govendor", "vet", "+local"); err != nil {
|
if err := sh.Run(goexe, "vet", "./..."); err != nil {
|
||||||
return fmt.Errorf("error running govendor: %v", err)
|
return fmt.Errorf("error running govendor: %v", err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -203,7 +203,7 @@ func Vet() error {
|
||||||
|
|
||||||
// Generate test coverage report
|
// Generate test coverage report
|
||||||
func TestCoverHTML() error {
|
func TestCoverHTML() error {
|
||||||
mg.Deps(govendor)
|
mg.Deps(getDep)
|
||||||
const (
|
const (
|
||||||
coverAll = "coverage-all.out"
|
coverAll = "coverage-all.out"
|
||||||
cover = "coverage.out"
|
cover = "coverage.out"
|
||||||
|
@ -221,7 +221,7 @@ func TestCoverHTML() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
for _, pkg := range pkgs {
|
for _, pkg := range pkgs {
|
||||||
if err := sh.Run("govendor", "test", "-coverprofile="+cover, "-covermode=count", pkg); err != nil {
|
if err := sh.Run(goexe, "test", "-coverprofile="+cover, "-covermode=count", pkg); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
b, err := ioutil.ReadFile(cover)
|
b, err := ioutil.ReadFile(cover)
|
||||||
|
|
Loading…
Reference in a new issue