Skip to content

Commit

Permalink
Merge pull request #258 from mengqiy/release-0.1
Browse files Browse the repository at this point in the history
🐛 use the correct flect library
  • Loading branch information
k8s-ci-robot committed Jul 18, 2019
2 parents 464fbed + 32078f0 commit eb20812
Show file tree
Hide file tree
Showing 68 changed files with 1,348 additions and 5,212 deletions.
38 changes: 5 additions & 33 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pkg/internal/codegen/parse/index.go
Expand Up @@ -21,7 +21,8 @@ import (
"log"
"strings"

"github.com/markbates/inflect"
"github.com/gobuffalo/flect"

"k8s.io/gengo/types"
"sigs.k8s.io/controller-tools/pkg/internal/codegen"
"sigs.k8s.io/controller-tools/pkg/internal/general"
Expand Down Expand Up @@ -71,8 +72,7 @@ func (b *APIs) parseIndex() {

// TODO: revisit the part...
if r.Resource == "" {
rs := inflect.NewDefaultRuleset()
r.Resource = rs.Pluralize(strings.ToLower(r.Kind))
r.Resource = flect.Pluralize(strings.ToLower(r.Kind))
}
rt, err := parseResourceAnnotation(c)
if err != nil {
Expand Down
9 changes: 4 additions & 5 deletions pkg/typescaffold/resource.go
Expand Up @@ -20,7 +20,7 @@ import (
"fmt"
"strings"

"github.com/markbates/inflect"
"github.com/gobuffalo/flect"
)

// Resource contains the information required to scaffold files for a resource.
Expand All @@ -41,13 +41,12 @@ func (r *Resource) Validate() error {
return fmt.Errorf("kind cannot be empty")
}

rs := inflect.NewDefaultRuleset()
if len(r.Resource) == 0 {
r.Resource = rs.Pluralize(strings.ToLower(r.Kind))
r.Resource = flect.Pluralize(strings.ToLower(r.Kind))
}

if r.Kind != inflect.Camelize(r.Kind) {
return fmt.Errorf("Kind must be camelcase (expected %s was %s)", inflect.Camelize(r.Kind), r.Kind)
if r.Kind != flect.Pascalize(r.Kind) {
return fmt.Errorf("kind must be camelcase (expected %s was %s)", flect.Pascalize(r.Kind), r.Kind)
}

return nil
Expand Down
5 changes: 0 additions & 5 deletions vendor/github.com/gobuffalo/envy/.env

This file was deleted.

8 changes: 0 additions & 8 deletions vendor/github.com/gobuffalo/envy/LICENSE.txt

This file was deleted.

46 changes: 0 additions & 46 deletions vendor/github.com/gobuffalo/envy/Makefile

This file was deleted.

93 changes: 0 additions & 93 deletions vendor/github.com/gobuffalo/envy/README.md

This file was deleted.

16 changes: 0 additions & 16 deletions vendor/github.com/gobuffalo/envy/SHOULDERS.md

This file was deleted.

0 comments on commit eb20812

Please sign in to comment.