refact yaml operations to yaml package

This commit is contained in:
Brad Rydzewski 2016-04-19 13:02:28 -07:00
parent 62ccf1bd60
commit fd63d6e03d
16 changed files with 14 additions and 14 deletions

0
.github/pull_request_template.md vendored Normal file
View file

2
.gitignore vendored
View file

@ -1,4 +1,4 @@
drone drone/drone
drone_* drone_*
*.sqlite *.sqlite
*_gen.go *_gen.go

View file

@ -11,13 +11,13 @@ import (
log "github.com/Sirupsen/logrus" log "github.com/Sirupsen/logrus"
"github.com/drone/drone/engine" "github.com/drone/drone/engine"
"github.com/drone/drone/engine/parser"
"github.com/drone/drone/model" "github.com/drone/drone/model"
"github.com/drone/drone/queue"
"github.com/drone/drone/remote" "github.com/drone/drone/remote"
"github.com/drone/drone/shared/httputil" "github.com/drone/drone/shared/httputil"
"github.com/drone/drone/shared/token" "github.com/drone/drone/shared/token"
"github.com/drone/drone/store" "github.com/drone/drone/store"
"github.com/drone/drone/queue" "github.com/drone/drone/yaml"
) )
var ( var (
@ -148,13 +148,13 @@ func PostHook(c *gin.Context) {
// NOTE we don't exit on failure. The sec file is optional // NOTE we don't exit on failure. The sec file is optional
} }
axes, err := parser.ParseMatrix(raw) axes, err := yaml.ParseMatrix(raw)
if err != nil { if err != nil {
c.String(500, "Failed to parse yaml file or calculate matrix. %s", err) c.String(500, "Failed to parse yaml file or calculate matrix. %s", err)
return return
} }
if len(axes) == 0 { if len(axes) == 0 {
axes = append(axes, parser.Axis{}) axes = append(axes, yaml.Axis{})
} }
netrc, err := remote_.Netrc(user, repo) netrc, err := remote_.Netrc(user, repo)
@ -166,7 +166,7 @@ func PostHook(c *gin.Context) {
key, _ := store.GetKey(c, repo) key, _ := store.GetKey(c, repo)
// verify the branches can be built vs skipped // verify the branches can be built vs skipped
branches := parser.ParseBranch(raw) branches := yaml.ParseBranch(raw)
if !branches.Matches(build.Branch) { if !branches.Matches(build.Branch) {
c.String(200, "Branch does not match restrictions defined in yaml") c.String(200, "Branch does not match restrictions defined in yaml")
return return

View file

@ -1,4 +1,4 @@
package parser package yaml
import ( import (
"path/filepath" "path/filepath"

View file

@ -1,4 +1,4 @@
package parser package yaml
import ( import (
"testing" "testing"

View file

@ -1,4 +1,4 @@
package shasum package checksum
import ( import (
"crypto/sha1" "crypto/sha1"

View file

@ -1,4 +1,4 @@
package shasum package checksum
import ( import (
"testing" "testing"

View file

@ -1,4 +1,4 @@
package parser package yaml
import ( import (
"strings" "strings"

View file

@ -1,4 +1,4 @@
package parser package yaml
import ( import (
"testing" "testing"

View file

@ -1,4 +1,4 @@
package parser package yaml
// stringOrSlice represents a string or an array of strings. // stringOrSlice represents a string or an array of strings.
type stringOrSlice struct { type stringOrSlice struct {

View file

@ -1,4 +1,4 @@
package parser package yaml
import ( import (
"testing" "testing"