[][src]Crate please_pm

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 the name 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

  1. Clone the repository: git clone https://gitlab.com/owez/please-pm-client
  2. Build the package manager with cargo build --release
  3. Head to please-pm-client/target/release/ and copy the executable named client-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.

Enums

ErrorKind

Main error enum for Please Package Manager. For more infomation on each type of Error, please view each of their individual docs.

Traits

StringRep

A simple trait for allowing the use of representing something as a string in an easy and extendible way.

Functions

get_package_info

Gets correctly-formatted infomation on a selected package by.

install_package

Installs a package with the given name (package_name).

publish_package

Publishes a given package path (must be package root & a valid package tree) to the Please Package Manager API.

remove_package

Removes a given package_name. This function will not succeed if the package is not installed or is a dependancy (optional or otherwise) to another package.