Skip to content

Commit

Permalink
remove old support methods and move module pkg to module folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Pantani authored and Pantani committed Oct 5, 2023
1 parent 41cb37f commit bddf8e8
Show file tree
Hide file tree
Showing 12 changed files with 1 addition and 166 deletions.
10 changes: 0 additions & 10 deletions ignite/services/scaffolder/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,6 @@ func (s Scaffolder) AddMessage(
return sm, err
}

gens, err = supportSimulation(
gens,
opts.AppPath,
opts.ModulePath,
opts.ModuleName,
)
if err != nil {
return sm, err
}

// Scaffold
g, err = message.NewGenerator(tracer, opts)
if err != nil {
Expand Down
44 changes: 0 additions & 44 deletions ignite/services/scaffolder/patch.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,50 +10,6 @@ import (
modulecreate "github.com/ignite/cli/ignite/templates/module/create"
)

// supportSimulation checks if module_simulation.go exists,
// appends the generator to create the file if it doesn't.
func supportSimulation(
gens []*genny.Generator,
appPath,
modulePath,
moduleName string,
) ([]*genny.Generator, error) {
simulation, err := modulecreate.AddSimulation(
appPath,
modulePath,
moduleName,
)
if err != nil {
return gens, err
}
gens = append(gens, simulation)
return gens, nil
}

// supportGenesisTests checks if types/genesis_test.go exists
// appends the generator to create the file if it doesn't.
func supportGenesisTests(
gens []*genny.Generator,
appPath,
appName,
modulePath,
moduleName string,
isIBC bool,
) ([]*genny.Generator, error) {
genesisTest, err := modulecreate.AddGenesisTest(
appPath,
appName,
modulePath,
moduleName,
isIBC,
)
if err != nil {
return gens, err
}
gens = append(gens, genesisTest)
return gens, nil
}

// supportMsgServer checks if the module supports the MsgServer convention
// appends the generator to support it if it doesn't
// https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-031-msg-service.md
Expand Down
22 changes: 0 additions & 22 deletions ignite/services/scaffolder/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,28 +197,6 @@ func (s Scaffolder) AddType(
return sm, err
}

gens, err = supportGenesisTests(
gens,
opts.AppPath,
opts.AppName,
opts.ModulePath,
opts.ModuleName,
opts.IsIBC,
)
if err != nil {
return sm, err
}

gens, err = supportSimulation(
gens,
opts.AppPath,
opts.ModulePath,
opts.ModuleName,
)
if err != nil {
return sm, err
}

// create the type generator depending on the model
switch {
case o.isList:
Expand Down
16 changes: 1 addition & 15 deletions ignite/templates/module/create/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ func NewGenerator(opts *CreateOptions) (*genny.Generator, error) {
"files/msgserver/",
opts.AppPath,
)
genesisTestTemplate = xgenny.NewEmbedWalker(
fsGenesisTest,
"files/genesistest/",
opts.AppPath,
)
baseTemplate = xgenny.NewEmbedWalker(
fsBase,
"files/base/",
Expand All @@ -41,9 +36,6 @@ func NewGenerator(opts *CreateOptions) (*genny.Generator, error) {
if err := g.Box(msgServerTemplate); err != nil {
return g, err
}
if err := g.Box(genesisTestTemplate); err != nil {
return g, err
}
if err := g.Box(baseTemplate); err != nil {
return g, err
}
Expand All @@ -66,12 +58,6 @@ func NewGenerator(opts *CreateOptions) (*genny.Generator, error) {
g.Transformer(genny.Replace("{{appName}}", opts.AppName))
g.Transformer(genny.Replace("{{moduleName}}", opts.ModuleName))

gSimapp, err := AddSimulation(opts.AppPath, opts.ModulePath, opts.ModuleName, opts.Params...)
if err != nil {
return g, err
}
g.Merge(gSimapp)

return g, nil
}

Expand All @@ -96,7 +82,7 @@ func appConfigModify(replacer placeholder.Replacer, opts *CreateOptions) genny.R

// Import
template := `%[2]vmodulev1 "%[3]v/api/%[4]v/%[2]v/module"
_ "%[3]v/x/%[2]v" // import for side-effects
_ "%[3]v/x/%[2]v/module" // import for side-effects
%[2]vmoduletypes "%[3]v/x/%[2]v/types"
%[1]v`
replacement := fmt.Sprintf(template, module.PlaceholderSgAppModuleImport, opts.ModuleName, opts.ModulePath, opts.AppName)
Expand Down
36 changes: 0 additions & 36 deletions ignite/templates/module/create/genesistest.go

This file was deleted.

33 changes: 0 additions & 33 deletions ignite/templates/module/create/simulation.go

This file was deleted.

6 changes: 0 additions & 6 deletions ignite/templates/module/create/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,4 @@ var (

//go:embed files/msgserver/* files/msgserver/**/*
fsMsgServer embed.FS

//go:embed files/genesistest/* files/genesistest/**/*
fsGenesisTest embed.FS

//go:embed files/simapp/* files/simapp/**/*
fsSimapp embed.FS
)

0 comments on commit bddf8e8

Please sign in to comment.