An open API service indexing awesome lists of open source software.

https://github.com/foopis23/cc-pack

Very simple package manager for ComputerCraft.
https://github.com/foopis23/cc-pack

cctweaked computercraft minecraft

Last synced: 7 months ago
JSON representation

Very simple package manager for ComputerCraft.

Awesome Lists containing this project

README

          

# cc-pack
Very simple package manager for ComputerCraft.

## Features
- Install packages from remote repositories, URLs, or local files.
- Uninstall packages.
- Manage remote repositories.

## Advantages
- Descriptive error messages.
- Simple package format.
- Easy to create and host packages.

## Installation
```
wget run https://raw.githubusercontent.com/foopis23/cc-pack/refs/heads/main/install.lua
```

## Usage

### add (or install) package

Install a package. Packages can be installed from three different sources:

1. Remote repository:

```
ccp add package_name
```

*When installing by package name, cc-pack will search through configured remote repositories to find the package.*

2. URL:
```
ccp add https://example.com/package.lua
```

3. Local file:
```
ccp add file://path/to/package.lua
```

### rm (or uninstall) package

Remove an installed package.

```
ccp rm
```

### remote

Manage remote package repositories.

```
ccp remote
```

Available remote commands:

#### add

Add a remote package repository.

```
ccp remote add
```

#### rm

Remove a remote package repository.

```
ccp remote rm
```

#### list

List all configured remote repositories.

```
ccp remote list
```

## Creating a Package
### Package Format

Packages are Lua files that return a table with the following structure:

```lua
{
name = "package_name", -- required: string
version = "1.0.0", -- optional: string (defaults to "0.0.0")
description = "Description", -- optional: string (defaults to "No description provided.")
author = "Author Name", -- optional: string (defaults to "Unknown")
base_path = "https://...", -- required: string - base URL for file downloads
file_map = { -- required: table mapping remote files to local paths
["/remote/path/file1.lua"] = "/local/path/file1.lua",
["/remote/path/file2.lua"] = "/local/path/file2.lua"
}
}
```

### Example Package

Here's an example package definition that installs from a GitHub repository:

```lua
-- example_package.lua
return {
name = "example_package",
version = "1.0.0",
description = "An example package for testing.",
author = "Garfeud",
base_path = "https://raw.githubusercontent.com/Space-Boy-Industries/unicornpkg-repo/refs/heads/main",
file_map = {
["/sbi_software/startup.lua"] = "/startup/99_sbs_startup.lua",
},
}
```

*As of right now, packages are resolved by file name, not by the name field in the package table. This means that if you have a package file named `example_package.lua`, it will be installed as `example_package` regardless of the name field in the package table.*

## Creating a Remote Repository
A remote repository is just a web server that hosts packages at a specific URL. The package manager will look for packages in the following format:

```
https:///.lua
```

### Github as a Remote Repository
You can use GitHub to host your packages. Just create a new repository and add your package files. The package manager will be able to access them using the raw URL.

Base url format:
```
https://raw.githubusercontent.com///refs/heads/
```

## Configuration

The package manager uses ComputerCraft's settings API for configuration. Available settings:

### Logging

Configure the logging level using the `cc-pack.log_level` setting:

```
set cc-pack.log_level
```

Log levels:
- 0 = DEBUG (verbose output)
- 1 = INFO (default, normal output)
- 2 = WARN (warnings only)
- 3 = ERROR (errors only)