Skip to content

Commit

Permalink
remove name overrides (#344)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgamero authored Jul 24, 2024
1 parent 32bfad4 commit f7c086e
Show file tree
Hide file tree
Showing 14 changed files with 0 additions and 77 deletions.
30 changes: 0 additions & 30 deletions pkg/config/draftconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,10 @@ import (
log "github.com/sirupsen/logrus"
)

// TODO: remove Name Overrides since we don't need them anymore
type DraftConfig struct {
DisplayName string `yaml:"displayName"`
NameOverrides []FileNameOverride `yaml:"nameOverrides"`
Variables []*BuilderVar `yaml:"variables"`
FileNameOverrideMap map[string]string `yaml:"filenameOverrideMap"`

nameOverrideMap map[string]string
}

type FileNameOverride struct {
Path string `yaml:"path"`
Prefix string `yaml:"prefix"`
}

type BuilderVar struct {
Expand Down Expand Up @@ -48,27 +39,6 @@ func (d *DraftConfig) GetVariableExampleValues() map[string][]string {
return variableExampleValues
}

func (d *DraftConfig) initNameOverrideMap() {
d.nameOverrideMap = make(map[string]string)
log.Debug("initializing nameOverrideMap")
for _, builderVar := range d.NameOverrides {
log.Debugf("mapping path: %s, to prefix %s", builderVar.Path, builderVar.Prefix)
d.nameOverrideMap[builderVar.Path] = builderVar.Prefix
}
}

func (d *DraftConfig) GetNameOverride(path string) string {
if d.nameOverrideMap == nil {
d.initNameOverrideMap()
}
prefix, ok := d.nameOverrideMap[path]
if !ok {
return ""
}

return prefix
}

func (d *DraftConfig) GetVariable(name string) (*BuilderVar, error) {
for _, variable := range d.Variables {
if variable.Name == name {
Expand Down
11 changes: 0 additions & 11 deletions pkg/osutil/osutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,3 @@ func replaceTemplateVariables(fileSys fs.FS, srcPath string, draftConfig *config

return []byte(fileString), nil
}

func checkNameOverrides(fileName, srcPath, destPath string, config *config.DraftConfig) string {
if config != nil {
log.Debugf("checking name override for srcPath: %s, destPath: %s", srcPath, destPath)
if prefix := config.GetNameOverride(fileName); prefix != "" {
log.Debugf("overriding file: %s with prefix: %s", destPath, prefix)
fileName = fmt.Sprintf("%s%s", prefix, fileName)
}
}
return fileName
}
3 changes: 0 additions & 3 deletions template/dockerfiles/erlang/draft.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
language: erlang
displayName: Erlang
nameOverrides:
- path: "dockerignore"
prefix: "."
variables:
- name: "PORT"
default:
Expand Down
3 changes: 0 additions & 3 deletions template/dockerfiles/go/draft.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
language: go
displayName: Go
nameOverrides:
- path: "dockerignore"
prefix: "."
variables:
- name: "PORT"
default:
Expand Down
3 changes: 0 additions & 3 deletions template/dockerfiles/gomodule/draft.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
language: gomodule
displayName: Go Module
nameOverrides:
- path: "dockerignore"
prefix: "."
variables:
- name: "PORT"
default:
Expand Down
3 changes: 0 additions & 3 deletions template/dockerfiles/gradle/draft.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
language: gradle
displayName: Gradle
nameOverrides:
- path: "dockerignore"
prefix: "."
variables:
- name: "PORT"
default:
Expand Down
3 changes: 0 additions & 3 deletions template/dockerfiles/gradlew/draft.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
language: gradle
displayName: Gradle
nameOverrides:
- path: "dockerignore"
prefix: "."
variables:
- name: "PORT"
default:
Expand Down
3 changes: 0 additions & 3 deletions template/dockerfiles/java/draft.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
language: java
displayName: Java
nameOverrides:
- path: "dockerignore"
prefix: "."
variables:
- name: "PORT"
default:
Expand Down
3 changes: 0 additions & 3 deletions template/dockerfiles/javascript/draft.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
language: javascript
displayName: JavaScript
nameOverrides:
- path: "dockerignore"
prefix: "."
variables:
- name: "PORT"
default:
Expand Down
3 changes: 0 additions & 3 deletions template/dockerfiles/php/draft.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
language: php
displayName: PHP
nameOverrides:
- path: "dockerignore"
prefix: "."
variables:
- name: "PORT"
default:
Expand Down
3 changes: 0 additions & 3 deletions template/dockerfiles/python/draft.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
language: python
displayName: Python
nameOverrides:
- path: "dockerignore"
prefix: "."
variables:
- name: "PORT"
default:
Expand Down
3 changes: 0 additions & 3 deletions template/dockerfiles/ruby/draft.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
language: ruby
displayName: Ruby
nameOverrides:
- path: "dockerignore"
prefix: "."
variables:
- name: "PORT"
default:
Expand Down
3 changes: 0 additions & 3 deletions template/dockerfiles/rust/draft.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
language: rust
displayName: Rust
nameOverrides:
- path: "dockerignore"
prefix: "."
variables:
- name: "PORT"
default:
Expand Down
3 changes: 0 additions & 3 deletions template/dockerfiles/swift/draft.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
language: swift
displayName: Swift
nameOverrides:
- path: "dockerignore"
prefix: "."
variables:
- name: "PORT"
default:
Expand Down

0 comments on commit f7c086e

Please sign in to comment.