Skip to content

Commit

Permalink
fix: scaffolder.Exlucde() now uses regex
Browse files Browse the repository at this point in the history
  • Loading branch information
alecthomas committed Nov 18, 2023
1 parent c616184 commit 36579bc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cmd/ftl/cmd_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import (
"reflect"
"strings"

"github.com/TBD54566975/scaffolder"
"github.com/alecthomas/errors"
"github.com/beevik/etree"
"github.com/iancoleman/strcase"

"github.com/TBD54566975/scaffolder"

"github.com/TBD54566975/ftl/internal"
kotlinruntime "github.com/TBD54566975/ftl/kotlin-runtime"
)
Expand Down Expand Up @@ -62,7 +63,7 @@ func (i initKotlinCmd) Run(parent *initCmd) error {
// Update root POM if it already exists.
pomFile := filepath.Join(i.Dir, "pom.xml")
if _, err := os.Stat(pomFile); err == nil {
options = append(options, scaffolder.Exclude("pom.xml"))
options = append(options, scaffolder.Exclude("^pom.xml$"))
if err := updatePom(pomFile, i.Name); err != nil {
return errors.WithStack(err)
}
Expand Down Expand Up @@ -116,9 +117,9 @@ func unzipToTmpDir(reader *zip.Reader) (string, error) {
}

func scaffold(hermit bool, source string, destination string, ctx any, options ...scaffolder.Option) error {
opts := []scaffolder.Option{scaffolder.Functions(scaffoldFuncs), scaffolder.Exclude("go.mod")}
opts := []scaffolder.Option{scaffolder.Functions(scaffoldFuncs), scaffolder.Exclude("^go.mod$")}
if !hermit {
opts = append(opts, scaffolder.Exclude("bin"))
opts = append(opts, scaffolder.Exclude("^bin"))
}
opts = append(opts, options...)
if err := scaffolder.Scaffold(source, destination, ctx, opts...); err != nil {
Expand Down

0 comments on commit 36579bc

Please sign in to comment.