Skip to content

Commit

Permalink
Merge branch 'main' into feat/ignite-apps
Browse files Browse the repository at this point in the history
  • Loading branch information
jeronimoalbi committed Oct 4, 2023
2 parents b0a3d76 + 35e7c7a commit 2c2fdca
Show file tree
Hide file tree
Showing 31 changed files with 347 additions and 82 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- [#3653](https://github.com/ignite/cli/pull/3653) Add "app" extension to plugin binaries
- [#3656](https://github.com/ignite/cli/pull/3656) Disable Go toolchain download
- [#3662](https://github.com/ignite/cli/pull/3662) Refactor CLI "plugin" command to "app"
- [#3669](https://github.com/ignite/cli/pull/3669) Rename `plugins` config file to `igniteapps`

### Fixes

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/06-migration/v0.19.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ official Ignite CLI repo which introduces breaking changes.
To migrate your chain that was scaffolded with Ignite CLI versions lower than v0.19.2:

1. IBC upgrade: Use
the [IBC migration documents](https://github.com/cosmos/ibc-go/blob/main/docs/migrations/v1-to-v2.md)
the [IBC migration documents](https://github.com/cosmos/ibc-go/blob/v6.2.0/docs/migrations/v1-to-v2.md)

2. In your chain's `go.mod` file, remove `tendermint/spm` and add the v0.19.2 version of `tendermint/starport`. If your
chain uses these packages, change the import paths as shown:
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/06-migration/v0.26.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ their tooling to the latest version.

Chains that are newly scaffolded with Ignite CLI `v0.26.0` now use `ibc-go/v6` for ibc functionality. It is not
necessary, but recommended to upgrade to the newest version of `ibc-go`. Most migrations can be done by following the
`ibc-go` [migration guide](https://github.com/cosmos/ibc-go/blob/main/docs/migrations/v5-to-v6.md), but there are some
`ibc-go` [migration guide](https://github.com/cosmos/ibc-go/blob/v6.2.0/docs/migrations/v5-to-v6.md), but there are some
specific changes that will need to be followed for Ignite scaffolded chains.

### Removing `cosmosibckeeper`
Expand Down Expand Up @@ -215,7 +215,7 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger {

### Remaining migration

After all uses of `cosmosibckeeper` have been removed, you can follow any remaining steps in the`ibc-go`[migration guide](https://github.com/cosmos/ibc-go/blob/main/docs/migrations/v5-to-v6.md).
After all uses of `cosmosibckeeper` have been removed, you can follow any remaining steps in the`ibc-go`[migration guide](https://github.com/cosmos/ibc-go/blob/v6.2.0/docs/migrations/v5-to-v6.md).

## Scaffolded Release Workflow

Expand Down
17 changes: 17 additions & 0 deletions docs/docs/06-migration/v0.28.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
sidebar_position: 990
title: v0.28.0
description: For chains that were scaffolded with Ignite CLI versions lower than v0.28.0. changes are required to use Ignite CLI v0.28.0.
---

## Upgrading legacy plugins configuration files

Ignite `v0.28.0` changes the plugin system which is now called Ignite Apps. This version includes changes
to the CLI command names and the plugin configuration file.

The plugins configuration file is now called `igniteapps.yml` and the "plugins" section is now called "apps".

The global plugins directory is now `$HOME/.ignite/apps` instead `$HOME/.ignite/plugins`.

Updates can be automatically applied by running `ignite doctor` in your blockchain application directory.
Running the command outside your blockchain application directory will only update the global plugins.
2 changes: 1 addition & 1 deletion docs/docs/apps/01-using-apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ core concepts within apps: `Commands` and `Hooks`. `Commands` extend the CLI's
functionality and `Hooks` extend existing CLI command functionality.

Apps are registered in an Ignite scaffolded blockchain project through the
`plugins.yml`, or globally through `$HOME/.ignite/plugins/plugins.yml`.
`igniteapps.yml`, or globally through `$HOME/.ignite/apps/igniteapps.yml`.

To use an app within your project execute the following command inside the
project directory:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ To ensure you have a successful experience working with our Developer Tutorials

## Setting up Visual Studio Code

1. Install [Visual Studio Code](https://vscode-docs.readthedocs.io/en/latest/editor/setup).
1. Install [Visual Studio Code](https://vscode-docs.readthedocs.io/en/latest/editor/setup/).
1. Click **Extensions** in the sidebar.
1. Install this extension:
- Go for VS Code The official Go extension for Visual Studio Code
Expand Down
2 changes: 1 addition & 1 deletion docs/versioned_docs/version-v0.25.2/migration/v0.19.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ With Ignite CLI v0.19.2, the contents of the deprecated Ignite CLI Modules `tend

To migrate your chain that was scaffolded with Ignite CLI versions lower than v0.19.2:

1. IBC upgrade: Use the [IBC migration documents](https://github.com/cosmos/ibc-go/blob/main/docs/migrations/v1-to-v2.md)
1. IBC upgrade: Use the [IBC migration documents](https://github.com/cosmos/ibc-go/blob/v6.2.0/docs/migrations/v1-to-v2.md)

2. In your chain's `go.mod` file, remove `tendermint/spm` and add the v0.19.2 version of `tendermint/starport`. If your chain uses these packages, change the import paths as shown:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ official Ignite CLI repo which introduces breaking changes.
To migrate your chain that was scaffolded with Ignite CLI versions lower than v0.19.2:

1. IBC upgrade: Use
the [IBC migration documents](https://github.com/cosmos/ibc-go/blob/main/docs/migrations/v1-to-v2.md)
the [IBC migration documents](https://github.com/cosmos/ibc-go/blob/v6.2.0/docs/migrations/v1-to-v2.md)

2. In your chain's `go.mod` file, remove `tendermint/spm` and add the v0.19.2 version of `tendermint/starport`. If your
chain uses these packages, change the import paths as shown:
Expand Down
4 changes: 2 additions & 2 deletions docs/versioned_docs/version-v0.26.1/06-migration/v0.26.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ their tooling to the latest version.

Chains that are newly scaffolded with Ignite CLI `v0.26.0` now use `ibc-go/v6` for ibc functionality. It is not
necessary, but recommended to upgrade to the newest version of `ibc-go`. Most migrations can be done by following the
`ibc-go` [migration guide](https://github.com/cosmos/ibc-go/blob/main/docs/migrations/v5-to-v6.md), but there are some
`ibc-go` [migration guide](https://github.com/cosmos/ibc-go/blob/v6.2.0/docs/migrations/v5-to-v6.md), but there are some
specific changes that will need to be followed for Ignite scaffolded chains.

### Removing `cosmosibckeeper`
Expand Down Expand Up @@ -215,7 +215,7 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger {

### Remaining migration

After all uses of `cosmosibckeeper` have been removed, you can follow any remaining steps in the`ibc-go`[migration guide](https://github.com/cosmos/ibc-go/blob/main/docs/migrations/v5-to-v6.md).
After all uses of `cosmosibckeeper` have been removed, you can follow any remaining steps in the`ibc-go`[migration guide](https://github.com/cosmos/ibc-go/blob/v6.2.0/docs/migrations/v5-to-v6.md).

## Scaffolded Release Workflow

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ official Ignite CLI repo which introduces breaking changes.
To migrate your chain that was scaffolded with Ignite CLI versions lower than v0.19.2:

1. IBC upgrade: Use
the [IBC migration documents](https://github.com/cosmos/ibc-go/blob/main/docs/migrations/v1-to-v2.md)
the [IBC migration documents](https://github.com/cosmos/ibc-go/blob/v6.2.0/docs/migrations/v1-to-v2.md)

2. In your chain's `go.mod` file, remove `tendermint/spm` and add the v0.19.2 version of `tendermint/starport`. If your
chain uses these packages, change the import paths as shown:
Expand Down
4 changes: 2 additions & 2 deletions docs/versioned_docs/version-v0.27.1/06-migration/v0.26.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ their tooling to the latest version.

Chains that are newly scaffolded with Ignite CLI `v0.26.0` now use `ibc-go/v6` for ibc functionality. It is not
necessary, but recommended to upgrade to the newest version of `ibc-go`. Most migrations can be done by following the
`ibc-go` [migration guide](https://github.com/cosmos/ibc-go/blob/main/docs/migrations/v5-to-v6.md), but there are some
`ibc-go` [migration guide](https://github.com/cosmos/ibc-go/blob/v6.2.0/docs/migrations/v5-to-v6.md), but there are some
specific changes that will need to be followed for Ignite scaffolded chains.

### Removing `cosmosibckeeper`
Expand Down Expand Up @@ -215,7 +215,7 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger {

### Remaining migration

After all uses of `cosmosibckeeper` have been removed, you can follow any remaining steps in the`ibc-go`[migration guide](https://github.com/cosmos/ibc-go/blob/main/docs/migrations/v5-to-v6.md).
After all uses of `cosmosibckeeper` have been removed, you can follow any remaining steps in the`ibc-go`[migration guide](https://github.com/cosmos/ibc-go/blob/v6.2.0/docs/migrations/v5-to-v6.md).

## Scaffolded Release Workflow

Expand Down
4 changes: 4 additions & 0 deletions ignite/cmd/doctor.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ func NewDoctor() *cobra.Command {
return err
}

if err := doc.MigratePluginsConfig(); err != nil {
return err
}

return doc.FixDependencyTools(cmd.Context())
},
}
Expand Down
18 changes: 9 additions & 9 deletions ignite/cmd/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ func LoadPlugins(ctx context.Context, cmd *cobra.Command) error {
if err != nil && !errors.As(err, &cosmosanalysis.ErrPathNotChain{}) {
return err
} else if err == nil {
pluginsConfigs = append(pluginsConfigs, localCfg.Plugins...)
pluginsConfigs = append(pluginsConfigs, localCfg.Apps...)
}

globalCfg, err := parseGlobalPlugins()
if err == nil {
pluginsConfigs = append(pluginsConfigs, globalCfg.Plugins...)
pluginsConfigs = append(pluginsConfigs, globalCfg.Apps...)
}
ensureDefaultPlugins(cmd, globalCfg)

Expand Down Expand Up @@ -97,8 +97,8 @@ func parseGlobalPlugins() (cfg *pluginsconfig.Config, err error) {
return &pluginsconfig.Config{}, nil
}

for i := range cfg.Plugins {
cfg.Plugins[i].Global = true
for i := range cfg.Apps {
cfg.Apps[i].Global = true
}
return
}
Expand Down Expand Up @@ -438,7 +438,7 @@ Respects key value pairs declared after the app path to be added to the generate
return err
}

for _, p := range conf.Plugins {
for _, p := range conf.Apps {
if p.Path == args[0] {
return fmt.Errorf("app %s is already installed", args[0])

Check warning on line 443 in ignite/cmd/plugin.go

View check run for this annotation

Codecov / codecov/patch

ignite/cmd/plugin.go#L443

Added line #L443 was not covered by tests
}
Expand Down Expand Up @@ -478,7 +478,7 @@ Respects key value pairs declared after the app path to be added to the generate
return fmt.Errorf("error while loading app %q: %w", args[0], plugins[0].Error)

Check warning on line 478 in ignite/cmd/plugin.go

View check run for this annotation

Codecov / codecov/patch

ignite/cmd/plugin.go#L478

Added line #L478 was not covered by tests
}
session.Println(icons.OK, "Done loading apps")

Check warning on line 480 in ignite/cmd/plugin.go

View check run for this annotation

Codecov / codecov/patch

ignite/cmd/plugin.go#L480

Added line #L480 was not covered by tests
conf.Plugins = append(conf.Plugins, p)
conf.Apps = append(conf.Apps, p)

if err := conf.Save(); err != nil {
return err
Expand Down Expand Up @@ -521,9 +521,9 @@ func NewAppUninstall() *cobra.Command {
}

removed := false
for i, cp := range conf.Plugins {
for i, cp := range conf.Apps {
if cp.Path == args[0] {
conf.Plugins = append(conf.Plugins[:i], conf.Plugins[i+1:]...)
conf.Apps = append(conf.Apps[:i], conf.Apps[i+1:]...)
removed = true
break
}
Expand Down Expand Up @@ -671,7 +671,7 @@ func printPlugins(session *cliui.Session) error {

func flagSetPluginsGlobal() *flag.FlagSet {
fs := flag.NewFlagSet("", flag.ContinueOnError)
fs.BoolP(flagPluginsGlobal, "g", false, "use global plugins configuration ($HOME/.ignite/plugins/plugins.yml)")
fs.BoolP(flagPluginsGlobal, "g", false, "use global plugins configuration ($HOME/.ignite/apps/igniteapps.yml)")
return fs
}

Expand Down
2 changes: 1 addition & 1 deletion ignite/cmd/plugin_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func newPluginInstallCmd(dp defaultPlugin) *cobra.Command {
pluginCfg := pluginsconfig.Plugin{
Path: dp.path,
}
cfg.Plugins = append(cfg.Plugins, pluginCfg)
cfg.Apps = append(cfg.Apps, pluginCfg)
if err := cfg.Save(); err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion ignite/cmd/plugin_default_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestEnsureDefaultPlugins(t *testing.T) {
{
name: "should not add because already present in config",
cfg: &pluginsconfig.Config{
Plugins: []pluginsconfig.Plugin{{
Apps: []pluginsconfig.Plugin{{
Path: "github.com/ignite/cli-plugin-network@v42",
}},
},
Expand Down
2 changes: 1 addition & 1 deletion ignite/config/chain/v1/testdata/config2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ validators:
address: 0.0.0.0:8545
ws-address: 0.0.0.0:8546
home: $HOME/.evmosd
plugins:
apps:
- name: plugin1
path: /path/to/plugin1
- name: plugin2
Expand Down
9 changes: 5 additions & 4 deletions ignite/config/plugins/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ import (
type Config struct {
path string

// Plugins holds the list of installed plugins.
Plugins []Plugin `yaml:"plugins"`
// Apps holds the list of installed Ignite Apps.
// Ignite Apps are implemented as plugins.
Apps []Plugin `yaml:"apps"`
}

// Plugin keeps plugin name and location.
Expand All @@ -43,7 +44,7 @@ type Plugin struct {
With map[string]string `yaml:"with,omitempty"`

// Global holds whether the plugin is installed globally
// (default: $HOME/.ignite/plugins/plugins.yml) or locally for a chain.
// (default: $HOME/.ignite/apps/igniteapps.yml) or locally for a chain.
Global bool `yaml:"-"`
}

Expand Down Expand Up @@ -135,7 +136,7 @@ func (c *Config) Save() error {
// Returns also true if there's a local plugin with the module name equal to
// that path.
func (c Config) HasPlugin(path string) bool {
return slices.ContainsFunc(c.Plugins, func(cp Plugin) bool {
return slices.ContainsFunc(c.Apps, func(cp Plugin) bool {
if cp.HasPath(path) {
return true
}
Expand Down
22 changes: 11 additions & 11 deletions ignite/config/plugins/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,30 +268,30 @@ func TestConfigSave(t *testing.T) {
require.NoError(t, err)
return cfg
},
expectedContent: "plugins: []\n",
expectedContent: "apps: []\n",
},
{
name: "ok: config path is an existing file",
buildConfig: func(t *testing.T) *pluginsconfig.Config {
// copy testdata/plugins.yml to tmp because it will be modified
// copy testdata/igniteapps.yml to tmp because it will be modified
dir := t.TempDir()
bz, err := os.ReadFile("testdata/plugins.yml")
bz, err := os.ReadFile("testdata/igniteapps.yml")
require.NoError(t, err)
err = os.WriteFile(path.Join(dir, "plugins.yml"), bz, 0o666)
err = os.WriteFile(path.Join(dir, "igniteapps.yml"), bz, 0o666)
require.NoError(t, err)
// load from tmp
cfg, _ := pluginsconfig.ParseDir(dir)
// add a new plugin
cfg.Plugins = append(cfg.Plugins, pluginsconfig.Plugin{
cfg.Apps = append(cfg.Apps, pluginsconfig.Plugin{
Path: "/path/to/plugin3",
With: map[string]string{"key": "val"},
})
// update a plugin
cfg.Plugins[1].Path = "/path/to/plugin22"
cfg.Plugins[1].With["key"] = "val"
cfg.Apps[1].Path = "/path/to/plugin22"
cfg.Apps[1].With["key"] = "val"
return cfg
},
expectedContent: `plugins:
expectedContent: `apps:
- path: /path/to/plugin1
- path: /path/to/plugin22
with:
Expand Down Expand Up @@ -338,7 +338,7 @@ func TestConfigHasPlugin(t *testing.T) {
{
name: "not found in config",
cfg: pluginsconfig.Config{
Plugins: []pluginsconfig.Plugin{
Apps: []pluginsconfig.Plugin{
{Path: "github.com/ignite/example2"},
},
},
Expand All @@ -347,7 +347,7 @@ func TestConfigHasPlugin(t *testing.T) {
{
name: "found in config",
cfg: pluginsconfig.Config{
Plugins: []pluginsconfig.Plugin{
Apps: []pluginsconfig.Plugin{
{Path: "github.com/ignite/example2"},
{Path: "github.com/ignite/example@master"},
},
Expand All @@ -357,7 +357,7 @@ func TestConfigHasPlugin(t *testing.T) {
{
name: "found in config but from a local plugin",
cfg: pluginsconfig.Config{
Plugins: []pluginsconfig.Plugin{
Apps: []pluginsconfig.Plugin{
{Path: "github.com/ignite/example2"},
{Path: path.Join(wd, "testdata", "localplugin", "example")},
},
Expand Down
5 changes: 2 additions & 3 deletions ignite/config/plugins/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

// ParseDir expects to find a plugin config file in dir. If dir is not a folder,
// an error is returned.
// The plugin config file format can be `plugins.yml` or `plugins.yaml`. If
// The plugin config file format can be `igniteapps.yml` or `igniteapps.yaml`. If
// found, the file is parsed into a Config and returned. If no file from the
// given names above are found, then an empty config is returned, w/o errors.
func ParseDir(dir string) (*Config, error) {
Expand Down Expand Up @@ -53,8 +53,7 @@ func ParseDir(dir string) (*Config, error) {
}

var (
// filenames is a list of recognized names as Ignite's plugins config file.
filenames = []string{"plugins.yml", "plugins.yaml"}
filenames = []string{"igniteapps.yml", "igniteapps.yaml"}
defaultFilename = filenames[0]
)

Expand Down
12 changes: 6 additions & 6 deletions ignite/config/plugins/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ func TestParseDir(t *testing.T) {
}{
{
name: "fail: path is not a dir",
path: "testdata/plugins.yml",
expectedError: "plugin config parse: path testdata/plugins.yml is not a dir",
path: "testdata/igniteapps.yml",
expectedError: "plugin config parse: path testdata/igniteapps.yml is not a dir",
},
{
name: "fail: path doesn't exists",
Expand All @@ -30,7 +30,7 @@ func TestParseDir(t *testing.T) {
name: "ok: path doesn't contain any config",
path: "testdata/noconfig",
expectedPlugins: nil,
expectedPath: "testdata/noconfig/plugins.yml",
expectedPath: "testdata/noconfig/igniteapps.yml",
},
{
name: "fail: path contains an invalid yml file",
Expand All @@ -52,7 +52,7 @@ func TestParseDir(t *testing.T) {
},
},
},
expectedPath: "testdata/plugins.yml",
expectedPath: "testdata/igniteapps.yml",
},
{
name: "ok: path contains a plugin.yaml file",
Expand All @@ -69,7 +69,7 @@ func TestParseDir(t *testing.T) {
},
},
},
expectedPath: "testdata/other/plugins.yaml",
expectedPath: "testdata/other/igniteapps.yaml",
},
}
for _, tt := range tests {
Expand All @@ -83,7 +83,7 @@ func TestParseDir(t *testing.T) {
return
}
require.NoError(err)
require.Equal(tt.expectedPlugins, cfg.Plugins)
require.Equal(tt.expectedPlugins, cfg.Apps)
require.Equal(tt.expectedPath, cfg.Path())
})
}
Expand Down
Loading

0 comments on commit 2c2fdca

Please sign in to comment.