Welcome to the implementation guide for integrating the pxpm package manager into your PxPlus project. Follow these steps to seamlessly incorporate the package manager into your project(s).
To start using pxpm in your project, you need to initialize it. Open your terminal and navigate to your project's root directory. Run the following command:
pxpm init
This command sets up pxpm configurations within your project, creating the necessary files. The initialization process also establishes the location where the vendor folder, containing all the installed packages, will be stored.
Note: It's recommended to initialize pxpm in your root project directory. However, you can also initialize it in a different directory. Just make sure to set the correct prefix path when configuring pxpm later.
After initializing pxpm, it's essential to set a prefix for the pxpm vendor folder. Follow these steps to set the prefix in your PxPlus project:
Open your PxPlus script.
Add the following line to set the prefix, adjusting the path based on your project structure:
PREFIX "C:\Users\TheWizard\Documents\pxplus-project\vendor\"
Make sure to replace the path with the actual path to your project's vendor folder.
This step ensures that pxpm knows where to locate and manage the installed packages within your project.
As a quick verification step, we will install an example package to ensure your installation and setup are correct for future package installations. Run the following command:
pxpm install astecom/example
This installs the "astecom/example" package into your project, and you can use it to verify that your setup is working correctly later on.
After successfully installing the "astecom/example" package, you can now integrate it into your PxPlus project. Below is an example script on how to utilize the package:
! Define the vendor folder prefix
PREFIX "C:\Users\TheWizard\Documents\pxplus-project\vendor\"
BEGIN
! Create an instance of the "astecom\example\example" class
LET EXAMPLE = NEW("astecom\example\example")
! Call the TEST method from the example package
EXAMPLE'TEST()
END
This script does the following:
Define Prefix:
PREFIX "C:\Users\TheWizard\Documents\pxplus-project\vendor\"
: Sets the prefix path for the pxpm vendor folder.Instantiate Example Class:
LET EXAMPLE = NEW("astecom\example\example")
: Creates an instance of the "astecom\example\example" class from the installed package.Call TEST Method:
EXAMPLE'TEST()
: Calls the TEST
method from the example package.By following this structure, you can integrate any installed package into your PxPlus project. Replace "astecom\example\example" with the appropriate package path and class to use it in a real scenario.
Remember to set the correct vendor folder prefix and adjust the package path based on your project's structure.