Skip to content

Commit eb20812

Browse files
authored
Merge pull request #258 from mengqiy/release-0.1
🐛 use the correct flect library
2 parents 464fbed + 32078f0 commit eb20812

68 files changed

Lines changed: 1348 additions & 5212 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Gopkg.lock

Lines changed: 5 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/internal/codegen/parse/index.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ import (
2121
"log"
2222
"strings"
2323

24-
"github.com/markbates/inflect"
24+
"github.com/gobuffalo/flect"
25+
2526
"k8s.io/gengo/types"
2627
"sigs.k8s.io/controller-tools/pkg/internal/codegen"
2728
"sigs.k8s.io/controller-tools/pkg/internal/general"
@@ -71,8 +72,7 @@ func (b *APIs) parseIndex() {
7172

7273
// TODO: revisit the part...
7374
if r.Resource == "" {
74-
rs := inflect.NewDefaultRuleset()
75-
r.Resource = rs.Pluralize(strings.ToLower(r.Kind))
75+
r.Resource = flect.Pluralize(strings.ToLower(r.Kind))
7676
}
7777
rt, err := parseResourceAnnotation(c)
7878
if err != nil {

pkg/typescaffold/resource.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"fmt"
2121
"strings"
2222

23-
"github.com/markbates/inflect"
23+
"github.com/gobuffalo/flect"
2424
)
2525

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

44-
rs := inflect.NewDefaultRuleset()
4544
if len(r.Resource) == 0 {
46-
r.Resource = rs.Pluralize(strings.ToLower(r.Kind))
45+
r.Resource = flect.Pluralize(strings.ToLower(r.Kind))
4746
}
4847

49-
if r.Kind != inflect.Camelize(r.Kind) {
50-
return fmt.Errorf("Kind must be camelcase (expected %s was %s)", inflect.Camelize(r.Kind), r.Kind)
48+
if r.Kind != flect.Pascalize(r.Kind) {
49+
return fmt.Errorf("kind must be camelcase (expected %s was %s)", flect.Pascalize(r.Kind), r.Kind)
5150
}
5251

5352
return nil

vendor/github.com/gobuffalo/envy/.env

Lines changed: 0 additions & 5 deletions
This file was deleted.

vendor/github.com/gobuffalo/envy/LICENSE.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

vendor/github.com/gobuffalo/envy/Makefile

Lines changed: 0 additions & 46 deletions
This file was deleted.

vendor/github.com/gobuffalo/envy/README.md

Lines changed: 0 additions & 93 deletions
This file was deleted.

vendor/github.com/gobuffalo/envy/SHOULDERS.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)