Skip to content

Commit

Permalink
Merge branch 'master' into marcinc-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinc authored Jun 7, 2021
2 parents 7288155 + c298a2c commit be6d4ca
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 23 deletions.
8 changes: 4 additions & 4 deletions pkg/kev/converter/kubernetes/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package kubernetes
import (
"fmt"
"os"
"path"
"path/filepath"
"sort"

"github.com/appvia/kev/pkg/kev/log"
Expand Down Expand Up @@ -73,9 +73,9 @@ func (c *K8s) Render(singleFile bool,
outDirPath := ""
if dir != "" {
// adding env name suffix to the custom directory to differentiate
outDirPath = path.Join(dir, env)
outDirPath = filepath.Join(dir, env)
} else {
outDirPath = path.Join(workDir, MultiFileSubDir, env)
outDirPath = filepath.Join(workDir, MultiFileSubDir, env)
}

// @step create output directory
Expand All @@ -89,7 +89,7 @@ func (c *K8s) Render(singleFile bool,
// @step generate multiple / single file
outFilePath := ""
if singleFile {
outFilePath = path.Join(outDirPath, singleFileDefaultName)
outFilePath = filepath.Join(outDirPath, singleFileDefaultName)
} else {
outFilePath = outDirPath
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/kev/converter/kubernetes/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func PrintList(objects []runtime.Object, opt ConvertOptions, rendered map[string

// if that's a chart it'll spit things out to "templates" subdir
if opt.CreateChart {
finalDirName = path.Join(dirName, "templates")
finalDirName = filepath.Join(dirName, "templates")
}

if err := os.RemoveAll(finalDirName); err != nil {
Expand Down
9 changes: 4 additions & 5 deletions pkg/kev/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package kev

import (
"fmt"
"path"
"path/filepath"

"github.com/appvia/kev/pkg/kev/config"
Expand Down Expand Up @@ -86,7 +85,7 @@ func (r *InitRunner) EnsureFirstInit() error {
defer sg.Done()
s := sg.Add("Ensuring this project has not already been initialised")

manifestPath := path.Join(r.WorkingDir, ManifestFilename)
manifestPath := filepath.Join(r.WorkingDir, ManifestFilename)
if ManifestExistsForPath(manifestPath) {
absWd, _ := filepath.Abs(r.WorkingDir)
err := fmt.Errorf("%s already exists at: %s", ManifestFilename, absWd)
Expand Down Expand Up @@ -197,7 +196,7 @@ func (r *InitRunner) CreateOrUpdateSkaffoldManifest() (*SkaffoldManifest, error)
return nil, err
}

skPath := path.Join(r.WorkingDir, SkaffoldFileName)
skPath := filepath.Join(r.WorkingDir, SkaffoldFileName)
envs := r.manifest.GetEnvironmentsNames()
switch ManifestExistsForPath(skPath) {
case true:
Expand Down Expand Up @@ -229,15 +228,15 @@ func createInitWritableResults(workingDir string, manifest *Manifest, skManifest
var out []WritableResult
out = append(out, WritableResult{
WriterTo: manifest,
FilePath: path.Join(workingDir, ManifestFilename),
FilePath: filepath.Join(workingDir, ManifestFilename),
})

out = append(out, manifest.Environments.toWritableResults()...)

if skManifest != nil {
out = append(out, WritableResult{
WriterTo: skManifest,
FilePath: path.Join(workingDir, SkaffoldFileName),
FilePath: filepath.Join(workingDir, SkaffoldFileName),
})
}
return out
Expand Down
6 changes: 3 additions & 3 deletions pkg/kev/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package kev_test
import (
"bytes"
"io/ioutil"
"path"
"path/filepath"

"github.com/appvia/kev/pkg/kev"
"github.com/appvia/kev/pkg/kev/config"
Expand Down Expand Up @@ -55,12 +55,12 @@ var _ = Describe("InitRunner", func() {
})

It("should contain a manifest file", func() {
filename := path.Join(workingDir, kev.ManifestFilename)
filename := filepath.Join(workingDir, kev.ManifestFilename)
Expect(results).To(ContainElement(kev.WritableResult{WriterTo: manifest, FilePath: filename}))
})

It("should contain an override environment", func() {
filename := path.Join(workingDir, "compose.kev.dev.yml")
filename := filepath.Join(workingDir, "compose.kev.dev.yml")
Expect(results).To(ContainElement(kev.WritableResult{WriterTo: env, FilePath: filename}))
})
})
Expand Down
5 changes: 2 additions & 3 deletions pkg/kev/kev_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"fmt"
"io/ioutil"
"os"
"path"
"path/filepath"
"testing"

Expand All @@ -34,7 +33,7 @@ func TestKev(t *testing.T) {
}

func NewTempWorkingDir(composePath string) (tmpWd string, err error) {
data, err := ioutil.ReadFile(path.Join("testdata", composePath))
data, err := ioutil.ReadFile(filepath.Join("testdata", composePath))
if err != nil {
return "", err
}
Expand All @@ -44,7 +43,7 @@ func NewTempWorkingDir(composePath string) (tmpWd string, err error) {
return "", err
}

wdWithComposePath := path.Join(base, composePath)
wdWithComposePath := filepath.Join(base, composePath)
wd := filepath.Dir(wdWithComposePath)

if err := os.MkdirAll(wd, os.ModePerm); err != nil {
Expand Down
5 changes: 2 additions & 3 deletions pkg/kev/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"io"
"io/ioutil"
"os"
"path"
"path/filepath"
"strings"

Expand All @@ -45,7 +44,7 @@ func NewManifest(sources *Sources) *Manifest {

// LoadManifest returns application manifests.
func LoadManifest(workingDir string) (*Manifest, error) {
data, err := ioutil.ReadFile(path.Join(workingDir, ManifestFilename))
data, err := ioutil.ReadFile(filepath.Join(workingDir, ManifestFilename))
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -144,7 +143,7 @@ func (m *Manifest) MintEnvironments(candidates []string) error {
}

for _, env := range candidates {
envFilename := path.Join(m.getWorkingDir(), fmt.Sprintf(fileNameTemplate, GetManifestName(), env))
envFilename := filepath.Join(m.getWorkingDir(), fmt.Sprintf(fileNameTemplate, GetManifestName(), env))
var step kmd.Step
if env == SandboxEnv {
step = sg.Add(fmt.Sprintf("Creating the %s sandbox env file: %s", SandboxEnv, envFilename))
Expand Down
4 changes: 2 additions & 2 deletions pkg/kev/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package kev

import (
"fmt"
"path"
"path/filepath"

"github.com/appvia/kev/pkg/kev/config"
"github.com/appvia/kev/pkg/kev/converter"
Expand Down Expand Up @@ -78,7 +78,7 @@ func (r *RenderRunner) LoadProject() error {
sg := r.UI.StepGroup()
defer sg.Done()

if !ManifestExistsForPath(path.Join(r.WorkingDir, ManifestFilename)) {
if !ManifestExistsForPath(filepath.Join(r.WorkingDir, ManifestFilename)) {
err := errors.Errorf("Missing project manifest: %s", ManifestFilename)
renderStepError(r.UI, sg.Add(""), renderStepLoad, err)
return err
Expand Down
3 changes: 1 addition & 2 deletions pkg/kev/skaffold.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"io"
"io/ioutil"
"os"
"path"
"path/filepath"
"reflect"
"sort"
Expand Down Expand Up @@ -688,7 +687,7 @@ Once you have skaffold.yaml in your project, make sure that Kev references it by
return "", nil, errors.New("Can't activate Skaffold dev loop. Kev wasn't initialized with --skaffold." + msg)
}

configPath := path.Join(workDir, manifest.Skaffold)
configPath := filepath.Join(workDir, manifest.Skaffold)

if !fileExists(configPath) {
return "", nil, errors.New("Can't find Skaffold config file referenced by Kev manifest. Have you initialized Kev with --skaffold?" + msg)
Expand Down

0 comments on commit be6d4ca

Please sign in to comment.