Skip to content

Commit

Permalink
fix directory names and remove patching cli code
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Sep 14, 2020
1 parent 2b7c1a4 commit 3a7e5fa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 24 deletions.
4 changes: 2 additions & 2 deletions starport/services/serve/plugin-stargate.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (p *stargatePlugin) PostInit() error {
if err != nil {
return err
}
path := filepath.Join(home, p.app.nd(), "config/app.toml")
path := filepath.Join(home, fmt.Sprintf(".%s/config/app.toml", p.app.nd()))
config, err := toml.LoadFile(path)
if err != nil {
return err
Expand Down Expand Up @@ -122,5 +122,5 @@ func (p *stargatePlugin) StoragePaths() []string {
}

func (p *stargatePlugin) GenesisPath() string {
return fmt.Sprintf("%s/config/genesis.json", p.app.nd())
return fmt.Sprintf(".%s/config/genesis.json", p.app.nd())
}
22 changes: 0 additions & 22 deletions starport/templates/add/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
func New(opts *Options) (*genny.Generator, error) {
g := genny.New()
g.RunFn(appModify(opts))
g.RunFn(cmdMainModify(opts))
if err := g.Box(packr.New("wasm", "./wasm")); err != nil {
return g, err
}
Expand Down Expand Up @@ -94,24 +93,3 @@ func appModify(opts *Options) genny.RunFn {
return r.File(newFile)
}
}

func cmdMainModify(opts *Options) genny.RunFn {
return func(r *genny.Runner) error {
path := fmt.Sprintf("cmd/%[1]vcli/main.go", opts.AppName)
f, err := r.Disk.Find(path)
if err != nil {
return err
}
template := `%[1]v
wasmrest "github.com/CosmWasm/wasmd/x/wasm/client/rest"`
replacement := fmt.Sprintf(template, placeholder)
content := strings.Replace(f.String(), placeholder, replacement, 1)

template2 := `%[1]v
wasmrest.RegisterRoutes(rs.CliCtx, rs.Mux)`
replacement2 := fmt.Sprintf(template2, placeholder2)
content = strings.Replace(content, placeholder2, replacement2, 1)
newFile := genny.NewFileS(path, content)
return r.File(newFile)
}
}

0 comments on commit 3a7e5fa

Please sign in to comment.