1 个不稳定版本

0.0.0 2019年9月20日

#192#package-manager

MIT 许可证

10KB

请包管理器客户端(核心库)

此软件包为Please包管理器提供轻量级环境中的基本交互功能。如果您正在寻找快速轻松使用此库的CLI,您可能会在这里找到官方实现这里


lib.rs:

关于

欢迎使用请包管理器客户端的文档!本文档将提供有关安装、运行以及可能为该项目(从现在起命名为 please-pm-client)做出贡献所需的所有必要信息。

示例

作为库

安装官方的、虚拟的 test-package 并查看其信息

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)
    );
}

这将安装一个名为 "test-package" 的新软件包,只包含所需的依赖项,并将打印出花哨的输出(如果您想要更详细的输出,请将 [install_package] 中的 is_verbose 设置为 false)。

这是一个基本示例,它没有实现正确的软件包检查(仅打印调试输出 {:?})。

配置示例

基本的 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 说明
  • 有关 binary_pattern 的信息,请参阅这里以获取更复杂的二进制输出的信息。
  • please.toml 所需的唯一部分是 [package] 中的 [build] 以及您的软件包的完整配置。

基本的 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"
    }
}

基本用法

安装客户端

从源代码

  1. 克隆仓库: git clone https://gitlab.com/owez/please-pm-client
  2. 使用 cargo build --release 构建包管理器
  3. 转到 please-pm-client/target/release/ 并复制名为 client-backend 的可执行文件

crates.io

由于此仓库正在积极开发中,目前还没有稳定的 crates.io 发布。目前,请按照指南从源代码构建。

依赖项

~235–480KB
~11K SLoC