Skip to content

Commit

Permalink
remove "dep" version of Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
allaVolkov committed May 16, 2019
1 parent 823106c commit 1e8496e
Show file tree
Hide file tree
Showing 16 changed files with 8 additions and 294 deletions.
4 changes: 0 additions & 4 deletions internal/tpl/base_post_dep.go

This file was deleted.

11 changes: 0 additions & 11 deletions internal/tpl/base_post_dep.txt

This file was deleted.

4 changes: 0 additions & 4 deletions internal/tpl/base_pre_default_dep.go

This file was deleted.

14 changes: 0 additions & 14 deletions internal/tpl/base_pre_default_dep.txt

This file was deleted.

4 changes: 0 additions & 4 deletions internal/tpl/base_pre_verbose_dep.go

This file was deleted.

13 changes: 0 additions & 13 deletions internal/tpl/base_pre_verbose_dep.txt

This file was deleted.

4 changes: 0 additions & 4 deletions internal/tpl/make_deployment.go

This file was deleted.

7 changes: 0 additions & 7 deletions internal/tpl/make_deployment.txt

This file was deleted.

4 changes: 0 additions & 4 deletions internal/tpl/make_verbose_dep.go

This file was deleted.

10 changes: 0 additions & 10 deletions internal/tpl/make_verbose_dep.txt

This file was deleted.

24 changes: 6 additions & 18 deletions internal/tpl/makefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,25 +121,13 @@ func mapTpl(templateContent []byte, BasePreContent []byte, BasePostContent []byt
func getTplCfg(mode string, isDep bool) (tplCfg, error) {
tpl := tplCfg{}
if (mode == "verbose") || (mode == "v") {
if isDep {
tpl.tplContent = makeVerboseDep
tpl.preContent = basePreVerboseDep
tpl.postContent = basePostDep
} else {
tpl.tplContent = makeVerbose
tpl.preContent = basePreVerbose
tpl.postContent = basePost
}
tpl.tplContent = makeVerbose
tpl.preContent = basePreVerbose
tpl.postContent = basePost
} else if mode == "" {
if isDep {
tpl.tplContent = makeDeployment
tpl.preContent = basePreDefaultDep
tpl.postContent = basePostDep
} else {
tpl.tplContent = makeDefault
tpl.preContent = basePreDefault
tpl.postContent = basePost
}
tpl.tplContent = makeDefault
tpl.preContent = basePreDefault
tpl.postContent = basePost
} else {
return tplCfg{}, fmt.Errorf(`the "%s" command is not supported`, mode)
}
Expand Down
26 changes: 2 additions & 24 deletions internal/tpl/makefile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ var _ = Describe("Makefile", func() {

var (
tpl = tplCfg{tplContent: makeVerbose, relPath: "", preContent: basePreVerbose, postContent: basePost, depDesc: "dev"}
tplDep = tplCfg{tplContent: makeVerboseDep, relPath: "", preContent: basePreVerboseDep, postContent: basePostDep, depDesc: "dep"}
makeFileName = "MakeFileTest.mta"
wd, _ = os.Getwd()
expectedMakePath = func() string {
Expand All @@ -56,23 +55,10 @@ var _ = Describe("Makefile", func() {
}
return filepath.Join(wd, "testdata", filename)
}()
expectedMakeDepPath = func() string {
var filename string
switch runtime.GOOS {
case "linux":
filename = "ExpectedMakeFileDepLinux"
case "darwin":
filename = "ExpectedMakeFileDepMac"
default:
filename = "ExpectedMakeFileDepWindows"
}
return filepath.Join(wd, "testdata", filename)
}()
makeFileFullPath = func() string {
return filepath.Join(wd, "testdata", makeFileName)
}()
expectedMakeFileContent = getMakeFileContent(expectedMakePath)
expectedMakeFileDepContent = getMakeFileContent(expectedMakeDepPath)
expectedMakeFileContent = getMakeFileContent(expectedMakePath)
)

var _ = Describe("MakeFile Generation", func() {
Expand Down Expand Up @@ -113,18 +99,12 @@ makefile_version: 0.0.0
_, err := createMakeFile(makeFilePath, makeFileName)
Ω(err).Should(HaveOccurred())
})
It("Sanity - Dev", func() {
It("Sanity", func() {
ep := dir.Loc{SourcePath: filepath.Join(wd, "testdata"), TargetPath: filepath.Join(wd, "testdata"), Descriptor: "dev"}
Ω(makeFile(&ep, &ep, makeFileName, &tpl)).Should(Succeed())
Ω(makeFileFullPath).Should(BeAnExistingFile())
Ω(getMakeFileContent(makeFileFullPath)).Should(Equal(expectedMakeFileContent))
})
It("Sanity - Dep", func() {
ep := dir.Loc{SourcePath: filepath.Join(wd, "testdata"), TargetPath: filepath.Join(wd, "testdata"), Descriptor: "dep"}
Ω(makeFile(&ep, &ep, makeFileName, &tplDep)).Should(Succeed())
Ω(makeFileFullPath).Should(BeAnExistingFile())
Ω(getMakeFileContent(makeFileFullPath)).Should(Equal(expectedMakeFileDepContent))
})
It("genMakefile testing with wrong mta yaml file", func() {
ep := dir.Loc{SourcePath: filepath.Join(wd, "testdata"), TargetPath: filepath.Join(wd, "testdata"), MtaFilename: "xxx.yaml"}
Ω(genMakefile(&ep, &ep, &ep, "")).Should(HaveOccurred())
Expand Down Expand Up @@ -157,9 +137,7 @@ makefile_version: 0.0.0
Ω(getTplCfg(mode, isDep)).Should(Equal(tpl))
},
Entry("Default mode Dev", "", tplCfg{tplContent: makeDefault, preContent: basePreDefault, postContent: basePost}, false),
Entry("Default mode Dep", "", tplCfg{tplContent: makeDeployment, preContent: basePreDefaultDep, postContent: basePostDep}, true),
Entry("Verbose mode Dev", "verbose", tplCfg{tplContent: makeVerbose, preContent: basePreVerbose, postContent: basePost}, false),
Entry("Verbose mode Dep", "verbose", tplCfg{tplContent: makeVerboseDep, preContent: basePreVerboseDep, postContent: basePostDep}, true),
)
It("unknown mode", func() {
_, err := getTplCfg("test", false)
Expand Down
49 changes: 0 additions & 49 deletions internal/tpl/testdata/ExpectedMakeFileDepLinux

This file was deleted.

49 changes: 0 additions & 49 deletions internal/tpl/testdata/ExpectedMakeFileDepMac

This file was deleted.

49 changes: 0 additions & 49 deletions internal/tpl/testdata/ExpectedMakeFileDepWindows

This file was deleted.

Loading

0 comments on commit 1e8496e

Please sign in to comment.