plugify  1.0.0.0
Plugify Documentation

Welcome to Plugify, a modular plugin system designed for extensibility and flexibility. This documentation provides guidelines on creating language modules for Plugify.

Integrating with Package Manager

Package Manager Overview

Plugify seamlessly integrates with a package manager, a tool that automates the process of installing, upgrading, configuring, and removing packages (plugins and language modules) in a consistent manner. Each plugin and language module is considered a package, and the package manager simplifies the management of these components.

Package Information

Every plugin and language module contains information about itself in an update URL section. The update URL is a path to a JSON file structured like this:

{
"content": {
"sample_plugin": {
"name": "Sample Plugin",
"type": "plugin",
"author": "untrustedmodders",
"description": "An example plugin",
"versions": [
{
"version": 1,
"checksum": "5db1fee4b5703808c48078a76768b155b421b210c0761cd6a5d223f4d99f1eaa",
"download": "https://github.com/untrustedmodders/sample_plugin/releases/download/v1.0/csharp-lang-module.zip",
"platforms": []
}
]
}
}
}

Configuration Parameters

  • name: The name of the plugin or language module.
  • type: The type of the package.
  • author: The author or creator of the package.
  • description: A brief description of the package.
  • versions: An array containing information about available versions.
    • version: The version number of the package.
    • checksum: Checksum for verification (optional).
    • download: URL for downloading the package.
    • platforms: Platforms supported by the package.

Package Manager Usage

Package managers can leverage this information to facilitate various tasks:

  • Listing Available Versions: Show available versions for updating or downgrading.
  • Dependency Resolution: Resolve dependencies during installation or update.
  • Platform Compatibility: Ensure compatibility with the user's platform.

By providing structured package information, users can manage plugins and language modules efficiently using their preferred package manager.

Controlling the Package Manager

To control the package manager, you need to access the IPackageManager from IPlugifyProvider. The IPlugifyProvider interface, representing the provider for Plugify, allows you to interact with various components of the system, including the package manager.

Accessing IPackageManager

To access the package manager, obtain a reference to it through the IPlugifyProvider. Once you have a reference, you can control and manage packages using the provided methods.

// Accessing IPackageManager from IPlugifyProvider
std::shared_ptr<IPlugify> plugify = MakePlugify();
std::weak_ptr<IPlugifyProvider> provider = plugify->GetProvider();
std::shared_ptr<IPackageManager> packageManager = provider.lock()->GetPackageManager();

Considerations

Before interacting with the package manager, ensure that the plugin manager is unloaded. Loaded plugins may hold files in use, preventing certain operations like removal or modification. Additionally, it is recommended to perform these operations in a controlled environment.

// Example: Accessing IPackageManager through IPlugifyProvider
auto packageManager = plugifyProvider.GetPackageManager();
if (packageManager.Initialize()) {
// Perform package management operations
packageManager.InstallPackage("example_plugin");
// ...
} else {
// Handle package manager initialization failure
// ...
}

Package Types

Plugins and language modules in Plugify have specific package types:

  • Plugin Package Type:
    • Plugins should have the package type set to "plugin" in the package information.
  • Language Module Package Type:
    • Language modules should specify their language name in the "type" parameter of the package information.

By adhering to these package type guidelines, you ensure that each package is correctly identified and processed by the package manager in Plugify.