Skip to content

Commit

Permalink
add mantil general file
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Vlasic committed Sep 17, 2021
1 parent 40d5f09 commit 9dfe924
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
13 changes: 13 additions & 0 deletions internal/mantil/mantil.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package mantil

import (
"fmt"
)

func RuntimeResource(v ...string) string {
r := "mantil"
for _, n := range v {
r = fmt.Sprintf("%s-%s", r, n)
}
return r
}
32 changes: 12 additions & 20 deletions internal/mantil/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,6 @@ func ProjectResource(projectName string, v ...string) string {
return r
}

func RuntimeResource(v ...string) string {
r := "mantil"
for _, n := range v {
r = fmt.Sprintf("%s-%s", r, n)
}
return r
}

func (p *Project) AddFunction(fun Function) {
p.Functions = append(p.Functions, fun)
}
Expand Down Expand Up @@ -156,6 +148,18 @@ func (c *LocalProjectConfig) Save(path string) error {
return nil
}

func LoadLocalConfig(projectRoot string) (*LocalProjectConfig, error) {
buf, err := ioutil.ReadFile(filepath.Join(projectRoot, localConfigPath))
if err != nil {
return nil, err
}
c := &LocalProjectConfig{}
if err := json.Unmarshal(buf, c); err != nil {
return nil, err
}
return c, nil
}

func LoadProject(projectName string) (*Project, error) {
awsClient, err := aws.New()
if err != nil {
Expand Down Expand Up @@ -187,18 +191,6 @@ func SaveProject(p *Project) error {
return nil
}

func LoadLocalConfig(projectRoot string) (*LocalProjectConfig, error) {
buf, err := ioutil.ReadFile(filepath.Join(projectRoot, localConfigPath))
if err != nil {
return nil, err
}
c := &LocalProjectConfig{}
if err := json.Unmarshal(buf, c); err != nil {
return nil, err
}
return c, nil
}

func FindProjectRoot(initialPath string) (string, error) {
currentPath := initialPath
for {
Expand Down

0 comments on commit 9dfe924

Please sign in to comment.