0.0.0 |
|
---|
#292 in #package-manager
10KB
Please Package Manager Client (Core libraries)
This package provides the basic interactivity for the Please Package Manager in a lightweight enviroment. If you are searching for the CLI to quickly and easily use this library, you may find the official implementation here.
lib.rs
:
About
Welcome to the documentation for the Please Package Manager client! This
documentation will provide all of the nessecary information to install, run
and prehaps contribute to this project (named please-pm-client
from here
on).
Examples
As a library
Install the official, dummy test-package
and view the infomation for it:
use please_pm_client::{get_package_info, install_package};
fn main() {
println!(
"NEW PACKAGE INSTALLED:\n\n{:?}",
install_package("test-package".to_string(), false, false)
);
println!(
"INFO:\n\n{:?}",
get_package_info("test-package".to_string(), false)
);
}
This will install a new package named "test-package" with only the required
dependencies and will print a fancy output (set is_verbose
to false
in
[install_package] if you want a more verbose output).
This is a basic example and such, it does not implamented the proper
package checking (only debug prints {:?}
).
Config examples
Basic please.toml
:
[package] # Basic package metadata
name = "my-test-package" # Name of package (Not optional)
description = "This is a small test package. The name of this should be like-this" # Package description
icon = "logo.png" # The icon file
readme = "README.md" # The readme file
[dependencies]
[dependencies.required] # Required dependencies
node = "4.6.3"
flask = "2.0.4"
[dependencies.optional] # Optional dependencies that user can choose to install
python3 = "9.4.2"
[dependencies.build] # Build dependencies. This will not be uploaded to the api but is a shortcut for a build script
git = "1.0.2"
docker = "5.7.2"
[build]
build_script = "build.sh" # The bash build script (Not optional)
launch_script = "launch.sh" # The launch script that determines how it will run after building
binary_dir = "build/" # The directory where binaries are produced from build_script
binary_pattern = "a.out|my_build" # Regex parsing to get the proper files.
please.toml
notes
- For
binary_pattern
, please see here for more information for more complicated binary outputs. - The only required parts of
please.toml
are thename
in[package]
and the full[build]
for your package.
Basic please.json
{
"package": {
"name": "my-test-package",
"description": "This is a small test package. The name of this should be like-this",
"icon": "logo.png",
"readme": "README.md"
},
"dependencies": {
"optional": {
"python3": "9.4.2"
},
"build": {
"git": "1.0.2",
"docker": "5.7.2"
},
"required": {
"node": "4.6.3",
"flask": "2.0.4"
}
},
"build": {
"build_script": "build.sh",
"launch_script": "launch.sh",
"binary_dir": "build/",
"binary_pattern": "a.out|my_build"
}
}
Basic usage
Installing the Client
From source
- Clone the repository:
git clone https://gitlab.com/owez/please-pm-client
- Build the package manager with
cargo build --release
- Head to
please-pm-client/target/release/
and copy the executable namedclient-backend
From crates.io
As this repository is under heavy development, there is currently not a stable crates.io release. For now, please build it from source using this guide.
Dependencies
~230–470KB
~10K SLoC