From b5c5f1f52d28bd67083050f42a36f566791022cd Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Wed, 10 Jul 2024 10:12:17 +0200 Subject: [PATCH 1/3] refactor: rename apps to extensions --- changelog.md | 1 + docs/docs/apps/01-using-apps.md | 42 --- docs/docs/apps/02-developing-apps.md | 258 ---------------- docs/docs/extensions/01-using-extensions.md | 42 +++ .../extensions/02-developing-extensions.md | 258 ++++++++++++++++ .../docs/{apps => extensions}/_category_.json | 4 +- .../version-v28/apps/01-using-apps.md | 32 +- .../version-v28/apps/_category_.json | 4 +- ignite/cmd/account.go | 2 +- ignite/cmd/cmd.go | 14 +- ignite/cmd/{plugin.go => extension.go} | 286 +++++++++--------- ...plugin_default.go => extension_default.go} | 42 +-- ...ault_test.go => extension_default_test.go} | 6 +- .../cmd/{plugin_test.go => extension_test.go} | 22 +- ignite/config/chain/v1/testdata/config2.yaml | 2 +- ignite/config/plugins/config.go | 10 +- ignite/config/plugins/config_test.go | 22 +- ignite/config/plugins/parse.go | 4 +- ignite/config/plugins/parse_test.go | 12 +- .../{igniteapps.yml => extensions.yml} | 2 +- .../{igniteapps.yml => extensions.yml} | 0 .../other/{igniteapps.yaml => extensions.yml} | 2 +- ignite/internal/plugin/execute_test.go | 2 +- ignite/internal/tools/gen-cli-docs/main.go | 4 +- ignite/services/doctor/doctor_plugins.go | 90 ++++-- ignite/services/plugin/apps_config.go | 14 - ignite/services/plugin/cache.go | 2 +- ignite/services/plugin/config.go | 14 + ignite/services/plugin/interface.go | 2 +- ignite/services/plugin/plugin.go | 26 +- ignite/services/plugin/plugin_test.go | 28 +- ignite/services/plugin/scaffold.go | 8 +- ignite/services/plugin/scaffold_test.go | 6 +- .../plugin/template/app.ignite.yml.plush | 6 - .../services/plugin/template/cmd/cmd.go.plush | 4 +- .../plugin/template/ext.ignite.yml.plush | 6 + ignite/services/plugin/template/go.mod.plush | 2 +- ..._test.go.plush => extension_test.go.plush} | 12 +- ignite/services/plugin/template/main.go.plush | 16 +- integration/account/cmd_account_test.go | 18 +- integration/app/cmd_app_test.go | 20 +- integration/app/cmd_proto_path_test.go | 2 +- integration/chain/cache_test.go | 8 +- .../cosmosgen/cosmosgen_composables_test.go | 12 +- integration/cosmosgen/cosmosgen_hooks_test.go | 12 +- integration/cosmosgen/cosmosgen_test.go | 12 +- integration/cosmosgen/custom_module_test.go | 4 +- integration/doctor/doctor_test.go | 2 +- integration/env.go | 7 +- .../{plugin => extension}/plugin_test.go | 14 +- .../testdata/example-plugin/go.mod | 0 .../testdata/example-plugin/main.go | 0 integration/ibc/cmd_ibc_test.go | 38 +-- integration/list/cmd_list_test.go | 26 +- integration/map/cmd_map_test.go | 30 +- integration/network/network_test.go | 12 +- integration/network/request_test.go | 6 +- .../other_components/cmd_message_test.go | 18 +- .../other_components/cmd_query_test.go | 20 +- integration/params/cmd_configs_test.go | 8 +- integration/params/cmd_params_test.go | 8 +- integration/readme.md | 4 +- integration/relayer/cmd_relayer_test.go | 24 +- integration/simulation/simapp_test.go | 12 +- integration/single/cmd_singleton_test.go | 16 +- integration/tx/tx_test.go | 2 +- readme.md | 22 +- 67 files changed, 853 insertions(+), 813 deletions(-) delete mode 100644 docs/docs/apps/01-using-apps.md delete mode 100644 docs/docs/apps/02-developing-apps.md create mode 100644 docs/docs/extensions/01-using-extensions.md create mode 100644 docs/docs/extensions/02-developing-extensions.md rename docs/docs/{apps => extensions}/_category_.json (50%) rename ignite/cmd/{plugin.go => extension.go} (58%) rename ignite/cmd/{plugin_default.go => extension_default.go} (60%) rename ignite/cmd/{plugin_default_test.go => extension_default_test.go} (87%) rename ignite/cmd/{plugin_test.go => extension_test.go} (95%) rename ignite/config/plugins/testdata/{igniteapps.yml => extensions.yml} (91%) rename ignite/config/plugins/testdata/invalid/{igniteapps.yml => extensions.yml} (100%) rename ignite/config/plugins/testdata/other/{igniteapps.yaml => extensions.yml} (91%) delete mode 100644 ignite/services/plugin/apps_config.go create mode 100644 ignite/services/plugin/config.go delete mode 100644 ignite/services/plugin/template/app.ignite.yml.plush create mode 100644 ignite/services/plugin/template/ext.ignite.yml.plush rename ignite/services/plugin/template/integration/{app_test.go.plush => extension_test.go.plush} (81%) rename integration/{plugin => extension}/plugin_test.go (78%) rename integration/{plugin => extension}/testdata/example-plugin/go.mod (100%) rename integration/{plugin => extension}/testdata/example-plugin/main.go (100%) diff --git a/changelog.md b/changelog.md index 8c87a09713..8253ea9609 100644 --- a/changelog.md +++ b/changelog.md @@ -46,6 +46,7 @@ - [#4194](https://github.com/ignite/cli/pull/4194) Bump client/v2 to `v2.0.0-beta.2` - [#4189](https://github.com/ignite/cli/pull/4189) Deprecate `ignite node` for `ignite connect` app - [#4210](https://github.com/ignite/cli/pull/4210) Improve default home wiring +- [#4238](https://github.com/ignite/cli/pull/4238) Rename Ignite Apps to Ignite Extensions ### Fixes diff --git a/docs/docs/apps/01-using-apps.md b/docs/docs/apps/01-using-apps.md deleted file mode 100644 index 459d6c7ea3..0000000000 --- a/docs/docs/apps/01-using-apps.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -description: Using and Developing Ignite Apps ---- - -# Using Ignite Apps - -Apps offer a way to extend the functionality of the Ignite CLI. There are two -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 -`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: - -```sh -ignite app install github.com/project/cli-app -``` - -The app will be available only when running `ignite` inside the project -directory. - -To use an app globally on the other hand, execute the following command: - -```sh -ignite app install -g github.com/project/cli-app -``` - -The command will compile the app and make it immediately available to the -`ignite` command lists. - -## Listing installed apps - -When in an ignite scaffolded blockchain you can use the command `ignite app -list` to list all Ignite Apps and there statuses. - -## Updating apps - -When an app in a remote repository releases updates, running `ignite app -update ` will update an specific app declared in your -project's `config.yml`. diff --git a/docs/docs/apps/02-developing-apps.md b/docs/docs/apps/02-developing-apps.md deleted file mode 100644 index 935eddaaf8..0000000000 --- a/docs/docs/apps/02-developing-apps.md +++ /dev/null @@ -1,258 +0,0 @@ ---- -description: Using and Developing Ignite Apps ---- - -# Developing Ignite Apps - -It's easy to create an app and use it immediately in your project. First -choose a directory outside your project and run: - -```sh -$ ignite app scaffold my-app -``` - -This will create a new directory `my-app` that contains the app's code -and will output some instructions about how to use your app with the -`ignite` command. An app path can be a local directory which has several -benefits: - -- You don't need to use a Git repository during the development of your app. -- The app is recompiled each time you run the `ignite` binary in your - project if the source files are older than the app binary. - -Thus, app development workflow is as simple as: - -1. Scaffold an app with `ignite app scaffold my-app` -2. Add it to your config via `ignite app install -g /path/to/my-app` -3. Update app code -4. Run `ignite my-app` binary to compile and run the app -5. Go back to 3 - -Once your app is ready you can publish it to a Git repository and the -community can use it by calling `ignite app install github.com/foo/my-app`. - -Now let's detail how to update your app's code. - -## App interface - -Under the hood Ignite Apps are implemented using a plugin system based on -`github.com/hashicorp/go-plugin`. - -All apps must implement a predefined interface: - -```go title=ignite/services/plugin/interface.go -type Interface interface { - // Manifest declares app's Command(s) and Hook(s). - Manifest(context.Context) (*Manifest, error) - - // Execute will be invoked by ignite when an app Command is executed. - // It is global for all commands declared in Manifest, if you have declared - // multiple commands, use cmd.Path to distinguish them. - // The ClientAPI argument can be used by plugins to get chain app analysis info. - Execute(context.Context, *ExecutedCommand, ClientAPI) error - - // ExecuteHookPre is invoked by ignite when a command specified by the Hook - // path is invoked. - // It is global for all hooks declared in Manifest, if you have declared - // multiple hooks, use hook.Name to distinguish them. - // The ClientAPI argument can be used by plugins to get chain app analysis info. - ExecuteHookPre(context.Context, *ExecutedHook, ClientAPI) error - - // ExecuteHookPost is invoked by ignite when a command specified by the hook - // path is invoked. - // It is global for all hooks declared in Manifest, if you have declared - // multiple hooks, use hook.Name to distinguish them. - // The ClientAPI argument can be used by plugins to get chain app analysis info. - ExecuteHookPost(context.Context, *ExecutedHook, ClientAPI) error - - // ExecuteHookCleanUp is invoked by ignite when a command specified by the - // hook path is invoked. Unlike ExecuteHookPost, it is invoked regardless of - // execution status of the command and hooks. - // It is global for all hooks declared in Manifest, if you have declared - // multiple hooks, use hook.Name to distinguish them. - // The ClientAPI argument can be used by plugins to get chain app analysis info. - ExecuteHookCleanUp(context.Context, *ExecutedHook, ClientAPI) error -} -``` - -The scaffolded code already implements this interface, you just need to update -the method's body. - -## Defining app's manifest - -Here is the `Manifest` proto message definition: - -```protobuf title=proto/ignite/services/plugin/grpc/v1/types.proto -message Manifest { - // App name. - string name = 1; - - // Commands contains the commands that will be added to the list of ignite commands. - // Each commands are independent, for nested commands use the inner Commands field. - bool shared_host = 2; - - // Hooks contains the hooks that will be attached to the existing ignite commands. - repeated Command commands = 3; - - // Enables sharing a single app server across all running instances of an Ignite App. - // Useful if an app adds or extends long running commands. - // - // Example: if an app defines a hook on `ignite chain serve`, a server is instantiated - // when the command is run. Now if you want to interact with that instance - // from commands defined in that app, you need to enable shared host, or else the - // commands will just instantiate separate app servers. - // - // When enabled, all apps of the same path loaded from the same configuration will - // attach it's RPC client to a an existing RPC server. - // - // If an app instance has no other running app servers, it will create one and it - // will be the host. - repeated Hook hooks = 4; -} -``` - -In your app's code the `Manifest` method already returns a predefined -`Manifest` struct as an example. You must adapt it according to your need. - -If your app adds one or more new commands to `ignite`, add them to the -`Commands` field. - -If your app adds features to existing commands, add them to the `Hooks` field. - -Of course an app can declare both, `Commands` *and* `Hooks`. - -An app may also share a host process by setting `SharedHost` to `true`. -`SharedHost` is desirable if an app hooks into, or declares long running commands. -Commands executed from the same app context interact with the same app server. -Allowing all executing commands to share the same server instance, giving shared execution context. - -## Adding new commands - -App commands are custom commands added to Ignite CLI by an installed app. -Commands can use any path not defined already by the CLI. - -For instance, let's say your app adds a new `oracle` command to `ignite -scaffold`, then the `Manifest` method will look like : - -```go -func (app) Manifest(context.Context) (*plugin.Manifest, error) { - return &plugin.Manifest{ - Name: "oracle", - Commands: []*plugin.Command{ - { - Use: "oracle [name]", - Short: "Scaffold an oracle module", - Long: "Long description goes here...", - // Optional flags is required - Flags: []*plugin.Flag{ - {Name: "source", Type: plugin.FlagTypeString, Usage: "the oracle source"}, - }, - // Attach the command to `scaffold` - PlaceCommandUnder: "ignite scaffold", - }, - }, - }, nil -} -``` - -To update the app execution, you have to change the `Execute` command. For -example: - -```go -func (app) Execute(_ context.Context, cmd *plugin.ExecutedCommand, _ plugin.ClientAPI) error { - if len(cmd.Args) == 0 { - return fmt.Errorf("oracle name missing") - } - - flags, err := cmd.NewFlags() - if err != nil { - return err - } - - var ( - name = cmd.Args[0] - source, _ = flags.GetString("source") - ) - - // Read chain information - c, err := getChain(cmd) - if err != nil { - return err - } - - //... -} -``` - -Then, run `ignite scaffold oracle` to execute the app. - -## Adding hooks - -App `Hooks` allow existing CLI commands to be extended with new -functionality. Hooks are useful when you want to streamline functionality -without needing to run custom scripts after or before a command has been run. -This can streamline processes that where once error prone or forgotten all -together. - -The following are hooks defined which will run on a registered `ignite` -command: - -| Name | Description | -| -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -| Pre | Runs before a commands main functionality is invoked in the `PreRun` scope | -| Post | Runs after a commands main functionality is invoked in the `PostRun` scope | -| Clean Up | Runs after a commands main functionality is invoked. If the command returns an error it will run before the error is returned to guarantee execution. | - -*Note*: If a hook causes an error in the pre step the command will not run -resulting in `post` and `clean up` not executing. - -The following is an example of a `hook` definition. - -```go -func (app) Manifest(context.Context) (*plugin.Manifest, error) { - return &plugin.Manifest{ - Name: "oracle", - Hooks: []*plugin.Hook{ - { - Name: "my-hook", - PlaceHookOn: "ignite chain build", - }, - }, - }, nil -} - -func (app) ExecuteHookPre(_ context.Context, h *plugin.ExecutedHook, _ plugin.ClientAPI) error { - switch h.Hook.GetName() { - case "my-hook": - fmt.Println("I'm executed before ignite chain build") - default: - return fmt.Errorf("hook not defined") - } - return nil -} - -func (app) ExecuteHookPost(_ context.Context, h *plugin.ExecutedHook, _ plugin.ClientAPI) error { - switch h.Hook.GetName() { - case "my-hook": - fmt.Println("I'm executed after ignite chain build (if no error)") - default: - return fmt.Errorf("hook not defined") - } - return nil -} - -func (app) ExecuteHookCleanUp(_ context.Context, h *plugin.ExecutedHook, _ plugin.ClientAPI) error { - switch h.Hook.GetName() { - case "my-hook": - fmt.Println("I'm executed after ignite chain build (regardless errors)") - default: - return fmt.Errorf("hook not defined") - } - return nil -} -``` - -Above we can see a similar definition to `Command` where a hook has a `Name` -and a `PlaceHookOn`. You'll notice that the `Execute*` methods map directly to -each life cycle of the hook. All hooks defined within the app will invoke these -methods. diff --git a/docs/docs/extensions/01-using-extensions.md b/docs/docs/extensions/01-using-extensions.md new file mode 100644 index 0000000000..8f0456b69a --- /dev/null +++ b/docs/docs/extensions/01-using-extensions.md @@ -0,0 +1,42 @@ +--- +description: Using and Developing Ignite Extensions +--- + +# Using Ignite Extensions + +Extensions offer a way to extend the functionality of the Ignite CLI. There are two +core concepts within extensions: `Commands` and `Hooks`. `Commands` extend the CLI's +functionality and `Hooks` extend existing CLI command functionality. + +Extensions are registered in an Ignite scaffolded blockchain project through the +`extensions.yml`, or globally through `$HOME/.ignite/extensions/extensions.yml`. + +To use an extension within your project execute the following command inside the +project directory: + +```sh +ignite ext install github.com/project/cli-extension +``` + +The extension will be available only when running `ignite` inside the project +directory. + +To use an extension globally on the other hand, execute the following command: + +```sh +ignite ext install -g github.com/project/cli-extension +``` + +The command will compile the extension and make it immediately available to the +`ignite` command lists. + +## Listing installed Extensions + +When in an ignite scaffolded blockchain you can use the command `ignite extension +list` to list all Ignite Extensions and there statuses. + +## Updating Extensions + +When an extension in a remote repository releases updates, running `ignite extension +update ` will update an specific extension declared in your +project's `config.yml`. diff --git a/docs/docs/extensions/02-developing-extensions.md b/docs/docs/extensions/02-developing-extensions.md new file mode 100644 index 0000000000..5d73db6064 --- /dev/null +++ b/docs/docs/extensions/02-developing-extensions.md @@ -0,0 +1,258 @@ +--- +description: Using and Developing Ignite Extensions +--- + +# Developing Ignite Extensions + +It's easy to create an extension and use it immediately in your project. First +choose a directory outside your project and run: + +```sh +ignite extension scaffold my-extension +``` + +This will create a new directory `my-extension` that contains the extension's code +and will output some instructions about how to use your extension with the +`ignite` command. An extension path can be a local directory which has several +benefits: + +- You don't need to use a Git repository during the development of your extension. +- The extension is recompiled each time you run the `ignite` binary in your + project if the source files are older than the extension binary. + +Thus, extension development workflow is as simple as: + +1. Scaffold an extension with `ignite extension scaffold my-extension` +2. Add it to your config via `ignite extension install -g /path/to/my-extension` +3. Update extension code +4. Run `ignite my-extension` binary to compile and run the extension +5. Go back to 3 + +Once your extension is ready you can publish it to a Git repository and the +community can use it by calling `ignite extension install github.com/foo/my-extension`. + +Now let's detail how to update your extension's code. + +## extension interface + +Under the hood Ignite Extensions are implemented using a plugin system based on +`github.com/hashicorp/go-plugin`. + +All extensions must implement a predefined interface: + +```go title=ignite/services/plugin/interface.go +type Interface interface { + // Manifest declares extension's Command(s) and Hook(s). + Manifest(context.Context) (*Manifest, error) + + // Execute will be invoked by ignite when an extension Command is executed. + // It is global for all commands declared in Manifest, if you have declared + // multiple commands, use cmd.Path to distinguish them. + // The ClientAPI argument can be used by plugins to get chain extension analysis info. + Execute(context.Context, *ExecutedCommand, ClientAPI) error + + // ExecuteHookPre is invoked by ignite when a command specified by the Hook + // path is invoked. + // It is global for all hooks declared in Manifest, if you have declared + // multiple hooks, use hook.Name to distinguish them. + // The ClientAPI argument can be used by plugins to get chain extension analysis info. + ExecuteHookPre(context.Context, *ExecutedHook, ClientAPI) error + + // ExecuteHookPost is invoked by ignite when a command specified by the hook + // path is invoked. + // It is global for all hooks declared in Manifest, if you have declared + // multiple hooks, use hook.Name to distinguish them. + // The ClientAPI argument can be used by plugins to get chain extension analysis info. + ExecuteHookPost(context.Context, *ExecutedHook, ClientAPI) error + + // ExecuteHookCleanUp is invoked by ignite when a command specified by the + // hook path is invoked. Unlike ExecuteHookPost, it is invoked regardless of + // execution status of the command and hooks. + // It is global for all hooks declared in Manifest, if you have declared + // multiple hooks, use hook.Name to distinguish them. + // The ClientAPI argument can be used by plugins to get chain extension analysis info. + ExecuteHookCleanUp(context.Context, *ExecutedHook, ClientAPI) error +} +``` + +The scaffolded code already implements this interface, you just need to update +the method's body. + +## Defining extension's manifest + +Here is the `Manifest` proto message definition: + +```protobuf title=proto/ignite/services/plugin/grpc/v1/types.proto +message Manifest { + // extension name. + string name = 1; + + // Commands contains the commands that will be added to the list of ignite commands. + // Each commands are independent, for nested commands use the inner Commands field. + bool shared_host = 2; + + // Hooks contains the hooks that will be attached to the existing ignite commands. + repeated Command commands = 3; + + // Enables sharing a single extension server across all running instances of an Ignite Extension. + // Useful if an extension adds or extends long running commands. + // + // Example: if an extension defines a hook on `ignite chain serve`, a server is instantiated + // when the command is run. Now if you want to interact with that instance + // from commands defined in that extension, you need to enable shared host, or else the + // commands will just instantiate separate extension servers. + // + // When enabled, all extensions of the same path loaded from the same configuration will + // attach it's RPC client to a an existing RPC server. + // + // If an extension instance has no other running extension servers, it will create one and it + // will be the host. + repeated Hook hooks = 4; +} +``` + +In your extension's code the `Manifest` method already returns a predefined +`Manifest` struct as an example. You must adapt it according to your need. + +If your extension adds one or more new commands to `ignite`, add them to the +`Commands` field. + +If your extension adds features to existing commands, add them to the `Hooks` field. + +Of course an extension can declare both, `Commands` *and* `Hooks`. + +An extension may also share a host process by setting `SharedHost` to `true`. +`SharedHost` is desirable if an extension hooks into, or declares long running commands. +Commands executed from the same extension context interact with the same extension server. +Allowing all executing commands to share the same server instance, giving shared execution context. + +## Adding new commands + +extension commands are custom commands added to Ignite CLI by an installed extension. +Commands can use any path not defined already by the CLI. + +For instance, let's say your extension adds a new `oracle` command to `ignite +scaffold`, then the `Manifest` method will look like : + +```go +func (extension) Manifest(context.Context) (*plugin.Manifest, error) { + return &plugin.Manifest{ + Name: "oracle", + Commands: []*plugin.Command{ + { + Use: "oracle [name]", + Short: "Scaffold an oracle module", + Long: "Long description goes here...", + // Optional flags is required + Flags: []*plugin.Flag{ + {Name: "source", Type: plugin.FlagTypeString, Usage: "the oracle source"}, + }, + // Attach the command to `scaffold` + PlaceCommandUnder: "ignite scaffold", + }, + }, + }, nil +} +``` + +To update the extension execution, you have to change the `Execute` command. For +example: + +```go +func (extension) Execute(_ context.Context, cmd *plugin.ExecutedCommand, _ plugin.ClientAPI) error { + if len(cmd.Args) == 0 { + return fmt.Errorf("oracle name missing") + } + + flags, err := cmd.NewFlags() + if err != nil { + return err + } + + var ( + name = cmd.Args[0] + source, _ = flags.GetString("source") + ) + + // Read chain information + c, err := getChain(cmd) + if err != nil { + return err + } + + //... +} +``` + +Then, run `ignite scaffold oracle` to execute the extension. + +## Adding hooks + +extension `Hooks` allow existing CLI commands to be extended with new +functionality. Hooks are useful when you want to streamline functionality +without needing to run custom scripts after or before a command has been run. +This can streamline processes that where once error prone or forgotten all +together. + +The following are hooks defined which will run on a registered `ignite` +command: + +| Name | Description | +| -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| Pre | Runs before a commands main functionality is invoked in the `PreRun` scope | +| Post | Runs after a commands main functionality is invoked in the `PostRun` scope | +| Clean Up | Runs after a commands main functionality is invoked. If the command returns an error it will run before the error is returned to guarantee execution. | + +*Note*: If a hook causes an error in the pre step the command will not run +resulting in `post` and `clean up` not executing. + +The following is an example of a `hook` definition. + +```go +func (extension) Manifest(context.Context) (*plugin.Manifest, error) { + return &plugin.Manifest{ + Name: "oracle", + Hooks: []*plugin.Hook{ + { + Name: "my-hook", + PlaceHookOn: "ignite chain build", + }, + }, + }, nil +} + +func (extension) ExecuteHookPre(_ context.Context, h *plugin.ExecutedHook, _ plugin.ClientAPI) error { + switch h.Hook.GetName() { + case "my-hook": + fmt.Println("I'm executed before ignite chain build") + default: + return fmt.Errorf("hook not defined") + } + return nil +} + +func (extension) ExecuteHookPost(_ context.Context, h *plugin.ExecutedHook, _ plugin.ClientAPI) error { + switch h.Hook.GetName() { + case "my-hook": + fmt.Println("I'm executed after ignite chain build (if no error)") + default: + return fmt.Errorf("hook not defined") + } + return nil +} + +func (extension) ExecuteHookCleanUp(_ context.Context, h *plugin.ExecutedHook, _ plugin.ClientAPI) error { + switch h.Hook.GetName() { + case "my-hook": + fmt.Println("I'm executed after ignite chain build (regardless errors)") + default: + return fmt.Errorf("hook not defined") + } + return nil +} +``` + +Above we can see a similar definition to `Command` where a hook has a `Name` +and a `PlaceHookOn`. You'll notice that the `Execute*` methods map directly to +each life cycle of the hook. All hooks defined within the extension will invoke these +methods. diff --git a/docs/docs/apps/_category_.json b/docs/docs/extensions/_category_.json similarity index 50% rename from docs/docs/apps/_category_.json rename to docs/docs/extensions/_category_.json index 5ce59790e7..b4afe43084 100644 --- a/docs/docs/apps/_category_.json +++ b/docs/docs/extensions/_category_.json @@ -1,5 +1,5 @@ { - "label": "Ignite Apps", + "label": "Ignite Extensions", "position": 7, "link": null -} +} \ No newline at end of file diff --git a/docs/versioned_docs/version-v28/apps/01-using-apps.md b/docs/versioned_docs/version-v28/apps/01-using-apps.md index 459d6c7ea3..06a1c01c5e 100644 --- a/docs/versioned_docs/version-v28/apps/01-using-apps.md +++ b/docs/versioned_docs/version-v28/apps/01-using-apps.md @@ -1,42 +1,42 @@ --- -description: Using and Developing Ignite Apps +description: Using and Developing Ignite Extensions --- -# Using Ignite Apps +# Using Ignite Extensions -Apps offer a way to extend the functionality of the Ignite CLI. There are two -core concepts within apps: `Commands` and `Hooks`. `Commands` extend the CLI's +Extensions offer a way to extend the functionality of the Ignite CLI. There are two +core concepts within extensions: `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 -`igniteapps.yml`, or globally through `$HOME/.ignite/apps/igniteapps.yml`. +Extensions are registered in an Ignite scaffolded blockchain project through the +`extensions.yml`, or globally through `$HOME/.ignite/extensions/extensions.yml`. -To use an app within your project execute the following command inside the +To use an extension within your project execute the following command inside the project directory: ```sh -ignite app install github.com/project/cli-app +ignite extension install github.com/project/cli-app ``` -The app will be available only when running `ignite` inside the project +The extension will be available only when running `ignite` inside the project directory. -To use an app globally on the other hand, execute the following command: +To use an extension globally on the other hand, execute the following command: ```sh -ignite app install -g github.com/project/cli-app +ignite extension install -g github.com/project/cli-app ``` -The command will compile the app and make it immediately available to the +The command will compile the extension and make it immediately available to the `ignite` command lists. ## Listing installed apps -When in an ignite scaffolded blockchain you can use the command `ignite app -list` to list all Ignite Apps and there statuses. +When in an ignite scaffolded blockchain you can use the command `ignite extension +list` to list all Ignite Extensions and there statuses. ## Updating apps -When an app in a remote repository releases updates, running `ignite app -update ` will update an specific app declared in your +When an extension a remote repository releases updates, running `ignite extension +update ` will update an specific extension declared in your project's `config.yml`. diff --git a/docs/versioned_docs/version-v28/apps/_category_.json b/docs/versioned_docs/version-v28/apps/_category_.json index 5ce59790e7..b4afe43084 100644 --- a/docs/versioned_docs/version-v28/apps/_category_.json +++ b/docs/versioned_docs/version-v28/apps/_category_.json @@ -1,5 +1,5 @@ { - "label": "Ignite Apps", + "label": "Ignite Extensions", "position": 7, "link": null -} +} \ No newline at end of file diff --git a/ignite/cmd/account.go b/ignite/cmd/account.go index a8598ed7e4..6dfe10437b 100644 --- a/ignite/cmd/account.go +++ b/ignite/cmd/account.go @@ -25,7 +25,7 @@ func NewAccount() *cobra.Command { Short: "Create, delete, and show Ignite accounts", Long: `Commands for managing Ignite accounts. An Ignite account is a private/public keypair stored in a keyring. Currently Ignite accounts are used when interacting -with Ignite Apps (namely ignite relayer, ignite network and ignite connect). +with Ignite Extensions (namely ignite relayer, ignite network and ignite connect). Note: Ignite account commands are not for managing your chain's keys and accounts. Use you chain's binary to manage accounts from "config.yml". For example, if your diff --git a/ignite/cmd/cmd.go b/ignite/cmd/cmd.go index 73d1b76cd9..abe18d8a2b 100644 --- a/ignite/cmd/cmd.go +++ b/ignite/cmd/cmd.go @@ -46,12 +46,12 @@ const ( statusQuerying = "Querying..." ) -// List of CLI level one commands that should not load Ignite app instances. -var skipAppsLoadCommands = []string{"version", "help", "docs", "completion", cobra.ShellCompRequestCmd, cobra.ShellCompNoDescRequestCmd} +// List of CLI level one commands that should not load Ignite extension instances. +var skipExtensionLoadCommands = []string{"version", "help", "docs", "completion", cobra.ShellCompRequestCmd, cobra.ShellCompNoDescRequestCmd} // New creates a new root command for `Ignite CLI` with its sub commands. // Returns the cobra.Command, a cleanup function and an error. The cleanup -// function must be invoked by the caller to clean eventual Ignite App instances. +// function must be invoked by the caller to clean eventual Ignite Extension instances. func New(ctx context.Context) (*cobra.Command, func(), error) { cobra.EnableCommandSorting = false @@ -87,15 +87,15 @@ To get started, create a blockchain: NewAccount(), NewDocs(), NewVersion(), - NewApp(), + NewExtension(), NewDoctor(), NewCompletionCmd(), ) c.AddCommand(deprecated()...) c.SetContext(ctx) - // Don't load Ignite apps for level one commands that doesn't allow them - if len(os.Args) >= 2 && slices.Contains(skipAppsLoadCommands, os.Args[1]) { + // Don't load Ignite extensions for level one commands that doesn't allow them + if len(os.Args) >= 2 && slices.Contains(skipExtensionLoadCommands, os.Args[1]) { return c, func() {}, nil } @@ -235,7 +235,7 @@ func deprecated() []*cobra.Command { }, { Use: "node", - Deprecated: "use ignite connect app instead (ignite app install -g github.com/ignite/apps/connect).", + Deprecated: "use ignite connect app instead (ignite extension install -g github.com/ignite/extensions/connect).", }, } } diff --git a/ignite/cmd/plugin.go b/ignite/cmd/extension.go similarity index 58% rename from ignite/cmd/plugin.go rename to ignite/cmd/extension.go index a0e4fbecf0..4636b9e781 100644 --- a/ignite/cmd/plugin.go +++ b/ignite/cmd/extension.go @@ -23,59 +23,59 @@ import ( ) const ( - flagPluginsGlobal = "global" + flagExtensionsGlobal = "global" ) -// plugins hold the list of plugin declared in the config. -// A global variable is used so the list is accessible to the plugin commands. -var plugins []*plugin.Plugin +// extensions hold the list of extensions declared in the config. +// A global variable is used so the list is accessible to the extension commands. +var extensions []*plugin.Plugin -// LoadPlugins tries to load all the plugins found in configurations. +// LoadExtensions tries to load all the extensions found in configurations. // If no configurations found, it returns w/o error. -func LoadPlugins(ctx context.Context, cmd *cobra.Command, session *cliui.Session) error { +func LoadExtensions(ctx context.Context, cmd *cobra.Command, session *cliui.Session) error { var ( - rootCmd = cmd.Root() - pluginsConfigs []pluginsconfig.Plugin + rootCmd = cmd.Root() + extensionsConfigs []pluginsconfig.Plugin ) - localCfg, err := parseLocalPlugins(rootCmd) + localCfg, err := parseLocalExtensions(rootCmd) if err != nil && !errors.As(err, &cosmosanalysis.ErrPathNotChain{}) { return err } else if err == nil { - pluginsConfigs = append(pluginsConfigs, localCfg.Apps...) + extensionsConfigs = append(extensionsConfigs, localCfg.Extensions...) } - globalCfg, err := parseGlobalPlugins() + globalCfg, err := parseGlobalExtensions() if err == nil { - pluginsConfigs = append(pluginsConfigs, globalCfg.Apps...) + extensionsConfigs = append(extensionsConfigs, globalCfg.Extensions...) } - ensureDefaultPlugins(cmd, globalCfg) + ensureDefaultExtensions(cmd, globalCfg) - if len(pluginsConfigs) == 0 { + if len(extensionsConfigs) == 0 { return nil } - uniquePlugins := pluginsconfig.RemoveDuplicates(pluginsConfigs) - plugins, err = plugin.Load(ctx, uniquePlugins, plugin.CollectEvents(session.EventBus())) + uniqueExtensions := pluginsconfig.RemoveDuplicates(extensionsConfigs) + extensions, err = plugin.Load(ctx, uniqueExtensions, plugin.CollectEvents(session.EventBus())) if err != nil { return err } - if len(plugins) == 0 { + if len(extensions) == 0 { return nil } - return linkPlugins(ctx, rootCmd, plugins) + return linkExtensions(ctx, rootCmd, extensions) } -func parseLocalPlugins(cmd *cobra.Command) (*pluginsconfig.Config, error) { +func parseLocalExtensions(cmd *cobra.Command) (*pluginsconfig.Config, error) { // FIXME(tb): like other commands that works on a chain directory, - // parseLocalPlugins should rely on `-p` flag to guess that chain directory. - // Unfortunately parseLocalPlugins is invoked before flags are parsed, so + // parseLocalExtensions should rely on `-p` flag to guess that chain directory. + // Unfortunately parseLocalExtensions is invoked before flags are parsed, so // we cannot rely on `-p` flag. As a workaround, we use the working dir. // The drawback is we cannot load chain's plugin when using `-p`. _ = cmd wd, err := os.Getwd() if err != nil { - return nil, errors.Errorf("parse local apps: %w", err) + return nil, errors.Errorf("parse local extensions: %w", err) } if err := cosmosanalysis.IsChainPath(wd); err != nil { return nil, err @@ -83,7 +83,7 @@ func parseLocalPlugins(cmd *cobra.Command) (*pluginsconfig.Config, error) { return pluginsconfig.ParseDir(wd) } -func parseGlobalPlugins() (cfg *pluginsconfig.Config, err error) { +func parseGlobalExtensions() (cfg *pluginsconfig.Config, err error) { globalDir, err := plugin.PluginsPath() if err != nil { return cfg, err @@ -96,13 +96,13 @@ func parseGlobalPlugins() (cfg *pluginsconfig.Config, err error) { return &pluginsconfig.Config{}, nil } - for i := range cfg.Apps { - cfg.Apps[i].Global = true + for i := range cfg.Extensions { + cfg.Extensions[i].Global = true } return } -func linkPlugins(ctx context.Context, rootCmd *cobra.Command, plugins []*plugin.Plugin) error { +func linkExtensions(ctx context.Context, rootCmd *cobra.Command, plugins []*plugin.Plugin) error { // Link plugins to related commands var linkErrors []*plugin.Plugin for _, p := range plugins { @@ -118,13 +118,13 @@ func linkPlugins(ctx context.Context, rootCmd *cobra.Command, plugins []*plugin. continue } - linkPluginHooks(rootCmd, p, manifest.Hooks) + linkExtensionHooks(rootCmd, p, manifest.Hooks) if p.Error != nil { linkErrors = append(linkErrors, p) continue } - linkPluginCmds(rootCmd, p, manifest.Commands) + linkExtensionCmds(rootCmd, p, manifest.Commands) if p.Error != nil { linkErrors = append(linkErrors, p) continue @@ -133,9 +133,9 @@ func linkPlugins(ctx context.Context, rootCmd *cobra.Command, plugins []*plugin. if len(linkErrors) > 0 { // unload any plugin that could have been loaded - defer UnloadPlugins() + defer UnloadExtensions() - if err := printPlugins(ctx, cliui.New(cliui.WithStdout(os.Stdout))); err != nil { + if err := printExtensions(ctx, cliui.New(cliui.WithStdout(os.Stdout))); err != nil { // content of loadErrors is more important than a print error, so we don't // return here, just print the error. fmt.Printf("fail to print: %v\n", err) @@ -150,32 +150,32 @@ func linkPlugins(ctx context.Context, rootCmd *cobra.Command, plugins []*plugin. return nil } -// UnloadPlugins releases any loaded plugins, which is basically killing the +// UnloadExtensions releases any loaded extensions, which is basically killing the // plugin server instance. -func UnloadPlugins() { - for _, p := range plugins { +func UnloadExtensions() { + for _, p := range extensions { p.KillClient() } } -func linkPluginHooks(rootCmd *cobra.Command, p *plugin.Plugin, hooks []*plugin.Hook) { +func linkExtensionHooks(rootCmd *cobra.Command, p *plugin.Plugin, hooks []*plugin.Hook) { if p.Error != nil { return } for _, hook := range hooks { - linkPluginHook(rootCmd, p, hook) + linkExtensionHook(rootCmd, p, hook) } } -func linkPluginHook(rootCmd *cobra.Command, p *plugin.Plugin, hook *plugin.Hook) { +func linkExtensionHook(rootCmd *cobra.Command, p *plugin.Plugin, hook *plugin.Hook) { cmdPath := hook.CommandPath() cmd := findCommandByPath(rootCmd, cmdPath) if cmd == nil { - p.Error = errors.Errorf("unable to find command path %q for app hook %q", cmdPath, hook.Name) + p.Error = errors.Errorf("unable to find command path %q for extension hook %q", cmdPath, hook.Name) return } if !cmd.Runnable() { - p.Error = errors.Errorf("can't attach app hook %q to non executable command %q", hook.Name, hook.PlaceHookOn) + p.Error = errors.Errorf("can't attach extension hook %q to non executable command %q", hook.Name, hook.PlaceHookOn) return } @@ -203,7 +203,7 @@ func linkPluginHook(rootCmd *cobra.Command, p *plugin.Plugin, hook *plugin.Hook) } } - api, err := newAppClientAPI(cmd) + api, err := newExtensionClientAPI(cmd) if err != nil { return err } @@ -212,7 +212,7 @@ func linkPluginHook(rootCmd *cobra.Command, p *plugin.Plugin, hook *plugin.Hook) execHook := newExecutedHook(hook, cmd, args) err = p.Interface.ExecuteHookPre(ctx, execHook, api) if err != nil { - return errors.Errorf("app %q ExecuteHookPre() error: %w", p.Path, err) + return errors.Errorf("extension %q ExecuteHookPre() error: %w", p.Path, err) } return nil } @@ -224,7 +224,7 @@ func linkPluginHook(rootCmd *cobra.Command, p *plugin.Plugin, hook *plugin.Hook) err := runCmd(cmd, args) // if the command has failed the `PostRun` will not execute. here we execute the cleanup step before returnning. if err != nil { - api, err := newAppClientAPI(cmd) + api, err := newExtensionClientAPI(cmd) if err != nil { return err } @@ -233,7 +233,7 @@ func linkPluginHook(rootCmd *cobra.Command, p *plugin.Plugin, hook *plugin.Hook) execHook := newExecutedHook(hook, cmd, args) err = p.Interface.ExecuteHookCleanUp(ctx, execHook, api) if err != nil { - cmd.Printf("app %q ExecuteHookCleanUp() error: %v", p.Path, err) + cmd.Printf("extension %q ExecuteHookCleanUp() error: %v", p.Path, err) } } return err @@ -245,7 +245,7 @@ func linkPluginHook(rootCmd *cobra.Command, p *plugin.Plugin, hook *plugin.Hook) postCmd := cmd.PostRunE cmd.PostRunE = func(cmd *cobra.Command, args []string) error { - api, err := newAppClientAPI(cmd) + api, err := newExtensionClientAPI(cmd) if err != nil { return err } @@ -256,7 +256,7 @@ func linkPluginHook(rootCmd *cobra.Command, p *plugin.Plugin, hook *plugin.Hook) defer func() { err := p.Interface.ExecuteHookCleanUp(ctx, execHook, api) if err != nil { - cmd.Printf("app %q ExecuteHookCleanUp() error: %v", p.Path, err) + cmd.Printf("extension %q ExecuteHookCleanUp() error: %v", p.Path, err) } }() @@ -270,35 +270,35 @@ func linkPluginHook(rootCmd *cobra.Command, p *plugin.Plugin, hook *plugin.Hook) err = p.Interface.ExecuteHookPost(ctx, execHook, api) if err != nil { - return errors.Errorf("app %q ExecuteHookPost() error : %w", p.Path, err) + return errors.Errorf("extension %q ExecuteHookPost() error : %w", p.Path, err) } return nil } } -// linkPluginCmds tries to add the plugin commands to the legacy ignite +// linkExtensionCmds tries to add the plugin commands to the legacy ignite // commands. -func linkPluginCmds(rootCmd *cobra.Command, p *plugin.Plugin, pluginCmds []*plugin.Command) { +func linkExtensionCmds(rootCmd *cobra.Command, p *plugin.Plugin, pluginCmds []*plugin.Command) { if p.Error != nil { return } for _, pluginCmd := range pluginCmds { - linkPluginCmd(rootCmd, p, pluginCmd) + linkExtensionCmd(rootCmd, p, pluginCmd) if p.Error != nil { return } } } -func linkPluginCmd(rootCmd *cobra.Command, p *plugin.Plugin, pluginCmd *plugin.Command) { +func linkExtensionCmd(rootCmd *cobra.Command, p *plugin.Plugin, pluginCmd *plugin.Command) { cmdPath := pluginCmd.Path() cmd := findCommandByPath(rootCmd, cmdPath) if cmd == nil { - p.Error = errors.Errorf("unable to find command path %q for app %q", cmdPath, p.Path) + p.Error = errors.Errorf("unable to find command path %q for extension %q", cmdPath, p.Path) return } if cmd.Runnable() { - p.Error = errors.Errorf("can't attach app command %q to runnable command %q", pluginCmd.Use, cmd.CommandPath()) + p.Error = errors.Errorf("can't attach extension command %q to runnable command %q", pluginCmd.Use, cmd.CommandPath()) return } @@ -308,7 +308,7 @@ func linkPluginCmd(rootCmd *cobra.Command, p *plugin.Plugin, pluginCmd *plugin.C pluginCmdName := strings.Split(pluginCmd.Use, " ")[0] for _, cmd := range cmd.Commands() { if cmd.Name() == pluginCmdName { - p.Error = errors.Errorf("app command %q already exists in Ignite's commands", pluginCmdName) + p.Error = errors.Errorf("extension command %q already exists in Ignite's commands", pluginCmdName) return } } @@ -331,7 +331,7 @@ func linkPluginCmd(rootCmd *cobra.Command, p *plugin.Plugin, pluginCmd *plugin.C newCmd.RunE = func(cmd *cobra.Command, args []string) error { ctx := cmd.Context() return clictx.Do(ctx, func() error { - api, err := newAppClientAPI(cmd) + api, err := newExtensionClientAPI(cmd) if err != nil { return err } @@ -357,7 +357,7 @@ func linkPluginCmd(rootCmd *cobra.Command, p *plugin.Plugin, pluginCmd *plugin.C } else { for _, pluginCmd := range pluginCmd.Commands { pluginCmd.PlaceCommandUnder = newCmd.CommandPath() - linkPluginCmd(newCmd, p, pluginCmd) + linkExtensionCmd(newCmd, p, pluginCmd) if p.Error != nil { return } @@ -377,71 +377,72 @@ func findCommandByPath(cmd *cobra.Command, cmdPath string) *cobra.Command { return nil } -// NewApp returns a command that groups Ignite App related sub commands. -func NewApp() *cobra.Command { +// NewExtension returns a command that groups Ignite Extensions related sub commands. +func NewExtension() *cobra.Command { c := &cobra.Command{ - Use: "app [command]", - Short: "Create and manage Ignite Apps", + Use: "extension [command]", + Aliases: []string{"ext", "extn", "app", "plugin", "extensions"}, + Short: "Create and manage Ignite Extensions", } c.AddCommand( - NewAppList(), - NewAppUpdate(), - NewAppScaffold(), - NewAppDescribe(), - NewAppInstall(), - NewAppUninstall(), + NewExtensionList(), + NewExtensionUpdate(), + NewExtensionScaffold(), + NewExtensionDescribe(), + NewExtensionInstall(), + NewExtensionUninstall(), ) return c } -func NewAppList() *cobra.Command { +func NewExtensionList() *cobra.Command { lstCmd := &cobra.Command{ Use: "list", - Short: "List installed apps", - Long: "Prints status and information of all installed Ignite Apps.", + Short: "List installed extensions", + Long: "Prints status and information of all installed Ignite Extensions.", RunE: func(cmd *cobra.Command, _ []string) error { s := cliui.New(cliui.WithStdout(os.Stdout)) - return printPlugins(cmd.Context(), s) + return printExtensions(cmd.Context(), s) }, } return lstCmd } -func NewAppUpdate() *cobra.Command { +func NewExtensionUpdate() *cobra.Command { return &cobra.Command{ Use: "update [path]", - Short: "Update app", - Long: `Updates an Ignite App specified by path. + Short: "Updates an Ignite Extension", + Long: `Updates an Ignite Extension specified by path. If no path is specified all declared apps are updated.`, - Example: "ignite app update github.com/org/my-app/", + Example: "ignite extension update github.com/org/my-extension/", Args: cobra.MaximumNArgs(1), RunE: func(_ *cobra.Command, args []string) error { if len(args) == 0 { // update all plugins - return plugin.Update(plugins...) + return plugin.Update(extensions...) } // find the plugin to update - for _, p := range plugins { + for _, p := range extensions { if p.HasPath(args[0]) { return plugin.Update(p) } } - return errors.Errorf("App %q not found", args[0]) + return errors.Errorf("Extension %q not found", args[0]) }, } } -func NewAppInstall() *cobra.Command { - cmdPluginAdd := &cobra.Command{ +func NewExtensionInstall() *cobra.Command { + cmdExtensionInstall := &cobra.Command{ Use: "install [path] [key=value]...", - Short: "Install app", - Long: `Installs an Ignite App. + Short: "Installs an Ingite Extension", + Long: `Installs an Ignite Extension. -Respects key value pairs declared after the app path to be added to the generated configuration definition.`, - Example: "ignite app install github.com/org/my-app/ foo=bar baz=qux", +Respects key value pairs declared after the extension path to be added to the generated configuration definition.`, + Example: "ignite extension install github.com/org/my-extension/ foo=bar baz=qux", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { session := cliui.New(cliui.WithStdout(os.Stdout)) @@ -452,19 +453,19 @@ Respects key value pairs declared after the app path to be added to the generate err error ) - global := flagGetPluginsGlobal(cmd) + global := flagGetExtensionsGlobal(cmd) if global { - conf, err = parseGlobalPlugins() + conf, err = parseGlobalExtensions() } else { - conf, err = parseLocalPlugins(cmd) + conf, err = parseLocalExtensions(cmd) } if err != nil { return err } - for _, p := range conf.Apps { + for _, p := range conf.Extensions { if p.HasPath(args[0]) { - return errors.Errorf("app %s is already installed", args[0]) + return errors.Errorf("extension %s is already installed", args[0]) } } @@ -474,16 +475,16 @@ Respects key value pairs declared after the app path to be added to the generate Global: global, } - pluginsOptions := []plugin.Option{ + extensionsOptions := []plugin.Option{ plugin.CollectEvents(session.EventBus()), } - var pluginArgs []string + var extensionArgs []string if len(args) > 1 { - pluginArgs = args[1:] + extensionArgs = args[1:] } - for _, pa := range pluginArgs { + for _, pa := range extensionArgs { kv := strings.Split(pa, "=") if len(kv) != 2 { return errors.Errorf("malformed key=value arg: %s", pa) @@ -491,17 +492,17 @@ Respects key value pairs declared after the app path to be added to the generate p.With[kv[0]] = kv[1] } - plugins, err := plugin.Load(cmd.Context(), []pluginsconfig.Plugin{p}, pluginsOptions...) + extensions, err := plugin.Load(cmd.Context(), []pluginsconfig.Plugin{p}, extensionsOptions...) if err != nil { return err } - defer plugins[0].KillClient() + defer extensions[0].KillClient() - if plugins[0].Error != nil { - return errors.Errorf("error while loading app %q: %w", args[0], plugins[0].Error) + if extensions[0].Error != nil { + return errors.Errorf("error while loading extension %q: %w", args[0], extensions[0].Error) } - session.Println(icons.OK, "Done loading apps") - conf.Apps = append(conf.Apps, p) + session.Println(icons.OK, "Done loading extensions") + conf.Extensions = append(conf.Extensions, p) if err := conf.Save(); err != nil { return err @@ -512,18 +513,18 @@ Respects key value pairs declared after the app path to be added to the generate }, } - cmdPluginAdd.Flags().AddFlagSet(flagSetPluginsGlobal()) + cmdExtensionInstall.Flags().AddFlagSet(flagSetExtensionsGlobal()) - return cmdPluginAdd + return cmdExtensionInstall } -func NewAppUninstall() *cobra.Command { - cmdPluginRemove := &cobra.Command{ +func NewExtensionUninstall() *cobra.Command { + cmdExtensionUninstall := &cobra.Command{ Use: "uninstall [path]", Aliases: []string{"rm"}, - Short: "Uninstall app", - Long: "Uninstalls an Ignite App specified by path.", - Example: "ignite app uninstall github.com/org/my-app/", + Short: "Uninstall an Ignite Extension xtension", + Long: "Uninstalls an Ignite Extension specified by path.", + Example: "ignite extension uninstall github.com/org/my-extension/", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { s := cliui.New(cliui.WithStdout(os.Stdout)) @@ -533,20 +534,20 @@ func NewAppUninstall() *cobra.Command { err error ) - global := flagGetPluginsGlobal(cmd) + global := flagGetExtensionsGlobal(cmd) if global { - conf, err = parseGlobalPlugins() + conf, err = parseGlobalExtensions() } else { - conf, err = parseLocalPlugins(cmd) + conf, err = parseLocalExtensions(cmd) } if err != nil { return err } removed := false - for i, cp := range conf.Apps { + for i, cp := range conf.Extensions { if cp.HasPath(args[0]) { - conf.Apps = append(conf.Apps[:i], conf.Apps[i+1:]...) + conf.Extensions = append(conf.Extensions[:i], conf.Extensions[i+1:]...) removed = true break } @@ -554,7 +555,7 @@ func NewAppUninstall() *cobra.Command { if !removed { // return if no matching plugin path found - return errors.Errorf("app %s not found", args[0]) + return errors.Errorf("extension %s not found", args[0]) } if err := conf.Save(); err != nil { @@ -568,19 +569,19 @@ func NewAppUninstall() *cobra.Command { }, } - cmdPluginRemove.Flags().AddFlagSet(flagSetPluginsGlobal()) + cmdExtensionUninstall.Flags().AddFlagSet(flagSetExtensionsGlobal()) - return cmdPluginRemove + return cmdExtensionUninstall } -func NewAppScaffold() *cobra.Command { +func NewExtensionScaffold() *cobra.Command { return &cobra.Command{ Use: "scaffold [name]", - Short: "Scaffold a new Ignite App", - Long: `Scaffolds a new Ignite App in the current directory. + Short: "Scaffold a new Ignite Extension", + Long: `Scaffolds a new Ignite Extension in the current directory. A git repository will be created with the given module name, unless the current directory is already a git repository.`, - Example: "ignite app scaffold github.com/org/my-app/", + Example: "ignite extension scaffold github.com/org/my-extension/", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { session := cliui.New(cliui.StartSpinnerWithText(statusScaffolding)) @@ -599,19 +600,19 @@ A git repository will be created with the given module name, unless the current return err } - message := `⭐️ Successfully created a new Ignite App '%[1]s'. + message := `⭐️ Successfully created a new Ignite Extension '%[1]s'. -👉 Update app code at '%[2]s/main.go' +👉 Update extension code at '%[2]s/main.go' -👉 Test Ignite App integration by installing the app within the chain directory: +👉 Test Ignite Extension integration by installing the extension within the chain directory: - ignite app install %[2]s + ignite extension install %[2]s Or globally: - ignite app install -g %[2]s + ignite extension install -g %[2]s -👉 Once the app is pushed to a repository, replace the local path by the repository path. +👉 Once the extension is pushed to a repository, replace the local path by the repository path. ` session.Printf(message, moduleName, path) return nil @@ -619,22 +620,22 @@ Or globally: } } -func NewAppDescribe() *cobra.Command { +func NewExtensionDescribe() *cobra.Command { return &cobra.Command{ Use: "describe [path]", - Short: "Print information about installed apps", - Long: "Print information about an installed Ignite App commands and hooks.", - Example: "ignite app describe github.com/org/my-app/", + Short: "Print information about installed extensions", + Long: "Print information about an installed Ignite Extension commands and hooks.", + Example: "ignite extension describe github.com/org/my-extension/", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { s := cliui.New(cliui.WithStdout(os.Stdout)) ctx := cmd.Context() - for _, p := range plugins { + for _, p := range extensions { if p.HasPath(args[0]) { manifest, err := p.Interface.Manifest(ctx) if err != nil { - return errors.Errorf("error while loading app manifest: %w", err) + return errors.Errorf("error while loading extension manifest: %w", err) } if len(manifest.Commands) > 0 { @@ -661,14 +662,14 @@ func NewAppDescribe() *cobra.Command { } } -func getPluginLocationName(p *plugin.Plugin) string { +func getExtensionLocationName(p *plugin.Plugin) string { if p.IsGlobal() { return "global" } return "local" } -func getPluginStatus(ctx context.Context, p *plugin.Plugin) string { +func getExtensionStatus(ctx context.Context, p *plugin.Plugin) string { if p.Error != nil { return fmt.Sprintf("%s Error: %v", icons.NotOK, p.Error) } @@ -681,20 +682,20 @@ func getPluginStatus(ctx context.Context, p *plugin.Plugin) string { return fmt.Sprintf("%s Loaded", icons.OK) } -func printPlugins(ctx context.Context, session *cliui.Session) error { +func printExtensions(ctx context.Context, session *cliui.Session) error { var entries [][]string - for _, p := range plugins { - entries = append(entries, []string{p.Path, getPluginLocationName(p), getPluginStatus(ctx, p)}) + for _, p := range extensions { + entries = append(entries, []string{p.Path, getExtensionLocationName(p), getExtensionStatus(ctx, p)}) } if err := session.PrintTable([]string{"Path", "Config", "Status"}, entries...); err != nil { - return errors.Errorf("error while printing apps: %w", err) + return errors.Errorf("error while printing extensions: %w", err) } return nil } -func newAppClientAPI(cmd *cobra.Command) (plugin.ClientAPI, error) { - // Get chain when the plugin runs inside an blockchain app +func newExtensionClientAPI(cmd *cobra.Command) (plugin.ClientAPI, error) { + // Get chain when the extension runs inside a blockchain app c, err := chain.NewWithHomeFlags(cmd) if err != nil && !errors.Is(err, gomodule.ErrGoModNotFound) { return nil, err @@ -708,13 +709,20 @@ func newAppClientAPI(cmd *cobra.Command) (plugin.ClientAPI, error) { return plugin.NewClientAPI(options...), nil } -func flagSetPluginsGlobal() *flag.FlagSet { +func flagSetExtensionsGlobal() *flag.FlagSet { fs := flag.NewFlagSet("", flag.ContinueOnError) - fs.BoolP(flagPluginsGlobal, "g", false, "use global plugins configuration ($HOME/.ignite/apps/igniteapps.yml)") + fs.BoolP(flagExtensionsGlobal, "g", false, "use global extensions configuration ($HOME/.ignite/extensions/extensions.yml)") return fs } -func flagGetPluginsGlobal(cmd *cobra.Command) bool { - global, _ := cmd.Flags().GetBool(flagPluginsGlobal) +func flagGetExtensionsGlobal(cmd *cobra.Command) bool { + global, _ := cmd.Flags().GetBool(flagExtensionsGlobal) return global } + +// Backward compat. +var ( + LoadPlugins = LoadExtensions + UnloadPlugins = UnloadExtensions + NewAppInstall = NewExtensionInstall +) diff --git a/ignite/cmd/plugin_default.go b/ignite/cmd/extension_default.go similarity index 60% rename from ignite/cmd/plugin_default.go rename to ignite/cmd/extension_default.go index 798a995610..c7d1d1997c 100644 --- a/ignite/cmd/plugin_default.go +++ b/ignite/cmd/extension_default.go @@ -8,7 +8,7 @@ import ( "github.com/ignite/cli/v29/ignite/services/plugin" ) -type defaultPlugin struct { +type defaultExtension struct { use string short string aliases []string @@ -16,56 +16,58 @@ type defaultPlugin struct { } const ( - PluginNetworkVersion = "v0.2.2" - PluginNetworkPath = "github.com/ignite/cli-plugin-network@" + PluginNetworkVersion - PluginRelayerVersion = "hermes/v0.2.2" - PluginRelayerPath = "github.com/ignite/apps/hermes@" + PluginRelayerVersion + ExtensionNetworkVersion = "v0.2.2" + ExtensionNetworkPath = "github.com/ignite/cli-plugin-network@" + ExtensionNetworkVersion + ExtensionRelayerVersion = "hermes/v0.2.2" + ExtensionRelayerPath = "github.com/ignite/apps/hermes@" + ExtensionRelayerVersion ) -// defaultPlugins holds the plugin that are considered trustable and for which -// a command will added if the plugin is not already installed. -// When the user executes that command, the plugin is automatically installed. -var defaultPlugins = []defaultPlugin{ +// defaultExtension holds the extensions that are considered trustable and for which +// a command will added if the extensions is not already installed. +// When the user executes that command, the extensions is automatically installed. +var defaultExtensions = []defaultExtension{ { use: "network", short: "Launch a blockchain in production", aliases: []string{"n"}, - path: PluginNetworkPath, + path: ExtensionNetworkPath, }, { use: "relayer", short: "Connect blockchains with an IBC relayer", aliases: []string{"r"}, - path: PluginRelayerPath, + path: ExtensionRelayerPath, }, + + // TODO(@julienrbrt) eventually add Ignite Connect } -// ensureDefaultPlugins ensures that all defaultPlugins are whether registered +// ensureDefaultExtensions ensures that all defaultExtensions are whether registered // in cfg OR have an install command added to rootCmd. -func ensureDefaultPlugins(rootCmd *cobra.Command, cfg *pluginsconfig.Config) { - for _, dp := range defaultPlugins { +func ensureDefaultExtensions(rootCmd *cobra.Command, cfg *pluginsconfig.Config) { + for _, dp := range defaultExtensions { // Check if plugin is declared in global config if cfg.HasPlugin(dp.path) { // plugin found nothing to do continue } // plugin not found in config, add a proxy install command - rootCmd.AddCommand(newPluginInstallCmd(dp)) + rootCmd.AddCommand(newPExtensionInstallCmd(dp)) } } -// newPluginInstallCmd mimics the plugin command but acts as proxy to first: +// newPExtensionInstallCmd mimics the plugin command but acts as proxy to first: // - register the config in the global config // - load the plugin // - execute the command thanks to the loaded plugin. -func newPluginInstallCmd(dp defaultPlugin) *cobra.Command { +func newPExtensionInstallCmd(dp defaultExtension) *cobra.Command { return &cobra.Command{ Use: dp.use, Short: dp.short, Aliases: dp.aliases, DisableFlagParsing: true, // Avoid -h to skip command run RunE: func(cmd *cobra.Command, _ []string) error { - cfg, err := parseGlobalPlugins() + cfg, err := parseGlobalExtensions() if err != nil { return err } @@ -74,7 +76,7 @@ func newPluginInstallCmd(dp defaultPlugin) *cobra.Command { pluginCfg := pluginsconfig.Plugin{ Path: dp.path, } - cfg.Apps = append(cfg.Apps, pluginCfg) + cfg.Extensions = append(cfg.Extensions, pluginCfg) if err := cfg.Save(); err != nil { return err } @@ -98,7 +100,7 @@ func newPluginInstallCmd(dp defaultPlugin) *cobra.Command { // Remove this command before call to linkPlugins because a plugin is // usually not allowed to override an existing command. rootCmd.RemoveCommand(cmd) - if err := linkPlugins(cmd.Context(), rootCmd, plugins); err != nil { + if err := linkExtensions(cmd.Context(), rootCmd, plugins); err != nil { return err } // Execute the command diff --git a/ignite/cmd/plugin_default_test.go b/ignite/cmd/extension_default_test.go similarity index 87% rename from ignite/cmd/plugin_default_test.go rename to ignite/cmd/extension_default_test.go index c86aa03c3b..a4519fed84 100644 --- a/ignite/cmd/plugin_default_test.go +++ b/ignite/cmd/extension_default_test.go @@ -9,7 +9,7 @@ import ( pluginsconfig "github.com/ignite/cli/v29/ignite/config/plugins" ) -func TestEnsureDefaultPlugins(t *testing.T) { +func TestEnsureDefaultExtensions(t *testing.T) { tests := []struct { name string cfg *pluginsconfig.Config @@ -23,7 +23,7 @@ func TestEnsureDefaultPlugins(t *testing.T) { { name: "should not add because already present in config", cfg: &pluginsconfig.Config{ - Apps: []pluginsconfig.Plugin{{ + Extensions: []pluginsconfig.Plugin{{ Path: "github.com/ignite/cli-plugin-network@v42", }}, }, @@ -34,7 +34,7 @@ func TestEnsureDefaultPlugins(t *testing.T) { t.Run(tt.name, func(t *testing.T) { cmd := &cobra.Command{Use: "ignite"} - ensureDefaultPlugins(cmd, tt.cfg) + ensureDefaultExtensions(cmd, tt.cfg) expectedCmd := findCommandByPath(cmd, "ignite network") if tt.expectAddedInCommand { diff --git a/ignite/cmd/plugin_test.go b/ignite/cmd/extension_test.go similarity index 95% rename from ignite/cmd/plugin_test.go rename to ignite/cmd/extension_test.go index d4cf70fede..35ae5a5c69 100644 --- a/ignite/cmd/plugin_test.go +++ b/ignite/cmd/extension_test.go @@ -71,7 +71,7 @@ func assertFlags(t *testing.T, expectedFlags []*plugin.Flag, execCmd *plugin.Exe assert.Equal(t, expected, have) } -func TestLinkPluginCmds(t *testing.T) { +func TestLinkExtensionCmds(t *testing.T) { var ( args = []string{"arg1", "arg2"} pluginParams = map[string]string{"key": "val"} @@ -188,7 +188,7 @@ ignite nil, ) }, - expectedError: `can't attach app command "foo" to runnable command "ignite scaffold chain"`, + expectedError: `can't attach extension command "foo" to runnable command "ignite scaffold chain"`, }, { name: "fail: link to unknown command", @@ -206,7 +206,7 @@ ignite nil, ) }, - expectedError: `unable to find command path "ignite unknown" for app "foo"`, + expectedError: `unable to find command path "ignite unknown" for extension "foo"`, }, { name: "fail: plugin name exists in legacy commands", @@ -223,7 +223,7 @@ ignite nil, ) }, - expectedError: `app command "scaffold" already exists in Ignite's commands`, + expectedError: `extension command "scaffold" already exists in Ignite's commands`, }, { name: "fail: plugin name with args exists in legacy commands", @@ -240,7 +240,7 @@ ignite nil, ) }, - expectedError: `app command "scaffold" already exists in Ignite's commands`, + expectedError: `extension command "scaffold" already exists in Ignite's commands`, }, { name: "fail: plugin name exists in legacy sub commands", @@ -258,7 +258,7 @@ ignite nil, ) }, - expectedError: `app command "chain" already exists in Ignite's commands`, + expectedError: `extension command "chain" already exists in Ignite's commands`, }, { name: "ok: link multiple at root", @@ -370,7 +370,7 @@ ignite rootCmd := buildRootCmd(ctx) tt.setup(t, ctx, pi) - _ = linkPlugins(ctx, rootCmd, []*plugin.Plugin{p}) + _ = linkExtensions(ctx, rootCmd, []*plugin.Plugin{p}) if tt.expectedError != "" { require.Error(p.Error) @@ -404,7 +404,7 @@ func dumpCmd(c *cobra.Command, w io.Writer, ntabs int) { } } -func TestLinkPluginHooks(t *testing.T) { +func TestLinkExtensionHooks(t *testing.T) { var ( args = []string{"arg1", "arg2"} pluginParams = map[string]string{"key": "val"} @@ -476,7 +476,7 @@ func TestLinkPluginHooks(t *testing.T) { nil, ) }, - expectedError: `can't attach app hook "test-hook" to non executable command "ignite scaffold"`, + expectedError: `can't attach extension hook "test-hook" to non executable command "ignite scaffold"`, }, { name: "fail: command doesn't exists", @@ -494,7 +494,7 @@ func TestLinkPluginHooks(t *testing.T) { nil, ) }, - expectedError: `unable to find command path "ignite chain" for app hook "test-hook"`, + expectedError: `unable to find command path "ignite chain" for extension hook "test-hook"`, }, { name: "ok: single hook", @@ -605,7 +605,7 @@ func TestLinkPluginHooks(t *testing.T) { rootCmd := buildRootCmd(ctx) tt.setup(t, ctx, pi) - _ = linkPlugins(ctx, rootCmd, []*plugin.Plugin{p}) + _ = linkExtensions(ctx, rootCmd, []*plugin.Plugin{p}) if tt.expectedError != "" { require.EqualError(p.Error, tt.expectedError) diff --git a/ignite/config/chain/v1/testdata/config2.yaml b/ignite/config/chain/v1/testdata/config2.yaml index e611e287ff..03132428ce 100644 --- a/ignite/config/chain/v1/testdata/config2.yaml +++ b/ignite/config/chain/v1/testdata/config2.yaml @@ -33,7 +33,7 @@ validators: address: 0.0.0.0:8545 ws-address: 0.0.0.0:8546 home: $HOME/.evmosd -apps: +extensions: - name: plugin1 path: /path/to/plugin1 - name: plugin2 diff --git a/ignite/config/plugins/config.go b/ignite/config/plugins/config.go index 5a3b4f7986..ab809244e3 100644 --- a/ignite/config/plugins/config.go +++ b/ignite/config/plugins/config.go @@ -14,9 +14,9 @@ import ( type Config struct { path string - // Apps holds the list of installed Ignite Apps. - // Ignite Apps are implemented as plugins. - Apps []Plugin `yaml:"apps"` + // Extensions holds the list of installed Ignite Extensions. + // Ignite Extensions are implemented as plugins. + Extensions []Plugin `yaml:"extensions"` } // Plugin keeps plugin name and location. @@ -43,7 +43,7 @@ type Plugin struct { With map[string]string `yaml:"with,omitempty"` // Global holds whether the plugin is installed globally - // (default: $HOME/.ignite/apps/igniteapps.yml) or locally for a chain. + // (default: $HOME/.ignite/ext/extensions.yml) or locally for a chain. Global bool `yaml:"-"` } @@ -140,7 +140,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.Apps, func(cp Plugin) bool { + return slices.ContainsFunc(c.Extensions, func(cp Plugin) bool { if cp.HasPath(path) { return true } diff --git a/ignite/config/plugins/config_test.go b/ignite/config/plugins/config_test.go index 2c4df2bc20..b05999036c 100644 --- a/ignite/config/plugins/config_test.go +++ b/ignite/config/plugins/config_test.go @@ -270,30 +270,30 @@ func TestConfigSave(t *testing.T) { require.NoError(t, err) return cfg }, - expectedContent: "apps: []\n", + expectedContent: "extensions: []\n", }, { name: "ok: config path is an existing file", buildConfig: func(t *testing.T) *pluginsconfig.Config { - // copy testdata/igniteapps.yml to tmp because it will be modified + // copy testdata/extensions.yml to tmp because it will be modified dir := t.TempDir() - bz, err := os.ReadFile("testdata/igniteapps.yml") + bz, err := os.ReadFile("testdata/extensions.yml") require.NoError(t, err) - err = os.WriteFile(path.Join(dir, "igniteapps.yml"), bz, 0o666) + err = os.WriteFile(path.Join(dir, "extensions.yml"), bz, 0o666) require.NoError(t, err) // load from tmp cfg, _ := pluginsconfig.ParseDir(dir) // add a new plugin - cfg.Apps = append(cfg.Apps, pluginsconfig.Plugin{ + cfg.Extensions = append(cfg.Extensions, pluginsconfig.Plugin{ Path: "/path/to/plugin3", With: map[string]string{"key": "val"}, }) // update a plugin - cfg.Apps[1].Path = "/path/to/plugin22" - cfg.Apps[1].With["key"] = "val" + cfg.Extensions[1].Path = "/path/to/plugin22" + cfg.Extensions[1].With["key"] = "val" return cfg }, - expectedContent: `apps: + expectedContent: `extensions: - path: /path/to/plugin1 - path: /path/to/plugin22 with: @@ -340,7 +340,7 @@ func TestConfigHasPlugin(t *testing.T) { { name: "not found in config", cfg: pluginsconfig.Config{ - Apps: []pluginsconfig.Plugin{ + Extensions: []pluginsconfig.Plugin{ {Path: "github.com/ignite/example2"}, }, }, @@ -349,7 +349,7 @@ func TestConfigHasPlugin(t *testing.T) { { name: "found in config", cfg: pluginsconfig.Config{ - Apps: []pluginsconfig.Plugin{ + Extensions: []pluginsconfig.Plugin{ {Path: "github.com/ignite/example2"}, {Path: "github.com/ignite/example@master"}, }, @@ -359,7 +359,7 @@ func TestConfigHasPlugin(t *testing.T) { { name: "found in config but from a local plugin", cfg: pluginsconfig.Config{ - Apps: []pluginsconfig.Plugin{ + Extensions: []pluginsconfig.Plugin{ {Path: "github.com/ignite/example2"}, {Path: path.Join(wd, "testdata", "localplugin", "example")}, }, diff --git a/ignite/config/plugins/parse.go b/ignite/config/plugins/parse.go index 23afb624f4..e36887cfdd 100644 --- a/ignite/config/plugins/parse.go +++ b/ignite/config/plugins/parse.go @@ -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 `igniteapps.yml` or `igniteapps.yaml`. If +// The plugin config file format can be `extensions.yml` or `extensions.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) { @@ -53,7 +53,7 @@ func ParseDir(dir string) (*Config, error) { } var ( - filenames = []string{"igniteapps.yml", "igniteapps.yaml"} + filenames = []string{"extensions.yml", "extensions.yaml"} defaultFilename = filenames[0] ) diff --git a/ignite/config/plugins/parse_test.go b/ignite/config/plugins/parse_test.go index fe536e22f4..300bfd3bcc 100644 --- a/ignite/config/plugins/parse_test.go +++ b/ignite/config/plugins/parse_test.go @@ -18,8 +18,8 @@ func TestParseDir(t *testing.T) { }{ { name: "fail: path is not a dir", - path: "testdata/igniteapps.yml", - expectedError: "plugin config parse: path testdata/igniteapps.yml is not a dir", + path: "testdata/extensions.yml", + expectedError: "plugin config parse: path testdata/extensions.yml is not a dir", }, { name: "fail: path doesn't exists", @@ -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/igniteapps.yml", + expectedPath: "testdata/noconfig/extensions.yml", }, { name: "fail: path contains an invalid yml file", @@ -52,7 +52,7 @@ func TestParseDir(t *testing.T) { }, }, }, - expectedPath: "testdata/igniteapps.yml", + expectedPath: "testdata/extensions.yml", }, { name: "ok: path contains a plugin.yaml file", @@ -69,7 +69,7 @@ func TestParseDir(t *testing.T) { }, }, }, - expectedPath: "testdata/other/igniteapps.yaml", + expectedPath: "testdata/other/extensions.yml", }, } for _, tt := range tests { @@ -83,7 +83,7 @@ func TestParseDir(t *testing.T) { return } require.NoError(err) - require.Equal(tt.expectedPlugins, cfg.Apps) + require.Equal(tt.expectedPlugins, cfg.Extensions) require.Equal(tt.expectedPath, cfg.Path()) }) } diff --git a/ignite/config/plugins/testdata/igniteapps.yml b/ignite/config/plugins/testdata/extensions.yml similarity index 91% rename from ignite/config/plugins/testdata/igniteapps.yml rename to ignite/config/plugins/testdata/extensions.yml index 2d541a7553..c3d310c762 100644 --- a/ignite/config/plugins/testdata/igniteapps.yml +++ b/ignite/config/plugins/testdata/extensions.yml @@ -1,4 +1,4 @@ -apps: +extensions: - name: plugin1 path: /path/to/plugin1 - name: plugin2 diff --git a/ignite/config/plugins/testdata/invalid/igniteapps.yml b/ignite/config/plugins/testdata/invalid/extensions.yml similarity index 100% rename from ignite/config/plugins/testdata/invalid/igniteapps.yml rename to ignite/config/plugins/testdata/invalid/extensions.yml diff --git a/ignite/config/plugins/testdata/other/igniteapps.yaml b/ignite/config/plugins/testdata/other/extensions.yml similarity index 91% rename from ignite/config/plugins/testdata/other/igniteapps.yaml rename to ignite/config/plugins/testdata/other/extensions.yml index 2d541a7553..c3d310c762 100644 --- a/ignite/config/plugins/testdata/other/igniteapps.yaml +++ b/ignite/config/plugins/testdata/other/extensions.yml @@ -1,4 +1,4 @@ -apps: +extensions: - name: plugin1 path: /path/to/plugin1 - name: plugin2 diff --git a/ignite/internal/plugin/execute_test.go b/ignite/internal/plugin/execute_test.go index a76c8795a9..75d1ce42e8 100644 --- a/ignite/internal/plugin/execute_test.go +++ b/ignite/internal/plugin/execute_test.go @@ -23,7 +23,7 @@ func TestPluginExecute(t *testing.T) { { name: "fail: plugin doesnt exist", pluginPath: "/not/exists", - expectedError: "local app path \"/not/exists\" not found: stat /not/exists: no such file or directory", + expectedError: "local extension path \"/not/exists\" not found: stat /not/exists: no such file or directory", }, { name: "ok: plugin execute ok", diff --git a/ignite/internal/tools/gen-cli-docs/main.go b/ignite/internal/tools/gen-cli-docs/main.go index 03382fe466..e37af33400 100644 --- a/ignite/internal/tools/gen-cli-docs/main.go +++ b/ignite/internal/tools/gen-cli-docs/main.go @@ -58,9 +58,9 @@ func run() error { if err != nil { return err } - cfg.Apps = append(cfg.Apps, pluginsconfig.Plugin{ + cfg.Extensions = append(cfg.Extensions, pluginsconfig.Plugin{ // Add network plugin - Path: ignitecmd.PluginNetworkPath, + Path: ignitecmd.ExtensionNetworkPath, }) if err := cfg.Save(); err != nil { return err diff --git a/ignite/services/doctor/doctor_plugins.go b/ignite/services/doctor/doctor_plugins.go index e48b70010b..07dc29550d 100644 --- a/ignite/services/doctor/doctor_plugins.go +++ b/ignite/services/doctor/doctor_plugins.go @@ -17,7 +17,7 @@ import ( "github.com/ignite/cli/v29/ignite/pkg/events" ) -// MigratePluginsConfig migrates plugins config to Ignite App config if required. +// MigratePluginsConfig migrates plugins config to Ignite Extension config if required. func (d Doctor) MigratePluginsConfig() error { errf := func(err error) error { return errors.Errorf("doctor migrate plugins config: %w", err) @@ -52,29 +52,40 @@ func (d Doctor) migrateGlobalPluginConfig() error { return err } - // Global apps directory is always available because it is + // Global extensions directory is always available because it is // created if it doesn't exists when any command is executed. - appsPath := filepath.Join(globalPath, "apps", "igniteapps.yml") - if _, err := os.Stat(appsPath); err == nil { + extensionsPath := filepath.Join(globalPath, "extensions", "extensions.yml") + if _, err := os.Stat(extensionsPath); err == nil { d.ev.Send( - fmt.Sprintf("%s %s", appsPath, colors.Success("exists")), + fmt.Sprintf("%s %s", extensionsPath, colors.Success("exists")), events.Icon(icons.OK), events.Indent(1), ) - // Ignite apps config file exists in global directory + // Ignite extensions config file exists in global directory return nil } - legacyPath, err := findPluginsConfigPath(filepath.Join(globalPath, "plugins")) + // old plugins config file + legacyPath, err := findConfigPath(filepath.Join(globalPath, "plugins"), "plugins") if err != nil { return err - } else if legacyPath == "" { - // Nothing to migrate when the legacy plugins config path doesn't exist - return nil } - if err := d.migratePluginsConfigFiles(legacyPath, appsPath); err != nil { + // old plugin file not found, check for app config file + if legacyPath == "" { + legacyPath, err = findConfigPath(filepath.Join(globalPath, "apps"), "igniteapps") + if err != nil { + return err + } + + // no legacy config file found + if legacyPath == "" { + return nil + } + } + + if err := d.migratePluginsConfigFiles(legacyPath, extensionsPath); err != nil { return err } @@ -105,55 +116,65 @@ func (d Doctor) migrateLocalPluginsConfig() error { return err } - appsPath := filepath.Join(localPath, "igniteapps.yml") - if _, err := os.Stat(appsPath); err == nil { + extensionsPath := filepath.Join(localPath, "extensions.yml") + if _, err := os.Stat(extensionsPath); err == nil { d.ev.Send( - fmt.Sprintf("%s %s", appsPath, colors.Success("exists")), + fmt.Sprintf("%s %s", extensionsPath, colors.Success("exists")), events.Icon(icons.OK), events.Indent(1), ) - // Ignite apps config file exists in current directory + // Ignite extensions config file exists in current directory return nil } - legacyPath, err := findPluginsConfigPath(localPath) + legacyPath, err := findConfigPath(localPath, "plugins") if err != nil { return err - } else if legacyPath == "" { - // Nothing to migrate when plugins config file is not found in current directory - return nil } - return d.migratePluginsConfigFiles(legacyPath, appsPath) + // old plugin file not found, check for app config file + if legacyPath == "" { + legacyPath, err = findConfigPath(localPath, "igniteapps") + if err != nil { + return err + } + + // no legacy config file found + if legacyPath == "" { + return nil + } + } + + return d.migratePluginsConfigFiles(legacyPath, extensionsPath) } -func (d Doctor) migratePluginsConfigFiles(pluginsPath, appsPath string) error { - pluginsFile, err := os.Open(pluginsPath) +func (d Doctor) migratePluginsConfigFiles(legacyPath, extensionsPath string) error { + legacyFile, err := os.Open(legacyPath) if err != nil { return err } - defer pluginsFile.Close() + defer legacyFile.Close() - appsFile, err := os.OpenFile(appsPath, os.O_WRONLY|os.O_CREATE, 0o644) + extensionFile, err := os.OpenFile(extensionsPath, os.O_WRONLY|os.O_CREATE, 0o644) if err != nil { return err } - defer appsFile.Close() + defer extensionFile.Close() - if err = migratePluginsConfig(pluginsFile, appsFile); err != nil { + if err = migratePluginsConfig(legacyFile, extensionFile); err != nil { return err } d.ev.Send( - fmt.Sprintf("migrated config file %s to %s", colors.Faint(pluginsPath), colors.Faint(appsPath)), + fmt.Sprintf("migrated config file %s to %s", colors.Faint(legacyPath), colors.Faint(extensionsPath)), events.Icon(icons.OK), events.Indent(1), ) d.ev.SendInfo( - fmt.Sprintf("file %s can safely be removed", pluginsPath), + fmt.Sprintf("file (and folder) %s can safely be removed", legacyPath), events.Icon(icons.Info), events.Indent(1), ) @@ -181,11 +202,16 @@ func updatePluginsConfig(r io.Reader) ([]byte, error) { return nil, err } - if apps, ok := cfg["plugins"]; ok { - cfg["apps"] = apps + if extensions, ok := cfg["plugins"]; ok { + cfg["extensions"] = extensions delete(cfg, "plugins") } + if extensions, ok := cfg["apps"]; ok { + cfg["extensions"] = extensions + delete(cfg, "apps") + } + var buf bytes.Buffer if err = yaml.NewEncoder(&buf).Encode(cfg); err != nil { return nil, err @@ -193,9 +219,9 @@ func updatePluginsConfig(r io.Reader) ([]byte, error) { return buf.Bytes(), nil } -func findPluginsConfigPath(dir string) (string, error) { +func findConfigPath(dir, fileNameWithoutExtension string) (string, error) { for _, ext := range []string{"yml", "yaml"} { - path := filepath.Join(dir, fmt.Sprintf("plugins.%s", ext)) + path := filepath.Join(dir, fmt.Sprintf("%s.%s", fileNameWithoutExtension, ext)) _, err := os.Stat(path) if err == nil { // File found diff --git a/ignite/services/plugin/apps_config.go b/ignite/services/plugin/apps_config.go deleted file mode 100644 index 7333867af1..0000000000 --- a/ignite/services/plugin/apps_config.go +++ /dev/null @@ -1,14 +0,0 @@ -package plugin - -// AppsConfig is the structure of app.ignite.yml file. -type AppsConfig struct { - Version uint `yaml:"version"` - Apps map[string]AppInfo `yaml:"apps"` -} - -// AppInfo is the structure of app info in app.ignite.yml file which only holds -// the description and the relative path of the app. -type AppInfo struct { - Description string `yaml:"description"` - Path string `yaml:"path"` -} diff --git a/ignite/services/plugin/cache.go b/ignite/services/plugin/cache.go index c512c38b8d..cb29b32f59 100644 --- a/ignite/services/plugin/cache.go +++ b/ignite/services/plugin/cache.go @@ -32,7 +32,7 @@ func writeConfigCache(pluginPath string, conf hplugin.ReattachConfig) error { return errors.Errorf("provided path is invalid: %s", pluginPath) } if conf.Addr == nil { - return errors.Errorf("app Address info cannot be empty") + return errors.Errorf("Extension Address info cannot be empty") } cache, err := newCache() if err != nil { diff --git a/ignite/services/plugin/config.go b/ignite/services/plugin/config.go new file mode 100644 index 0000000000..417778da78 --- /dev/null +++ b/ignite/services/plugin/config.go @@ -0,0 +1,14 @@ +package plugin + +// ExtensionsConfig is the structure of ext.ignite.yml file. +type ExtensionsConfig struct { + Version uint `yaml:"version"` + Extensions map[string]ExtInfo `yaml:"extensions"` +} + +// ExtInfo is the structure of app info in ext.ignite.yml file which only holds +// the description and the relative path of the app. +type ExtInfo struct { + Description string `yaml:"description"` + Path string `yaml:"path"` +} diff --git a/ignite/services/plugin/interface.go b/ignite/services/plugin/interface.go index 5f4a8492db..9dd5310b1a 100644 --- a/ignite/services/plugin/interface.go +++ b/ignite/services/plugin/interface.go @@ -29,7 +29,7 @@ type ( Manifest = v1.Manifest ) -// Interface defines the interface that all Ignite App must implement. +// Interface defines the interface that all Ignite Extension must implement. // //go:generate mockery --srcpkg . --name Interface --structname PluginInterface --filename interface.go --with-expecter type Interface interface { diff --git a/ignite/services/plugin/plugin.go b/ignite/services/plugin/plugin.go index 6955d14ab7..44f3814424 100644 --- a/ignite/services/plugin/plugin.go +++ b/ignite/services/plugin/plugin.go @@ -33,7 +33,7 @@ import ( // PluginsPath holds the plugin cache directory. var PluginsPath = xfilepath.Mkdir(xfilepath.Join( config.DirPath, - xfilepath.Path("apps"), + xfilepath.Path("extensions"), )) // Plugin represents a ignite plugin. @@ -91,7 +91,7 @@ func RedirectStdout(w io.Writer) Option { // There's 2 kinds of plugins, local or remote. // Local plugins have their path starting with a `/`, while remote plugins don't. // Local plugins are useful for development purpose. -// Remote plugins require to be fetched first, in $HOME/.ignite/apps folder, +// Remote plugins require to be fetched first, in $HOME/.ignite/extensions folder, // then they are loaded from there. // // If an error occurs during a plugin load, it's not returned but rather stored in @@ -133,7 +133,7 @@ func newPlugin(pluginsDir string, cp pluginsconfig.Plugin, options ...Option) *P pluginPath = cp.Path ) if pluginPath == "" { - p.Error = errors.Errorf(`missing app property "path"`) + p.Error = errors.Errorf(`missing extension property "path"`) return p } @@ -157,11 +157,11 @@ func newPlugin(pluginsDir string, cp pluginsconfig.Plugin, options ...Option) *P st, err := os.Stat(pluginPath) if err != nil { - p.Error = errors.Wrapf(err, "local app path %q not found", pluginPath) + p.Error = errors.Wrapf(err, "local extension path %q not found", pluginPath) return p } if !st.IsDir() { - p.Error = errors.Errorf("local app path %q is not a directory", pluginPath) + p.Error = errors.Errorf("local extension path %q is not a directory", pluginPath) return p } p.srcPath = pluginPath @@ -177,7 +177,7 @@ func newPlugin(pluginsDir string, cp pluginsconfig.Plugin, options ...Option) *P } parts := strings.Split(pluginPath, "/") if len(parts) < 3 { - p.Error = errors.Errorf("app path %q is not a valid repository URL", pluginPath) + p.Error = errors.Errorf("extension path %q is not a valid repository URL", pluginPath) return p } p.repoPath = path.Join(parts[:3]...) @@ -192,7 +192,7 @@ func newPlugin(pluginsDir string, cp pluginsconfig.Plugin, options ...Option) *P } // Plugin can have a subpath within its repository. - // For example, "github.com/ignite/apps/app1" where "app1" is the subpath. + // For example, "github.com/ignite/extensions/extension1" where "extension1" is the subpath. repoSubPath := path.Join(parts[3:]...) p.srcPath = path.Join(p.cloneDir, repoSubPath) @@ -273,7 +273,7 @@ func (p *Plugin) load(ctx context.Context) { logLevel = hclog.Trace } logger := hclog.New(&hclog.LoggerOptions{ - Name: fmt.Sprintf("app %s", p.Path), + Name: fmt.Sprintf("extension %s", p.Path), Output: os.Stderr, Level: logLevel, }) @@ -356,8 +356,8 @@ func (p *Plugin) fetch() { if p.Error != nil { return } - p.ev.Send(fmt.Sprintf("Fetching app %q", p.cloneURL), events.ProgressStart()) - defer p.ev.Send(fmt.Sprintf("%s App fetched %q", icons.OK, p.cloneURL), events.ProgressFinish()) + p.ev.Send(fmt.Sprintf("Fetching extension %q", p.cloneURL), events.ProgressStart()) + defer p.ev.Send(fmt.Sprintf("%s Extension fetched %q", icons.OK, p.cloneURL), events.ProgressFinish()) urlref := strings.Join([]string{p.cloneURL, p.reference}, "@") err := xgit.Clone(context.Background(), urlref, p.cloneDir) @@ -371,8 +371,8 @@ func (p *Plugin) build(ctx context.Context) { if p.Error != nil { return } - p.ev.Send(fmt.Sprintf("Building app %q", p.Path), events.ProgressStart()) - defer p.ev.Send(fmt.Sprintf("%s App built %q", icons.OK, p.Path), events.ProgressFinish()) + p.ev.Send(fmt.Sprintf("Building extension %q", p.Path), events.ProgressStart()) + defer p.ev.Send(fmt.Sprintf("%s Extension built %q", icons.OK, p.Path), events.ProgressFinish()) if err := gocmd.ModTidy(ctx, p.srcPath); err != nil { p.Error = errors.Wrapf(err, "go mod tidy") @@ -426,7 +426,7 @@ func (p *Plugin) outdatedBinary() bool { return nil }) if err != nil { - fmt.Printf("error while walking app source path %q\n", p.srcPath) + fmt.Printf("error while walking extension source path %q\n", p.srcPath) return false } return mostRecent.After(binaryTime) diff --git a/ignite/services/plugin/plugin_test.go b/ignite/services/plugin/plugin_test.go index babae27521..a0f003f089 100644 --- a/ignite/services/plugin/plugin_test.go +++ b/ignite/services/plugin/plugin_test.go @@ -34,7 +34,7 @@ func TestNewPlugin(t *testing.T) { { name: "fail: empty path", expectedPlugin: Plugin{ - Error: errors.Errorf(`missing app property "path"`), + Error: errors.Errorf(`missing extension property "path"`), stdout: os.Stdout, stderr: os.Stderr, }, @@ -43,7 +43,7 @@ func TestNewPlugin(t *testing.T) { name: "fail: local plugin doesnt exists", pluginCfg: pluginsconfig.Plugin{Path: "/xxx/yyy/app"}, expectedPlugin: Plugin{ - Error: errors.Errorf(`local app path "/xxx/yyy/app" not found`), + Error: errors.Errorf(`local extension path "/xxx/yyy/app" not found`), stdout: os.Stdout, stderr: os.Stderr, }, @@ -52,7 +52,7 @@ func TestNewPlugin(t *testing.T) { name: "fail: local plugin is not a directory", pluginCfg: pluginsconfig.Plugin{Path: path.Join(wd, "testdata/fakebin")}, expectedPlugin: Plugin{ - Error: errors.Errorf(fmt.Sprintf("local app path %q is not a directory", path.Join(wd, "testdata/fakebin"))), + Error: errors.Errorf(fmt.Sprintf("local extension path %q is not a directory", path.Join(wd, "testdata/fakebin"))), stdout: os.Stdout, stderr: os.Stderr, }, @@ -81,7 +81,7 @@ func TestNewPlugin(t *testing.T) { name: "fail: remote plugin with only domain", pluginCfg: pluginsconfig.Plugin{Path: "github.com"}, expectedPlugin: Plugin{ - Error: errors.Errorf(`app path "github.com" is not a valid repository URL`), + Error: errors.Errorf(`extension path "github.com" is not a valid repository URL`), stdout: os.Stdout, stderr: os.Stderr, }, @@ -90,7 +90,7 @@ func TestNewPlugin(t *testing.T) { name: "fail: remote plugin with incomplete URL", pluginCfg: pluginsconfig.Plugin{Path: "github.com/ignite"}, expectedPlugin: Plugin{ - Error: errors.Errorf(`app path "github.com/ignite" is not a valid repository URL`), + Error: errors.Errorf(`extension path "github.com/ignite" is not a valid repository URL`), stdout: os.Stdout, stderr: os.Stderr, }, @@ -459,10 +459,10 @@ func TestPluginLoadSharedHost(t *testing.T) { for i := len(plugins) - 1; i >= 0; i-- { plugins[i].KillClient() if tt.sharesHost && i > 0 { - assert.False(plugins[i].client.Exited(), "non host app can't kill host app") - assert.True(checkConfCache(plugins[i].Path), "non host app doesn't remove config cache when killed") + assert.False(plugins[i].client.Exited(), "non host extension can't kill host app") + assert.True(checkConfCache(plugins[i].Path), "non host extension doesn't remove config cache when killed") } else { - assert.True(plugins[i].client.Exited(), "app should be killed") + assert.True(plugins[i].client.Exited(), "extension should be killed") } assert.False(plugins[i].isHost, "killed plugins are no longer host") } @@ -475,21 +475,21 @@ func TestPluginLoadSharedHost(t *testing.T) { assert.True(checkConfCache(plugins[i].Path), "sharedHost must have a cache entry") if i == 0 { // first plugin is the host - assert.True(plugins[i].isHost, "first app is the host") + assert.True(plugins[i].isHost, "first extension is the host") // Assert reattach config has been saved hostConf = plugins[i].client.ReattachConfig() ref, err := readConfigCache(plugins[i].Path) if assert.NoError(err) { - assert.Equal(hostConf, &ref, "wrong cache entry for app host") + assert.Equal(hostConf, &ref, "wrong cache entry for extension host") } } else { // plugins after first aren't host - assert.False(plugins[i].isHost, "app %d can't be host", i) + assert.False(plugins[i].isHost, "extension %d can't be host", i) assert.Equal(hostConf, plugins[i].client.ReattachConfig(), "ReattachConfig different from host app") } } else { - assert.False(plugins[i].isHost, "app %d can't be host if sharedHost is disabled", i) - assert.False(checkConfCache(plugins[i].Path), "app %d can't have a cache entry if sharedHost is disabled", i) + assert.False(plugins[i].isHost, "extension %d can't be host if sharedHost is disabled", i) + assert.False(checkConfCache(plugins[i].Path), "extension %d can't have a cache entry if sharedHost is disabled", i) } } }) @@ -515,7 +515,7 @@ func TestPluginClean(t *testing.T) { { name: "ok", plugin: &Plugin{ - cloneURL: "https://github.com/ignite/app", + cloneURL: "https://github.com/ignite/extension", }, expectRemove: true, }, diff --git a/ignite/services/plugin/scaffold.go b/ignite/services/plugin/scaffold.go index d9bbe41181..fa184cb017 100644 --- a/ignite/services/plugin/scaffold.go +++ b/ignite/services/plugin/scaffold.go @@ -21,10 +21,10 @@ import ( //go:embed template/* var fsPluginSource embed.FS -// Scaffold generates a plugin structure under dir/path.Base(appName). -func Scaffold(ctx context.Context, dir, appName string, sharedHost bool) (string, error) { +// Scaffold generates a plugin structure under dir/path.Base(extName). +func Scaffold(ctx context.Context, dir, extName string, sharedHost bool) (string, error) { var ( - name = filepath.Base(appName) + name = filepath.Base(extName) title = toTitle(name) finalDir = path.Join(dir, name) g = genny.New() @@ -45,7 +45,7 @@ func Scaffold(ctx context.Context, dir, appName string, sharedHost bool) (string } pctx := plush.NewContextWithContext(ctx) - pctx.Set("AppName", appName) + pctx.Set("ExtensionName", extName) pctx.Set("Name", name) pctx.Set("Title", title) pctx.Set("SharedHost", sharedHost) diff --git a/ignite/services/plugin/scaffold_test.go b/ignite/services/plugin/scaffold_test.go index 8c48544163..67820cc3e7 100644 --- a/ignite/services/plugin/scaffold_test.go +++ b/ignite/services/plugin/scaffold_test.go @@ -40,7 +40,7 @@ func TestScaffoldedConfig(t *testing.T) { // Assert require.EqualValues(t, 1, cfg.Version) - require.Len(t, cfg.Apps, 1) + require.Len(t, cfg.Extensions, 1) } func TestScaffoldedTests(t *testing.T) { @@ -69,10 +69,10 @@ func scaffoldApp(t *testing.T, ctx context.Context, path string) string { return path } -func readConfig(t *testing.T, path string) (cfg plugin.AppsConfig) { +func readConfig(t *testing.T, path string) (cfg plugin.ExtensionsConfig) { t.Helper() - bz, err := os.ReadFile(filepath.Join(path, "app.ignite.yml")) + bz, err := os.ReadFile(filepath.Join(path, "ext.ignite.yml")) require.NoError(t, err) require.NoError(t, yaml.Unmarshal(bz, &cfg)) return diff --git a/ignite/services/plugin/template/app.ignite.yml.plush b/ignite/services/plugin/template/app.ignite.yml.plush deleted file mode 100644 index d6156a0b80..0000000000 --- a/ignite/services/plugin/template/app.ignite.yml.plush +++ /dev/null @@ -1,6 +0,0 @@ -version: 1 -apps: - <%= Name %>: - description: <%= Name %> is an awesome Ignite application! - path: ./ - \ No newline at end of file diff --git a/ignite/services/plugin/template/cmd/cmd.go.plush b/ignite/services/plugin/template/cmd/cmd.go.plush index db1e658720..fb17e05e76 100644 --- a/ignite/services/plugin/template/cmd/cmd.go.plush +++ b/ignite/services/plugin/template/cmd/cmd.go.plush @@ -2,12 +2,12 @@ package cmd import "github.com/ignite/cli/v29/ignite/services/plugin" -// GetCommands returns the list of <%= Name %> app commands. +// GetCommands returns the list of <%= Name %> extension commands. func GetCommands() []*plugin.Command { return []*plugin.Command{ { Use: "<%= Name %> [command]", - Short: "<%= Name %> is an awesome Ignite application!", + Short: "<%= Name %> is an awesome Ignite extension!", Commands: []*plugin.Command{ { Use: "hello", diff --git a/ignite/services/plugin/template/ext.ignite.yml.plush b/ignite/services/plugin/template/ext.ignite.yml.plush new file mode 100644 index 0000000000..b70591015b --- /dev/null +++ b/ignite/services/plugin/template/ext.ignite.yml.plush @@ -0,0 +1,6 @@ +version: 1 +extensions: + <%= Name %>: + description: <%= Name %> is an awesome Ignite extension! + path: ./ + \ No newline at end of file diff --git a/ignite/services/plugin/template/go.mod.plush b/ignite/services/plugin/template/go.mod.plush index 870feae0bc..c05484a673 100644 --- a/ignite/services/plugin/template/go.mod.plush +++ b/ignite/services/plugin/template/go.mod.plush @@ -1,4 +1,4 @@ -module <%= AppName %> +module <%= ExtensionName %> go 1.21 diff --git a/ignite/services/plugin/template/integration/app_test.go.plush b/ignite/services/plugin/template/integration/extension_test.go.plush similarity index 81% rename from ignite/services/plugin/template/integration/app_test.go.plush rename to ignite/services/plugin/template/integration/extension_test.go.plush index 67db9b656c..8dd61af0df 100644 --- a/ignite/services/plugin/template/integration/app_test.go.plush +++ b/ignite/services/plugin/template/integration/extension_test.go.plush @@ -18,16 +18,16 @@ func Test<%= Title %>(t *testing.T) { var ( require = require.New(t) env = envtest.New(t) - app = env.Scaffold("<%= AppName %>-app") + app = env.Scaffold("<%= ExtensionName %>-app") ) dir, err := os.Getwd() require.NoError(err) pluginPath := filepath.Join(filepath.Dir(filepath.Dir(dir)), "<%= Name %>") - env.Must(env.Exec("install <%= Name %> app locally", + env.Must(env.Exec("install <%= Name %> extension locally", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "app", "install", pluginPath), + step.Exec(envtest.IgniteApp, "extension", "install", pluginPath), // TODO(@julierbrt): rename immeditely in a follow-up once merged step.Workdir(app.SourcePath()), )), )) @@ -44,7 +44,7 @@ func Test<%= Title %>(t *testing.T) { env.Must(env.Exec("run <%= Name %>", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteApp, // TODO(@julierbrt): rename immeditely in a follow-up once merged "<%= Name %>", "hello", ), @@ -60,7 +60,7 @@ func assertLocalPlugins(t *testing.T, app envtest.App, expectedPlugins []plugins t.Helper() cfg, err := pluginsconfig.ParseDir(app.SourcePath()) require.NoError(t, err) - require.ElementsMatch(t, expectedPlugins, cfg.Apps, "unexpected local apps") + require.ElementsMatch(t, expectedPlugins, cfg.Apps, "unexpected local extensions") } func assertGlobalPlugins(t *testing.T, expectedPlugins []pluginsconfig.Plugin) { @@ -69,5 +69,5 @@ func assertGlobalPlugins(t *testing.T, expectedPlugins []pluginsconfig.Plugin) { require.NoError(t, err) cfg, err := pluginsconfig.ParseDir(cfgPath) require.NoError(t, err) - require.ElementsMatch(t, expectedPlugins, cfg.Apps, "unexpected global apps") + require.ElementsMatch(t, expectedPlugins, cfg.Apps, "unexpected global extensions") } diff --git a/ignite/services/plugin/template/main.go.plush b/ignite/services/plugin/template/main.go.plush index 529c3ec2d3..6c46f2a15b 100644 --- a/ignite/services/plugin/template/main.go.plush +++ b/ignite/services/plugin/template/main.go.plush @@ -8,12 +8,12 @@ import ( "github.com/ignite/cli/v29/ignite/services/plugin" - "<%= AppName %>/cmd" + "<%= ExtensionName %>/cmd" ) -type app struct{} +type extn struct{} -func (app) Manifest(_ context.Context) (*plugin.Manifest, error) { +func (extn) Manifest(_ context.Context) (*plugin.Manifest, error) { return &plugin.Manifest{ Name: "<%= Name %>",<%= if (SharedHost) { %> SharedHost: true,<% } %> @@ -21,7 +21,7 @@ func (app) Manifest(_ context.Context) (*plugin.Manifest, error) { }, nil } -func (app) Execute(ctx context.Context, c *plugin.ExecutedCommand, _ plugin.ClientAPI) error { +func (extn) Execute(ctx context.Context, c *plugin.ExecutedCommand, _ plugin.ClientAPI) error { // Remove the first two elements "ignite" and "<%= Name %>" from OsArgs. args := c.OsArgs[2:] @@ -33,15 +33,15 @@ func (app) Execute(ctx context.Context, c *plugin.ExecutedCommand, _ plugin.Clie } } -func (app) ExecuteHookPre(_ context.Context, _ *plugin.ExecutedHook, _ plugin.ClientAPI) error { +func (extn) ExecuteHookPre(_ context.Context, _ *plugin.ExecutedHook, _ plugin.ClientAPI) error { return nil } -func (app) ExecuteHookPost(_ context.Context, _ *plugin.ExecutedHook, _ plugin.ClientAPI) error { +func (extn) ExecuteHookPost(_ context.Context, _ *plugin.ExecutedHook, _ plugin.ClientAPI) error { return nil } -func (app) ExecuteHookCleanUp(_ context.Context, _ *plugin.ExecutedHook, _ plugin.ClientAPI) error { +func (extn) ExecuteHookCleanUp(_ context.Context, _ *plugin.ExecutedHook, _ plugin.ClientAPI) error { return nil } @@ -49,7 +49,7 @@ func main() { hplugin.Serve(&hplugin.ServeConfig{ HandshakeConfig: plugin.HandshakeConfig(), Plugins: map[string]hplugin.Plugin{ - "<%= Name %>": plugin.NewGRPC(&app{}), + "<%= Name %>": plugin.NewGRPC(&extn{}), }, GRPCServer: hplugin.DefaultGRPCServer, }) diff --git a/integration/account/cmd_account_test.go b/integration/account/cmd_account_test.go index efd6058420..73ed8a7fb4 100644 --- a/integration/account/cmd_account_test.go +++ b/integration/account/cmd_account_test.go @@ -23,14 +23,14 @@ func TestAccount(t *testing.T) { env.Must(env.Exec("create account", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "account", "create", accountName, "--keyring-dir", tmpDir), + step.Exec(envtest.IgniteExtension, "account", "create", accountName, "--keyring-dir", tmpDir), )), )) listOutputBuffer := &bytes.Buffer{} env.Must(env.Exec("list accounts", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "account", "list", "--keyring-dir", tmpDir), + step.Exec(envtest.IgniteExtension, "account", "list", "--keyring-dir", tmpDir), )), envtest.ExecStdout(listOutputBuffer), )) @@ -38,14 +38,14 @@ func TestAccount(t *testing.T) { env.Must(env.Exec("delete account", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "account", "delete", accountName, "--keyring-dir", tmpDir), + step.Exec(envtest.IgniteExtension, "account", "delete", accountName, "--keyring-dir", tmpDir), )), )) listOutputAfterDeleteBuffer := &bytes.Buffer{} env.Must(env.Exec("list accounts after delete", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "account", "list", "--keyring-dir", tmpDir), + step.Exec(envtest.IgniteExtension, "account", "list", "--keyring-dir", tmpDir), )), envtest.ExecStdout(listOutputAfterDeleteBuffer), )) @@ -54,7 +54,7 @@ func TestAccount(t *testing.T) { env.Must(env.Exec("import account with mnemonic", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, "account", "import", "testaccount42", + envtest.IgniteExtension, "account", "import", "testaccount42", "--keyring-dir", tmpDir, "--secret", testAccountMnemonic, ), @@ -64,7 +64,7 @@ func TestAccount(t *testing.T) { env.Must(env.Exec("import account with private key", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, "account", "import", "testaccount43", + envtest.IgniteExtension, "account", "import", "testaccount43", "--non-interactive", "--keyring-dir", tmpDir, "--secret", "testdata/key", @@ -76,7 +76,7 @@ func TestAccount(t *testing.T) { listOutputAfterImportBuffer := &bytes.Buffer{} env.Must(env.Exec("list accounts after import", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "account", "list", "--keyring-dir", tmpDir), + step.Exec(envtest.IgniteExtension, "account", "list", "--keyring-dir", tmpDir), )), envtest.ExecStdout(listOutputAfterImportBuffer), )) @@ -89,7 +89,7 @@ testaccount43 cosmos18p4xchk2aqp39nsjwr69ql44upzsfnh8r9lzql PubKeySecp256k1{02 showOutputBuffer := &bytes.Buffer{} env.Must(env.Exec("show account", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "account", "show", "testaccount42", "--keyring-dir", tmpDir), + step.Exec(envtest.IgniteExtension, "account", "show", "testaccount42", "--keyring-dir", tmpDir), )), envtest.ExecStdout(showOutputBuffer), )) @@ -101,7 +101,7 @@ testaccount42 cosmos1ytnkpns7mfd6jjkvq9ztdvjdrt2xvmft2qxzqd PubKeySecp256k1{02 showOutputWithDifferentPrefixBuffer := &bytes.Buffer{} env.Must(env.Exec("show account with address prefix", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "account", "show", "testaccount42", "--keyring-dir", tmpDir, "--address-prefix", "test"), + step.Exec(envtest.IgniteExtension, "account", "show", "testaccount42", "--keyring-dir", tmpDir, "--address-prefix", "test"), )), envtest.ExecStdout(showOutputWithDifferentPrefixBuffer), )) diff --git a/integration/app/cmd_app_test.go b/integration/app/cmd_app_test.go index d576f32e1e..569ebe0b29 100644 --- a/integration/app/cmd_app_test.go +++ b/integration/app/cmd_app_test.go @@ -74,7 +74,7 @@ func TestGenerateAnAppWithNoDefaultModuleAndCreateAModule(t *testing.T) { env.Must(env.Exec("should scaffold a new module into a chain that never had modules before", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "module", "--yes", "first_module"), + step.Exec(envtest.IgniteExtension, "s", "module", "--yes", "first_module"), step.Workdir(app.SourcePath()), )), )) @@ -88,14 +88,14 @@ func TestGenerateAppWithEmptyModule(t *testing.T) { env.Must(env.Exec("create a module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "module", "--yes", "example", "--require-registration"), + step.Exec(envtest.IgniteExtension, "s", "module", "--yes", "example", "--require-registration"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("should prevent creating an existing module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "module", "--yes", "example", "--require-registration"), + step.Exec(envtest.IgniteExtension, "s", "module", "--yes", "example", "--require-registration"), step.Workdir(app.SourcePath()), )), envtest.ExecShouldError(), @@ -103,7 +103,7 @@ func TestGenerateAppWithEmptyModule(t *testing.T) { env.Must(env.Exec("should prevent creating a module with an invalid name", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "module", "--yes", "example1", "--require-registration"), + step.Exec(envtest.IgniteExtension, "s", "module", "--yes", "example1", "--require-registration"), step.Workdir(app.SourcePath()), )), envtest.ExecShouldError(), @@ -111,7 +111,7 @@ func TestGenerateAppWithEmptyModule(t *testing.T) { env.Must(env.Exec("should prevent creating a module with a reserved name", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "module", "--yes", "tx", "--require-registration"), + step.Exec(envtest.IgniteExtension, "s", "module", "--yes", "tx", "--require-registration"), step.Workdir(app.SourcePath()), )), envtest.ExecShouldError(), @@ -119,7 +119,7 @@ func TestGenerateAppWithEmptyModule(t *testing.T) { env.Must(env.Exec("should prevent creating a module with a forbidden prefix", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "module", "--yes", "ibcfoo", "--require-registration"), + step.Exec(envtest.IgniteExtension, "s", "module", "--yes", "ibcfoo", "--require-registration"), step.Workdir(app.SourcePath()), )), envtest.ExecShouldError(), @@ -127,7 +127,7 @@ func TestGenerateAppWithEmptyModule(t *testing.T) { env.Must(env.Exec("should prevent creating a module prefixed with an existing module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "module", "--yes", "examplefoo", "--require-registration"), + step.Exec(envtest.IgniteExtension, "s", "module", "--yes", "examplefoo", "--require-registration"), step.Workdir(app.SourcePath()), )), envtest.ExecShouldError(), @@ -136,7 +136,7 @@ func TestGenerateAppWithEmptyModule(t *testing.T) { env.Must(env.Exec("create a module with dependencies", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "module", "--yes", @@ -152,7 +152,7 @@ func TestGenerateAppWithEmptyModule(t *testing.T) { env.Must(env.Exec("should prevent creating a module with invalid dependencies", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "module", "--yes", @@ -169,7 +169,7 @@ func TestGenerateAppWithEmptyModule(t *testing.T) { env.Must(env.Exec("should prevent creating a module with a non registered dependency", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "module", "--yes", diff --git a/integration/app/cmd_proto_path_test.go b/integration/app/cmd_proto_path_test.go index 6904d478d1..f07846df90 100644 --- a/integration/app/cmd_proto_path_test.go +++ b/integration/app/cmd_proto_path_test.go @@ -95,7 +95,7 @@ func TestChangeProtoPath(t *testing.T) { env.Must(env.Exec("create a list with a custom proto path from config", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "list", "--yes", "listUser", "email"), + step.Exec(envtest.IgniteExtension, "s", "list", "--yes", "listUser", "email"), step.Workdir(app.SourcePath()), )), )) diff --git a/integration/chain/cache_test.go b/integration/chain/cache_test.go index 049cbd2882..2f8a347068 100644 --- a/integration/chain/cache_test.go +++ b/integration/chain/cache_test.go @@ -30,7 +30,7 @@ func TestCliWithCaching(t *testing.T) { env.Must(env.Exec("create a message", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "message", "mymessage", @@ -45,7 +45,7 @@ func TestCliWithCaching(t *testing.T) { env.Must(env.Exec("create a query", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "query", "myQuery", @@ -59,7 +59,7 @@ func TestCliWithCaching(t *testing.T) { env.Must(env.Exec("build", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "c", "build", ), @@ -74,7 +74,7 @@ func TestCliWithCaching(t *testing.T) { env.Must(env.Exec("build", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "c", "build", ), diff --git a/integration/cosmosgen/cosmosgen_composables_test.go b/integration/cosmosgen/cosmosgen_composables_test.go index 79f2695970..1113823bad 100644 --- a/integration/cosmosgen/cosmosgen_composables_test.go +++ b/integration/cosmosgen/cosmosgen_composables_test.go @@ -28,7 +28,7 @@ func TestCosmosGenScaffoldComposables(t *testing.T) { env.Must(env.Exec("add custom module with message", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "module", "--yes", @@ -41,7 +41,7 @@ func TestCosmosGenScaffoldComposables(t *testing.T) { env.Must(env.Exec("create a message", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "message", "--yes", @@ -58,7 +58,7 @@ func TestCosmosGenScaffoldComposables(t *testing.T) { env.Must(env.Exec("add custom module without message", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "module", "--yes", @@ -71,7 +71,7 @@ func TestCosmosGenScaffoldComposables(t *testing.T) { env.Must(env.Exec("create a type", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "type", "--yes", @@ -87,7 +87,7 @@ func TestCosmosGenScaffoldComposables(t *testing.T) { env.Must(env.Exec("create a query", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "query", "--yes", @@ -106,7 +106,7 @@ func TestCosmosGenScaffoldComposables(t *testing.T) { env.Must(env.Exec("generate composables", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "g", "composables", "--yes", diff --git a/integration/cosmosgen/cosmosgen_hooks_test.go b/integration/cosmosgen/cosmosgen_hooks_test.go index d682371257..0a8af758ef 100644 --- a/integration/cosmosgen/cosmosgen_hooks_test.go +++ b/integration/cosmosgen/cosmosgen_hooks_test.go @@ -28,7 +28,7 @@ func TestCosmosGenScaffoldHooks(t *testing.T) { env.Must(env.Exec("add custom module with message", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "module", "--yes", @@ -41,7 +41,7 @@ func TestCosmosGenScaffoldHooks(t *testing.T) { env.Must(env.Exec("create a message", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "message", "--yes", @@ -58,7 +58,7 @@ func TestCosmosGenScaffoldHooks(t *testing.T) { env.Must(env.Exec("add custom module without message", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "module", "--yes", @@ -71,7 +71,7 @@ func TestCosmosGenScaffoldHooks(t *testing.T) { env.Must(env.Exec("create a type", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "type", "--yes", @@ -87,7 +87,7 @@ func TestCosmosGenScaffoldHooks(t *testing.T) { env.Must(env.Exec("create a query", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "query", "--yes", @@ -106,7 +106,7 @@ func TestCosmosGenScaffoldHooks(t *testing.T) { env.Must(env.Exec("generate hooks", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "g", "hooks", "--yes", diff --git a/integration/cosmosgen/cosmosgen_test.go b/integration/cosmosgen/cosmosgen_test.go index 5f347130f1..f368fa5a6f 100644 --- a/integration/cosmosgen/cosmosgen_test.go +++ b/integration/cosmosgen/cosmosgen_test.go @@ -26,7 +26,7 @@ func TestCosmosGenScaffold(t *testing.T) { env.Must(env.Exec("add custom module with message", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "module", "--yes", @@ -39,7 +39,7 @@ func TestCosmosGenScaffold(t *testing.T) { env.Must(env.Exec("create a message", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "message", "--yes", @@ -56,7 +56,7 @@ func TestCosmosGenScaffold(t *testing.T) { env.Must(env.Exec("add custom module without message", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "module", "--yes", @@ -69,7 +69,7 @@ func TestCosmosGenScaffold(t *testing.T) { env.Must(env.Exec("create a type", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "type", "--yes", @@ -85,7 +85,7 @@ func TestCosmosGenScaffold(t *testing.T) { env.Must(env.Exec("create a query", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "query", "--yes", @@ -104,7 +104,7 @@ func TestCosmosGenScaffold(t *testing.T) { env.Must(env.Exec("generate typescript", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "g", "ts-client", "--yes", diff --git a/integration/cosmosgen/custom_module_test.go b/integration/cosmosgen/custom_module_test.go index aaf00f82fe..c8c3f98d68 100644 --- a/integration/cosmosgen/custom_module_test.go +++ b/integration/cosmosgen/custom_module_test.go @@ -51,14 +51,14 @@ func TestCustomModule(t *testing.T) { env.Must(env.Exec("create a module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "module", "disco", "--require-registration", "--yes"), + step.Exec(envtest.IgniteExtension, "s", "module", "disco", "--require-registration", "--yes"), step.Workdir(path), )), )) env.Must(env.Exec("create a list type", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "list", "entry", "name", "--module", "disco", "--yes"), + step.Exec(envtest.IgniteExtension, "s", "list", "entry", "name", "--module", "disco", "--yes"), step.Workdir(path), )), )) diff --git a/integration/doctor/doctor_test.go b/integration/doctor/doctor_test.go index d206b3837d..5f4240403e 100644 --- a/integration/doctor/doctor_test.go +++ b/integration/doctor/doctor_test.go @@ -20,7 +20,7 @@ func TestDoctor(t *testing.T) { Setup: func(env *testscript.Env) error { env.Vars = append(env.Vars, // Pass ignite binary path - "IGNITE="+envtest.IgniteApp, + "IGNITE="+envtest.IgniteExtension, // Pass ignite config dir // (testscript resets envs so even if envtest.New has properly set // IGNT_CONFIG_DIR, we need to set it again) diff --git a/integration/env.go b/integration/env.go index 0101cd43b0..6542c586f5 100644 --- a/integration/env.go +++ b/integration/env.go @@ -28,10 +28,13 @@ const ( ) var ( - // IgniteApp hold the location of the ignite binary used in the integration + // IgniteExtension hold the location of the ignite binary used in the integration // tests. The binary is compiled the first time the env.New() function is // invoked. - IgniteApp = path.Join(os.TempDir(), "ignite-tests", "ignite") + IgniteExtension = path.Join(os.TempDir(), "ignite-tests", "ignite") + + // Alias for IgniteExtension for backward compatibility. + IgniteApp = IgniteExtension isCI, _ = strconv.ParseBool(os.Getenv("CI")) compileBinaryOnce sync.Once diff --git a/integration/plugin/plugin_test.go b/integration/extension/plugin_test.go similarity index 78% rename from integration/plugin/plugin_test.go rename to integration/extension/plugin_test.go index 5a46b20098..8a5a7ad2b7 100644 --- a/integration/plugin/plugin_test.go +++ b/integration/extension/plugin_test.go @@ -23,13 +23,13 @@ func TestAddRemovePlugin(t *testing.T) { assertPlugins = func(expectedLocalPlugins, expectedGlobalPlugins []pluginsconfig.Plugin) { localCfg, err := pluginsconfig.ParseDir(app.SourcePath()) require.NoError(err) - assert.ElementsMatch(expectedLocalPlugins, localCfg.Apps, "unexpected local plugins") + assert.ElementsMatch(expectedLocalPlugins, localCfg.Extensions, "unexpected local plugins") globalCfgPath, err := plugin.PluginsPath() require.NoError(err) globalCfg, err := pluginsconfig.ParseDir(globalCfgPath) require.NoError(err) - assert.ElementsMatch(expectedGlobalPlugins, globalCfg.Apps, "unexpected global plugins") + assert.ElementsMatch(expectedGlobalPlugins, globalCfg.Extensions, "unexpected global plugins") } ) @@ -42,7 +42,7 @@ func TestAddRemovePlugin(t *testing.T) { env.Must(env.Exec("add plugin locally", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "app", "install", pluginRepo, "k1=v1", "k2=v2"), + step.Exec(envtest.IgniteExtension, "extension", "install", pluginRepo, "k1=v1", "k2=v2"), step.Workdir(app.SourcePath()), )), )) @@ -63,7 +63,7 @@ func TestAddRemovePlugin(t *testing.T) { env.Must(env.Exec("uninstall plugin locally", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "app", "uninstall", pluginRepo), + step.Exec(envtest.IgniteExtension, "extension", "uninstall", pluginRepo), step.Workdir(app.SourcePath()), )), )) @@ -73,7 +73,7 @@ func TestAddRemovePlugin(t *testing.T) { env.Must(env.Exec("install plugin globally", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "app", "install", pluginRepo, "-g"), + step.Exec(envtest.IgniteExtension, "extension", "install", pluginRepo, "-g"), step.Workdir(app.SourcePath()), )), )) @@ -90,7 +90,7 @@ func TestAddRemovePlugin(t *testing.T) { env.Must(env.Exec("uninstall plugin globally", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "app", "uninstall", pluginRepo, "-g"), + step.Exec(envtest.IgniteExtension, "extension", "uninstall", pluginRepo, "-g"), step.Workdir(app.SourcePath()), )), )) @@ -106,7 +106,7 @@ func TestPluginScaffold(t *testing.T) { env.Must(env.Exec("install a plugin", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "app", "scaffold", "test"), + step.Exec(envtest.IgniteExtension, "extension", "scaffold", "test"), step.Workdir(env.TmpDir()), )), )) diff --git a/integration/plugin/testdata/example-plugin/go.mod b/integration/extension/testdata/example-plugin/go.mod similarity index 100% rename from integration/plugin/testdata/example-plugin/go.mod rename to integration/extension/testdata/example-plugin/go.mod diff --git a/integration/plugin/testdata/example-plugin/main.go b/integration/extension/testdata/example-plugin/main.go similarity index 100% rename from integration/plugin/testdata/example-plugin/main.go rename to integration/extension/testdata/example-plugin/main.go diff --git a/integration/ibc/cmd_ibc_test.go b/integration/ibc/cmd_ibc_test.go index c749797f92..2a21094815 100644 --- a/integration/ibc/cmd_ibc_test.go +++ b/integration/ibc/cmd_ibc_test.go @@ -17,14 +17,14 @@ func TestCreateModuleWithIBC(t *testing.T) { env.Must(env.Exec("create an IBC module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "module", "--yes", "foo", "--ibc", "--require-registration"), + step.Exec(envtest.IgniteExtension, "s", "module", "--yes", "foo", "--ibc", "--require-registration"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("create an IBC module with custom path", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, + step.Exec(envtest.IgniteExtension, "s", "module", "--yes", @@ -40,7 +40,7 @@ func TestCreateModuleWithIBC(t *testing.T) { env.Must(env.Exec("create a type in an IBC module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "list", "--yes", "user", "email", "--module", "foo"), + step.Exec(envtest.IgniteExtension, "s", "list", "--yes", "user", "email", "--module", "foo"), step.Workdir(app.SourcePath()), )), )) @@ -48,7 +48,7 @@ func TestCreateModuleWithIBC(t *testing.T) { env.Must(env.Exec("create an IBC module with an ordered channel", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "module", "--yes", @@ -65,7 +65,7 @@ func TestCreateModuleWithIBC(t *testing.T) { env.Must(env.Exec("create an IBC module with an unordered channel", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "module", "--yes", @@ -81,7 +81,7 @@ func TestCreateModuleWithIBC(t *testing.T) { env.Must(env.Exec("create a non IBC module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "module", "--yes", "non_ibc", "--require-registration"), + step.Exec(envtest.IgniteExtension, "s", "module", "--yes", "non_ibc", "--require-registration"), step.Workdir(app.SourcePath()), )), )) @@ -89,7 +89,7 @@ func TestCreateModuleWithIBC(t *testing.T) { env.Must(env.Exec("create an IBC module with dependencies", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "module", "--yes", @@ -114,7 +114,7 @@ func TestCreateIBCPacket(t *testing.T) { env.Must(env.Exec("create an IBC module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "module", "--yes", "foo", "--ibc", "--require-registration"), + step.Exec(envtest.IgniteExtension, "s", "module", "--yes", "foo", "--ibc", "--require-registration"), step.Workdir(app.SourcePath()), )), )) @@ -122,7 +122,7 @@ func TestCreateIBCPacket(t *testing.T) { env.Must(env.Exec("create a packet", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "packet", "--yes", @@ -140,7 +140,7 @@ func TestCreateIBCPacket(t *testing.T) { env.Must(env.Exec("should prevent creating a packet with no module specified", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "packet", "--yes", "bar", "text"), + step.Exec(envtest.IgniteExtension, "s", "packet", "--yes", "bar", "text"), step.Workdir(app.SourcePath()), )), envtest.ExecShouldError(), @@ -148,7 +148,7 @@ func TestCreateIBCPacket(t *testing.T) { env.Must(env.Exec("should prevent creating a packet in a non existent module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "packet", "--yes", "bar", "text", "--module", "nomodule"), + step.Exec(envtest.IgniteExtension, "s", "packet", "--yes", "bar", "text", "--module", "nomodule"), step.Workdir(app.SourcePath()), )), envtest.ExecShouldError(), @@ -156,7 +156,7 @@ func TestCreateIBCPacket(t *testing.T) { env.Must(env.Exec("should prevent creating an existing packet", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "packet", "--yes", "bar", "post", "--module", "foo"), + step.Exec(envtest.IgniteExtension, "s", "packet", "--yes", "bar", "post", "--module", "foo"), step.Workdir(app.SourcePath()), )), envtest.ExecShouldError(), @@ -164,7 +164,7 @@ func TestCreateIBCPacket(t *testing.T) { env.Must(env.Exec("create a packet with custom type fields", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, + step.Exec(envtest.IgniteExtension, "s", "packet", "--yes", @@ -190,42 +190,42 @@ func TestCreateIBCPacket(t *testing.T) { env.Must(env.Exec("create a custom field type", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "type", "--yes", "custom-type", "customField:uint", "--module", "foo"), + step.Exec(envtest.IgniteExtension, "s", "type", "--yes", "custom-type", "customField:uint", "--module", "foo"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("create a packet with a custom field type", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "packet", "--yes", "foo-baz", "customField:CustomType", "--module", "foo"), + step.Exec(envtest.IgniteExtension, "s", "packet", "--yes", "foo-baz", "customField:CustomType", "--module", "foo"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("create a packet with no send message", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "packet", "--yes", "nomessage", "foo", "--no-message", "--module", "foo"), + step.Exec(envtest.IgniteExtension, "s", "packet", "--yes", "nomessage", "foo", "--no-message", "--module", "foo"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("create a packet with no field", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "packet", "--yes", "empty", "--module", "foo"), + step.Exec(envtest.IgniteExtension, "s", "packet", "--yes", "empty", "--module", "foo"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("create a non-IBC module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "module", "--yes", "bar", "--require-registration"), + step.Exec(envtest.IgniteExtension, "s", "module", "--yes", "bar", "--require-registration"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("should prevent creating a packet in a non IBC module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "packet", "--yes", "foo", "text", "--module", "bar"), + step.Exec(envtest.IgniteExtension, "s", "packet", "--yes", "foo", "text", "--module", "bar"), step.Workdir(app.SourcePath()), )), envtest.ExecShouldError(), diff --git a/integration/list/cmd_list_test.go b/integration/list/cmd_list_test.go index 2ab790ce52..b315619752 100644 --- a/integration/list/cmd_list_test.go +++ b/integration/list/cmd_list_test.go @@ -17,21 +17,21 @@ func TestGenerateAnAppWithListAndVerify(t *testing.T) { env.Must(env.Exec("create a module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "module", "--yes", "example", "--require-registration"), + step.Exec(envtest.IgniteExtension, "s", "module", "--yes", "example", "--require-registration"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("create a list", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "list", "--yes", "user", "email"), + step.Exec(envtest.IgniteExtension, "s", "list", "--yes", "user", "email"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("create a list with custom path and module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, + step.Exec(envtest.IgniteExtension, "s", "list", "--yes", @@ -48,7 +48,7 @@ func TestGenerateAnAppWithListAndVerify(t *testing.T) { env.Must(env.Exec("create a custom type fields", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, + step.Exec(envtest.IgniteExtension, "s", "list", "--yes", @@ -73,7 +73,7 @@ func TestGenerateAnAppWithListAndVerify(t *testing.T) { env.Must(env.Exec("create a list with bool", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, + step.Exec(envtest.IgniteExtension, "s", "list", "--yes", @@ -88,7 +88,7 @@ func TestGenerateAnAppWithListAndVerify(t *testing.T) { env.Must(env.Exec("create a list with custom field type", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, + step.Exec(envtest.IgniteExtension, "s", "list", "--yes", @@ -103,7 +103,7 @@ func TestGenerateAnAppWithListAndVerify(t *testing.T) { env.Must(env.Exec("should prevent creating a list with duplicated fields", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "list", "--yes", "company", "name", "name"), + step.Exec(envtest.IgniteExtension, "s", "list", "--yes", "company", "name", "name"), step.Workdir(app.SourcePath()), )), envtest.ExecShouldError(), @@ -111,7 +111,7 @@ func TestGenerateAnAppWithListAndVerify(t *testing.T) { env.Must(env.Exec("should prevent creating a list with unrecognized field type", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "list", "--yes", "employee", "level:itn"), + step.Exec(envtest.IgniteExtension, "s", "list", "--yes", "employee", "level:itn"), step.Workdir(app.SourcePath()), )), envtest.ExecShouldError(), @@ -119,7 +119,7 @@ func TestGenerateAnAppWithListAndVerify(t *testing.T) { env.Must(env.Exec("should prevent creating an existing list", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "list", "--yes", "user", "email"), + step.Exec(envtest.IgniteExtension, "s", "list", "--yes", "user", "email"), step.Workdir(app.SourcePath()), )), envtest.ExecShouldError(), @@ -127,7 +127,7 @@ func TestGenerateAnAppWithListAndVerify(t *testing.T) { env.Must(env.Exec("should prevent creating a list whose name is a reserved word", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "list", "--yes", "map", "size:int"), + step.Exec(envtest.IgniteExtension, "s", "list", "--yes", "map", "size:int"), step.Workdir(app.SourcePath()), )), envtest.ExecShouldError(), @@ -135,7 +135,7 @@ func TestGenerateAnAppWithListAndVerify(t *testing.T) { env.Must(env.Exec("should prevent creating a list containing a field with a reserved word", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "list", "--yes", "document", "type:int"), + step.Exec(envtest.IgniteExtension, "s", "list", "--yes", "document", "type:int"), step.Workdir(app.SourcePath()), )), envtest.ExecShouldError(), @@ -143,14 +143,14 @@ func TestGenerateAnAppWithListAndVerify(t *testing.T) { env.Must(env.Exec("create a list with no interaction message", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "list", "--yes", "nomessage", "email", "--no-message"), + step.Exec(envtest.IgniteExtension, "s", "list", "--yes", "nomessage", "email", "--no-message"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("should prevent creating a list in a non existent module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "list", "--yes", "user", "email", "--module", "idontexist"), + step.Exec(envtest.IgniteExtension, "s", "list", "--yes", "user", "email", "--module", "idontexist"), step.Workdir(app.SourcePath()), )), envtest.ExecShouldError(), diff --git a/integration/map/cmd_map_test.go b/integration/map/cmd_map_test.go index ade036b5aa..4f077086de 100644 --- a/integration/map/cmd_map_test.go +++ b/integration/map/cmd_map_test.go @@ -18,28 +18,28 @@ func TestCreateMap(t *testing.T) { env.Must(env.Exec("create a map", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "map", "--yes", "user", "user-id", "email"), + step.Exec(envtest.IgniteExtension, "s", "map", "--yes", "user", "user-id", "email"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("create a map with custom path", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "map", "--yes", "appPath", "email", "--path", filepath.Join(app.SourcePath(), "app")), + step.Exec(envtest.IgniteExtension, "s", "map", "--yes", "appPath", "email", "--path", filepath.Join(app.SourcePath(), "app")), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("create a map with no message", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "map", "--yes", "nomessage", "email", "--no-message"), + step.Exec(envtest.IgniteExtension, "s", "map", "--yes", "nomessage", "email", "--no-message"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("create a module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "module", "--yes", "example", "--require-registration"), + step.Exec(envtest.IgniteExtension, "s", "module", "--yes", "example", "--require-registration"), step.Workdir(app.SourcePath()), )), )) @@ -47,7 +47,7 @@ func TestCreateMap(t *testing.T) { env.Must(env.Exec("create a list", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "list", "--yes", @@ -63,7 +63,7 @@ func TestCreateMap(t *testing.T) { env.Must(env.Exec("should prevent creating a map with a typename that already exist", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "map", "--yes", "user", "email", "--module", "example"), + step.Exec(envtest.IgniteExtension, "s", "map", "--yes", "user", "email", "--module", "example"), step.Workdir(app.SourcePath()), )), envtest.ExecShouldError(), @@ -71,21 +71,21 @@ func TestCreateMap(t *testing.T) { env.Must(env.Exec("create a map in a custom module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "map", "--yes", "mapUser", "email", "--module", "example"), + step.Exec(envtest.IgniteExtension, "s", "map", "--yes", "mapUser", "email", "--module", "example"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("create a map with a custom field type", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "map", "--yes", "mapDetail", "user:MapUser", "--module", "example"), + step.Exec(envtest.IgniteExtension, "s", "map", "--yes", "mapDetail", "user:MapUser", "--module", "example"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("create a map with Coin and []Coin", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, + step.Exec(envtest.IgniteExtension, "s", "map", "--yes", @@ -112,7 +112,7 @@ func TestCreateMap(t *testing.T) { env.Must(env.Exec("create a map with index", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "map", "--yes", @@ -131,7 +131,7 @@ func TestCreateMap(t *testing.T) { env.Must(env.Exec("create a map with invalid index (multi-index)", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "map", "--yes", @@ -150,7 +150,7 @@ func TestCreateMap(t *testing.T) { env.Must(env.Exec("create a map with invalid index (invalid type)", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "map", "--yes", @@ -168,15 +168,15 @@ func TestCreateMap(t *testing.T) { env.Must(env.Exec("create a message and a map with no-message flag to check conflicts", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "message", "--yes", "create-scavenge", "description"), - step.Exec(envtest.IgniteApp, "s", "map", "--yes", "scavenge", "description", "--no-message"), + step.Exec(envtest.IgniteExtension, "s", "message", "--yes", "create-scavenge", "description"), + step.Exec(envtest.IgniteExtension, "s", "map", "--yes", "scavenge", "description", "--no-message"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("should prevent creating a map with an index present in fields", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "map", "--yes", "map_with_invalid_index", "email", "--index", "email"), + step.Exec(envtest.IgniteExtension, "s", "map", "--yes", "map_with_invalid_index", "email", "--index", "email"), step.Workdir(app.SourcePath()), )), envtest.ExecShouldError(), diff --git a/integration/network/network_test.go b/integration/network/network_test.go index 7dbb16f0df..9d0c1c3101 100644 --- a/integration/network/network_test.go +++ b/integration/network/network_test.go @@ -26,7 +26,7 @@ const ( spnModule = "github.com/tendermint/spn" spnRepoURL = "https://" + spnModule spnConfigFile = "config_2.yml" - pluginNetworkRepoURL = "https://" + ignitecmd.PluginNetworkPath + pluginNetworkRepoURL = "https://" + ignitecmd.ExtensionNetworkPath ) // setupSPN executes the following tasks: @@ -46,15 +46,15 @@ func setupSPN(env envtest.Env) string { // Clone the cli-plugin-network with the expected version err := xgit.Clone(context.Background(), pluginNetworkRepoURL, pluginPath) require.NoError(err) - t.Logf("Checkout cli-plugin-revision to ref %q", ignitecmd.PluginNetworkPath) + t.Logf("Checkout cli-plugin-revision to ref %q", ignitecmd.ExtensionNetworkPath) // Add plugin to config env.Must(env.Exec("add plugin network", step.NewSteps(step.New( // NOTE(tb): to test cli-plugin-network locally (can happen during dev) // comment the first line below and uncomment the second, with the // correct path to the plugin. - step.Exec(envtest.IgniteApp, "plugin", "add", "-g", pluginPath), - // step.Exec(envtest.IgniteApp, "plugin", "add", "-g", "/home/tom/src/ignite/cli-plugin-network"), + step.Exec(envtest.IgniteExtension, "plugin", "add", "-g", pluginPath), + // step.Exec(envtest.IgniteExtension, "plugin", "add", "-g", "/home/tom/src/ignite/cli-plugin-network"), )), )) @@ -154,7 +154,7 @@ func TestNetworkPublish(t *testing.T) { // env.Exec("publish planet chain to spn", // step.NewSteps(step.New( // step.Exec( - // envtest.IgniteApp, + // envtest.IgniteExtension, // "network", "chain", "publish", // "https://github.com/ignite/example", // "--local", @@ -210,7 +210,7 @@ func TestNetworkPublishGenesisConfig(t *testing.T) { // env.Exec("publish test chain to spn", // step.NewSteps(step.New( // step.Exec( - // envtest.IgniteApp, + // envtest.IgniteExtension, // "network", "chain", "publish", // "https://github.com/aljo242/test", // "--local", diff --git a/integration/network/request_test.go b/integration/network/request_test.go index 4073cfa610..8b7dcee9fb 100644 --- a/integration/network/request_test.go +++ b/integration/network/request_test.go @@ -39,7 +39,7 @@ func TestNetworkRequestParam(t *testing.T) { // env.Exec("publish planet chain to spn", // step.NewSteps(step.New( // step.Exec( - // envtest.IgniteApp, + // envtest.IgniteExtension, // "network", "chain", "publish", // "https://github.com/ignite/example", // "--local", @@ -52,7 +52,7 @@ func TestNetworkRequestParam(t *testing.T) { // ), // step.New( // step.Exec( - // envtest.IgniteApp, + // envtest.IgniteExtension, // "network", "request", "change-param", // "1", "mint", "mint_denom", "\"bar\"", // "--local", @@ -61,7 +61,7 @@ func TestNetworkRequestParam(t *testing.T) { // ), // step.New( // step.Exec( - // envtest.IgniteApp, + // envtest.IgniteExtension, // "network", "chain", "show", "genesis", // "1", // "--local", diff --git a/integration/other_components/cmd_message_test.go b/integration/other_components/cmd_message_test.go index 98327acfb3..2f2e9abe46 100644 --- a/integration/other_components/cmd_message_test.go +++ b/integration/other_components/cmd_message_test.go @@ -18,7 +18,7 @@ func TestGenerateAnAppWithMessage(t *testing.T) { env.Must(env.Exec("create a message", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "message", "--yes", @@ -36,7 +36,7 @@ func TestGenerateAnAppWithMessage(t *testing.T) { env.Must(env.Exec("create a message with custom path", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "message", "--yes", @@ -56,7 +56,7 @@ func TestGenerateAnAppWithMessage(t *testing.T) { env.Must(env.Exec("should prevent creating an existing message", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "message", "--yes", "do-foo", "bar"), + step.Exec(envtest.IgniteExtension, "s", "message", "--yes", "do-foo", "bar"), step.Workdir(app.SourcePath()), )), envtest.ExecShouldError(), @@ -64,7 +64,7 @@ func TestGenerateAnAppWithMessage(t *testing.T) { env.Must(env.Exec("should prevent creating a message whose name only differs in capitalization", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "message", "--yes", "do-Foo", "bar"), + step.Exec(envtest.IgniteExtension, "s", "message", "--yes", "do-Foo", "bar"), step.Workdir(app.SourcePath()), )), envtest.ExecShouldError(), @@ -72,14 +72,14 @@ func TestGenerateAnAppWithMessage(t *testing.T) { env.Must(env.Exec("create a message with a custom signer name", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "message", "--yes", "do-bar", "bar", "--signer", "bar-doer"), + step.Exec(envtest.IgniteExtension, "s", "message", "--yes", "do-bar", "bar", "--signer", "bar-doer"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("create a custom field type", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, + step.Exec(envtest.IgniteExtension, "s", "type", "--yes", @@ -103,14 +103,14 @@ func TestGenerateAnAppWithMessage(t *testing.T) { env.Must(env.Exec("create a message with the custom field type", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "message", "--yes", "foo-baz", "customField:CustomType"), + step.Exec(envtest.IgniteExtension, "s", "message", "--yes", "foo-baz", "customField:CustomType"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("create a module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "module", "--yes", "foo", "--require-registration"), + step.Exec(envtest.IgniteExtension, "s", "module", "--yes", "foo", "--require-registration"), step.Workdir(app.SourcePath()), )), )) @@ -118,7 +118,7 @@ func TestGenerateAnAppWithMessage(t *testing.T) { env.Must(env.Exec("create a message in a module", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "message", "--yes", diff --git a/integration/other_components/cmd_query_test.go b/integration/other_components/cmd_query_test.go index fcd2134369..a17fbe3473 100644 --- a/integration/other_components/cmd_query_test.go +++ b/integration/other_components/cmd_query_test.go @@ -18,7 +18,7 @@ func TestGenerateAnAppWithQuery(t *testing.T) { env.Must(env.Exec("create a query", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "query", "--yes", @@ -36,7 +36,7 @@ func TestGenerateAnAppWithQuery(t *testing.T) { env.Must(env.Exec("create a query with custom path", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "query", "--yes", @@ -56,7 +56,7 @@ func TestGenerateAnAppWithQuery(t *testing.T) { env.Must(env.Exec("create a paginated query", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "query", "--yes", @@ -74,7 +74,7 @@ func TestGenerateAnAppWithQuery(t *testing.T) { env.Must(env.Exec("create a custom field type", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, + step.Exec(envtest.IgniteExtension, "s", "type", "--yes", @@ -98,14 +98,14 @@ func TestGenerateAnAppWithQuery(t *testing.T) { env.Must(env.Exec("create a query with the custom field type as a response", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "query", "--yes", "foobaz", "-r", "bar:CustomType"), + step.Exec(envtest.IgniteExtension, "s", "query", "--yes", "foobaz", "-r", "bar:CustomType"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("should prevent using custom type in request params", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "query", "--yes", "bur", "bar:CustomType"), + step.Exec(envtest.IgniteExtension, "s", "query", "--yes", "bur", "bar:CustomType"), step.Workdir(app.SourcePath()), )), envtest.ExecShouldError(), @@ -113,14 +113,14 @@ func TestGenerateAnAppWithQuery(t *testing.T) { env.Must(env.Exec("create an empty query", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "query", "--yes", "foobar"), + step.Exec(envtest.IgniteExtension, "s", "query", "--yes", "foobar"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("should prevent creating an existing query", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "query", "--yes", "foo", "bar"), + step.Exec(envtest.IgniteExtension, "s", "query", "--yes", "foo", "bar"), step.Workdir(app.SourcePath()), )), envtest.ExecShouldError(), @@ -128,7 +128,7 @@ func TestGenerateAnAppWithQuery(t *testing.T) { env.Must(env.Exec("create a module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "module", "--yes", "foo", "--require-registration"), + step.Exec(envtest.IgniteExtension, "s", "module", "--yes", "foo", "--require-registration"), step.Workdir(app.SourcePath()), )), )) @@ -136,7 +136,7 @@ func TestGenerateAnAppWithQuery(t *testing.T) { env.Must(env.Exec("create a query in a module", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "query", "--yes", diff --git a/integration/params/cmd_configs_test.go b/integration/params/cmd_configs_test.go index 22c56c4df4..f56d6d55ac 100644 --- a/integration/params/cmd_configs_test.go +++ b/integration/params/cmd_configs_test.go @@ -17,7 +17,7 @@ func TestCreateModuleConfigs(t *testing.T) { env.Must(env.Exec("create a new module with configs", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, + step.Exec(envtest.IgniteExtension, "s", "module", "--yes", @@ -31,7 +31,7 @@ func TestCreateModuleConfigs(t *testing.T) { env.Must(env.Exec("should prevent creating configs field that already exist", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, + step.Exec(envtest.IgniteExtension, "s", "configs", "--yes", @@ -47,7 +47,7 @@ func TestCreateModuleConfigs(t *testing.T) { env.Must(env.Exec("create a new module configs in the foo module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, + step.Exec(envtest.IgniteExtension, "s", "configs", "--yes", @@ -63,7 +63,7 @@ func TestCreateModuleConfigs(t *testing.T) { env.Must(env.Exec("create a new module configs in the mars module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, + step.Exec(envtest.IgniteExtension, "s", "configs", "--yes", diff --git a/integration/params/cmd_params_test.go b/integration/params/cmd_params_test.go index be36823779..85c4117062 100644 --- a/integration/params/cmd_params_test.go +++ b/integration/params/cmd_params_test.go @@ -17,7 +17,7 @@ func TestCreateModuleParameters(t *testing.T) { env.Must(env.Exec("create a new module with parameter", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, + step.Exec(envtest.IgniteExtension, "s", "module", "--yes", @@ -31,7 +31,7 @@ func TestCreateModuleParameters(t *testing.T) { env.Must(env.Exec("should prevent creating parameter field that already exist", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, + step.Exec(envtest.IgniteExtension, "s", "params", "--yes", @@ -47,7 +47,7 @@ func TestCreateModuleParameters(t *testing.T) { env.Must(env.Exec("create a new module parameters in the foo module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, + step.Exec(envtest.IgniteExtension, "s", "params", "--yes", @@ -63,7 +63,7 @@ func TestCreateModuleParameters(t *testing.T) { env.Must(env.Exec("create a new module parameters in the mars module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, + step.Exec(envtest.IgniteExtension, "s", "params", "--yes", diff --git a/integration/readme.md b/integration/readme.md index 93d70bdd79..fd66289b1c 100644 --- a/integration/readme.md +++ b/integration/readme.md @@ -30,7 +30,7 @@ var ( ```go env.Must(env.Exec("create a list with bool", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "list", "--yes", "document", "signed:bool"), + step.Exec(envtest.IgniteExtension, "s", "list", "--yes", "document", "signed:bool"), step.Workdir(path), )), )) @@ -42,7 +42,7 @@ env.EnsureSteady() ```go env.Must(env.Exec("should prevent creating a list with duplicated fields", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "list", "--yes", "company", "name", "name"), + step.Exec(envtest.IgniteExtension, "s", "list", "--yes", "company", "name", "name"), step.Workdir(path), )), envtest.ExecShouldError(), diff --git a/integration/relayer/cmd_relayer_test.go b/integration/relayer/cmd_relayer_test.go index 9cedb817b1..af5370bfed 100644 --- a/integration/relayer/cmd_relayer_test.go +++ b/integration/relayer/cmd_relayer_test.go @@ -291,7 +291,7 @@ func TestBlogIBC(t *testing.T) { env.Must(env.Exec("create an IBC module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, + step.Exec(envtest.IgniteExtension, "s", "module", "blog", @@ -305,7 +305,7 @@ func TestBlogIBC(t *testing.T) { env.Must(env.Exec("create a post type list in an IBC module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, + step.Exec(envtest.IgniteExtension, "s", "list", "post", @@ -322,7 +322,7 @@ func TestBlogIBC(t *testing.T) { env.Must(env.Exec("create a sentPost type list in an IBC module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, + step.Exec(envtest.IgniteExtension, "s", "list", "sentPost", @@ -340,7 +340,7 @@ func TestBlogIBC(t *testing.T) { env.Must(env.Exec("create a timeoutPost type list in an IBC module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, + step.Exec(envtest.IgniteExtension, "s", "list", "timeoutPost", @@ -357,7 +357,7 @@ func TestBlogIBC(t *testing.T) { env.Must(env.Exec("create a ibcPost package in an IBC module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, + step.Exec(envtest.IgniteExtension, "s", "packet", "ibcPost", @@ -428,21 +428,21 @@ func TestBlogIBC(t *testing.T) { env.Exec("waiting the chain is up", stepsCheckChains, envtest.ExecRetry()) // ibc relayer. - env.Must(env.Exec("install the hermes relayer app", + env.Must(env.Exec("install the hermes relayer extensions", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, + step.Exec(envtest.IgniteExtension, "app", "install", "-g", - // filepath.Join(goenv.GoPath(), "src/github.com/ignite/apps/hermes"), // Local path for test proposals + // filepath.Join(goenv.GoPath(), "src/github.com/ignite/extensions/hermes"), // Local path for test proposals "github.com/ignite/apps/hermes@hermes/v0.2.2", ), )), )) - env.Must(env.Exec("configure the hermes relayer app", + env.Must(env.Exec("configure the hermes relayer extensions", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, + step.Exec(envtest.IgniteExtension, "relayer", "hermes", "configure", @@ -463,7 +463,7 @@ func TestBlogIBC(t *testing.T) { go func() { env.Must(env.Exec("run the hermes relayer", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "relayer", "hermes", "start", earthChainID, marsChainID), + step.Exec(envtest.IgniteExtension, "relayer", "hermes", "start", earthChainID, marsChainID), )), envtest.ExecCtx(ctx), )) @@ -626,5 +626,5 @@ func TestBlogIBC(t *testing.T) { // TODO test ibc using the blog post methods: // step.Exec(app.Binary(), "tx", "blog", "send-ibc-post", "transfer", "channel-0", "Hello", "Hello_Mars-Alice_from_Earth", "--chain-id", earthChainID, "--from", "alice", "--node", earthGRPC, "--output", "json", "--log_format", "json", "--yes") // TODO test ibc using the hermes ft-transfer: - // step.Exec(envtest.IgniteApp, "hermes", "exec", "--", "--config", earthConfig, "tx", "ft-transfer", "--timeout-seconds", "1000", "--dst-chain", earthChainID, "--src-chain", marsChainID, "--src-port", "transfer", "--src-channel", "channel-0", "--amount", "100000", "--denom", "stake", "--output", "json", "--log_format", "json", "--yes") + // step.Exec(envtest.IgniteExtension, "hermes", "exec", "--", "--config", earthConfig, "tx", "ft-transfer", "--timeout-seconds", "1000", "--dst-chain", earthChainID, "--src-chain", marsChainID, "--src-port", "transfer", "--src-channel", "channel-0", "--amount", "100000", "--denom", "stake", "--output", "json", "--log_format", "json", "--yes") } diff --git a/integration/simulation/simapp_test.go b/integration/simulation/simapp_test.go index 8d04bf38d1..d120d23682 100644 --- a/integration/simulation/simapp_test.go +++ b/integration/simulation/simapp_test.go @@ -17,35 +17,35 @@ func TestGenerateAnAppAndSimulate(t *testing.T) { env.Must(env.Exec("create a list", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "list", "--yes", "foo", "foobar"), + step.Exec(envtest.IgniteExtension, "s", "list", "--yes", "foo", "foobar"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("create an singleton type", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "single", "--yes", "baz", "foobar"), + step.Exec(envtest.IgniteExtension, "s", "single", "--yes", "baz", "foobar"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("create an singleton type", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "list", "--yes", "noSimapp", "foobar", "--no-simulation"), + step.Exec(envtest.IgniteExtension, "s", "list", "--yes", "noSimapp", "foobar", "--no-simulation"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("create a message", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "message", "--yes", "msgFoo", "foobar"), + step.Exec(envtest.IgniteExtension, "s", "message", "--yes", "msgFoo", "foobar"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("scaffold a new module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "module", "--yes", "new_module"), + step.Exec(envtest.IgniteExtension, "s", "module", "--yes", "new_module"), step.Workdir(app.SourcePath()), )), )) @@ -53,7 +53,7 @@ func TestGenerateAnAppAndSimulate(t *testing.T) { env.Must(env.Exec("create a map", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "s", "map", "--yes", diff --git a/integration/single/cmd_singleton_test.go b/integration/single/cmd_singleton_test.go index c3310fdf09..bb94cd5cbf 100644 --- a/integration/single/cmd_singleton_test.go +++ b/integration/single/cmd_singleton_test.go @@ -17,49 +17,49 @@ func TestCreateSingleton(t *testing.T) { env.Must(env.Exec("create an singleton type", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "single", "--yes", "user", "email"), + step.Exec(envtest.IgniteExtension, "s", "single", "--yes", "user", "email"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("create an singleton type with custom path", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "single", "--yes", "appPath", "email", "--path", app.SourcePath()), + step.Exec(envtest.IgniteExtension, "s", "single", "--yes", "appPath", "email", "--path", app.SourcePath()), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("create an singleton type with no message", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "single", "--yes", "no-message", "email", "--no-message"), + step.Exec(envtest.IgniteExtension, "s", "single", "--yes", "no-message", "email", "--no-message"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("create a module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "module", "--yes", "example", "--require-registration"), + step.Exec(envtest.IgniteExtension, "s", "module", "--yes", "example", "--require-registration"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("create another type", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "list", "--yes", "user", "email", "--module", "example"), + step.Exec(envtest.IgniteExtension, "s", "list", "--yes", "user", "email", "--module", "example"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("create another type with a custom field type", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "list", "--yes", "user-detail", "user:User", "--module", "example"), + step.Exec(envtest.IgniteExtension, "s", "list", "--yes", "user-detail", "user:User", "--module", "example"), step.Workdir(app.SourcePath()), )), )) env.Must(env.Exec("should prevent creating an singleton type with a typename that already exist", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "single", "--yes", "user", "email", "--module", "example"), + step.Exec(envtest.IgniteExtension, "s", "single", "--yes", "user", "email", "--module", "example"), step.Workdir(app.SourcePath()), )), envtest.ExecShouldError(), @@ -67,7 +67,7 @@ func TestCreateSingleton(t *testing.T) { env.Must(env.Exec("create an singleton type in a custom module", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "s", "single", "--yes", "singleuser", "email", "--module", "example"), + step.Exec(envtest.IgniteExtension, "s", "single", "--yes", "singleuser", "email", "--module", "example"), step.Workdir(app.SourcePath()), )), )) diff --git a/integration/tx/tx_test.go b/integration/tx/tx_test.go index a6aad36f9a..c92f8c607e 100644 --- a/integration/tx/tx_test.go +++ b/integration/tx/tx_test.go @@ -39,7 +39,7 @@ func TestSignTxWithDashedAppName(t *testing.T) { step.NewSteps(step.New( step.Workdir(app.SourcePath()), step.Exec( - envtest.IgniteApp, + envtest.IgniteExtension, "scaffold", "list", "item", diff --git a/readme.md b/readme.md index d0308d6795..3f94b6234d 100644 --- a/readme.md +++ b/readme.md @@ -136,36 +136,36 @@ otherwise, a row refers to a minor version and all associated patch versions. To upgrade your blockchain to the newer version of Cosmos SDK, see the [Migration guide](https://docs.ignite.com/migration). -## Ignite Apps +## Ignite Extensions -Ignite Apps aims to extend the functionality of Ignite CLI, offering both official and community-contributed integrations. These integrations are designed to streamline development processes and offer valuable insights for blockchain app developers. +Ignite Extensions aims to extend the functionality of Ignite CLI, offering both official and community-contributed integrations. These integrations are designed to streamline development processes and offer valuable insights for blockchain app developers. -### How to Install an Ignite App +### How to Install an Ignite Extensions ```bash -ignite app install -g github.com/ignite/apps/[app-name] +ignite extension install -g github.com/ignite/extensions/[extension-name] ``` -The `ignite app list` command allows to list the plugins and their status, and to +The `ignite extension list` command allows to list the plugins and their status, and to update a plugin if you need to get the latest version. -### How to Create an App +### How to Create an Extension -Scaffold your Ignite app with one simple command: +Scaffold your Ignite extension with one simple command: ```bash -ignite scaffold app path/to/your/app +ignite scaffold extension path/to/your/extensions ``` Afterwards, install using: ```bash -ignite app install -g path/to/your/app +ignite extension install -g path/to/your/extension ``` -For more information, refer to [Creating Ignite Apps](https://docs.ignite.com/apps/developing-apps). +For more information, refer to [Creating Ignite Extensions](https://docs.ignite.com/apps/developing-apps). -Also check out the section of our [example Apps](https://github.com/ignite/apps/tree/main/examples). +Also check out the section of our [example Extensions](https://github.com/ignite/extensions/tree/main/examples). ## Contributing to Ignite CLI From c8320c55bcf8cda00cd37370478cee89a547eaed Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Wed, 10 Jul 2024 21:57:36 +0200 Subject: [PATCH 2/3] use replaces --- ignite/services/plugin/scaffold_test.go | 3 +-- ignite/services/plugin/template/go.mod.plush | 2 +- .../plugin/template/integration/extension_test.go.plush | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ignite/services/plugin/scaffold_test.go b/ignite/services/plugin/scaffold_test.go index 67820cc3e7..8ee03fed28 100644 --- a/ignite/services/plugin/scaffold_test.go +++ b/ignite/services/plugin/scaffold_test.go @@ -53,8 +53,7 @@ func TestScaffoldedTests(t *testing.T) { err := gocmd.Test(ctx, path, []string{ "-timeout", "10m", - "-run", - "^TestBar$", + "./...", }) // Assert diff --git a/ignite/services/plugin/template/go.mod.plush b/ignite/services/plugin/template/go.mod.plush index c05484a673..087f698598 100644 --- a/ignite/services/plugin/template/go.mod.plush +++ b/ignite/services/plugin/template/go.mod.plush @@ -8,4 +8,4 @@ require ( github.com/stretchr/testify v1.8.4 ) -replace github.com/ignite/cli/v29 => github.com/ignite/cli/v29 main \ No newline at end of file +replace github.com/ignite/cli/v29 => github.com/ignite/cli/v29 v29.0.0-20240710081217-b5c5f1f52d28 // TODO(@julienrbrt) replace by main once merged \ No newline at end of file diff --git a/ignite/services/plugin/template/integration/extension_test.go.plush b/ignite/services/plugin/template/integration/extension_test.go.plush index 8dd61af0df..af8735254e 100644 --- a/ignite/services/plugin/template/integration/extension_test.go.plush +++ b/ignite/services/plugin/template/integration/extension_test.go.plush @@ -27,7 +27,7 @@ func Test<%= Title %>(t *testing.T) { env.Must(env.Exec("install <%= Name %> extension locally", step.NewSteps(step.New( - step.Exec(envtest.IgniteApp, "extension", "install", pluginPath), // TODO(@julierbrt): rename immeditely in a follow-up once merged + step.Exec(envtest.IgniteExtension, "extension", "install", pluginPath), step.Workdir(app.SourcePath()), )), )) @@ -44,7 +44,7 @@ func Test<%= Title %>(t *testing.T) { env.Must(env.Exec("run <%= Name %>", step.NewSteps(step.New( step.Exec( - envtest.IgniteApp, // TODO(@julierbrt): rename immeditely in a follow-up once merged + envtest.IgniteExtension, "<%= Name %>", "hello", ), @@ -60,7 +60,7 @@ func assertLocalPlugins(t *testing.T, app envtest.App, expectedPlugins []plugins t.Helper() cfg, err := pluginsconfig.ParseDir(app.SourcePath()) require.NoError(t, err) - require.ElementsMatch(t, expectedPlugins, cfg.Apps, "unexpected local extensions") + require.ElementsMatch(t, expectedPlugins, cfg.Extensions, "unexpected local extensions") } func assertGlobalPlugins(t *testing.T, expectedPlugins []pluginsconfig.Plugin) { @@ -69,5 +69,5 @@ func assertGlobalPlugins(t *testing.T, expectedPlugins []pluginsconfig.Plugin) { require.NoError(t, err) cfg, err := pluginsconfig.ParseDir(cfgPath) require.NoError(t, err) - require.ElementsMatch(t, expectedPlugins, cfg.Apps, "unexpected global extensions") + require.ElementsMatch(t, expectedPlugins, cfg.Extensions, "unexpected global extensions") } From e38e58abf9b288444a60c4fd5b79725d5c0a41d1 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Thu, 1 Aug 2024 15:46:03 +0200 Subject: [PATCH 3/3] build --- ignite/cmd/extension_default.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ignite/cmd/extension_default.go b/ignite/cmd/extension_default.go index 35cecab54c..06d2d2b869 100644 --- a/ignite/cmd/extension_default.go +++ b/ignite/cmd/extension_default.go @@ -16,10 +16,13 @@ type defaultExtension struct { } const ( - PluginNetworkVersion = "v0.2.2" - PluginNetworkPath = "github.com/ignite/cli-plugin-network@" + PluginNetworkVersion - PluginRelayerVersion = "hermes/v0.2.4" - PluginRelayerPath = "github.com/ignite/apps/hermes@" + PluginRelayerVersion + ExtensionNetworkPath = PluginNetworkPath + ExtensionRelayerPath = PluginRelayerPath + + pluginNetworkVersion = "v0.2.2" + PluginNetworkPath = "github.com/ignite/cli-plugin-network@" + pluginNetworkVersion + pluginRelayerVersion = "hermes/v0.2.4" + PluginRelayerPath = "github.com/ignite/apps/hermes@" + pluginRelayerVersion ) // defaultExtension holds the extensions that are considered trustable and for which