diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f946194..f3fcc82 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,6 @@ name: CI on: { push: { branches: [master] } } +permissions: write-all jobs: build_linux_android_windows: runs-on: ubuntu-latest @@ -20,49 +21,42 @@ jobs: sudo apt-get install musl-tools musl musl-dev wget -q https://musl.cc/riscv64-linux-musl-cross.tgz && tar -zxvf riscv64-linux-musl-cross.tgz wget -q https://musl.cc/aarch64-linux-musl-cross.tgz && tar -zxvf aarch64-linux-musl-cross.tgz - ./build.sh clean && BIN=lpm.riscv64-linux CC=`pwd`/riscv64-linux-musl-cross/bin/riscv64-linux-musl-cc AR=`pwd`/riscv64-linux-musl-cross/bin/riscv64-linux-musl-ar ./build.sh -DLPM_STATIC -DLPM_VERSION='"'$FULL_VERSION-riscv64-linux'"' -static -O3 - ./build.sh clean && BIN=lpm.aarch64-linux CC=`pwd`/aarch64-linux-musl-cross/bin/aarch64-linux-musl-cc AR=`pwd`/aarch64-linux-musl-cross/bin/aarch64-linux-musl-ar ./build.sh -DLPM_STATIC -DLPM_VERSION='"'$FULL_VERSION-aarch64-linux'"' -static -O3 - ./build.sh clean && BIN=lpm.x86_64-linux CC=musl-gcc ./build.sh -DLPM_STATIC -DLPM_VERSION='"'$FULL_VERSION-x86_64-linux'"' -static -O3 - - name: Run Tests - run: | - cp ./lpm.x86_64-linux lpm && ./lpm test t/run.lua + ./build.sh clean && BIN=ppm.riscv64-linux CC=`pwd`/riscv64-linux-musl-cross/bin/riscv64-linux-musl-cc AR=`pwd`/riscv64-linux-musl-cross/bin/riscv64-linux-musl-ar ./build.sh -DPPM_STATIC -DPPM_VERSION='"'$FULL_VERSION-riscv64-linux'"' -static -O3 + ./build.sh clean && BIN=ppm.aarch64-linux CC=`pwd`/aarch64-linux-musl-cross/bin/aarch64-linux-musl-cc AR=`pwd`/aarch64-linux-musl-cross/bin/aarch64-linux-musl-ar ./build.sh -DPPM_STATIC -DPPM_VERSION='"'$FULL_VERSION-aarch64-linux'"' -static -O3 + ./build.sh clean && BIN=ppm.x86_64-linux CC=musl-gcc ./build.sh -DPPM_STATIC -DPPM_VERSION='"'$FULL_VERSION-x86_64-linux'"' -static -O3 + # - name: Run Tests + # run: | + # cp ./ppm.x86_64-linux ppm && ./ppm test t/run.lua - name: Build Android env: { ANDROID_ABI_VERSION: "26" } run: | export CMAKE_DEFAULT_FLAGS="-DCMAKE_ANDROID_NDK=$ANDROID_NDK_HOME -DCMAKE_ANDROID_API=$ANDROID_ABI_VERSION -DCMAKE_SYSTEM_VERSION=$ANDROID_ABI_VERSION -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=NEVER -DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSTEM_INCLUDE_PATH=$ANDROID_SYSROOT_NDK/sysroot/usr/include" export AR="$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar" - ./build.sh clean && export ARCH="arm-android" && CFLAGS="-Dinline=" BIN=lpm.$ARCH CMAKE_DEFAULT_FLAGS="$CMAKE_DEFAULT_FLAGS -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a" CC=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi$ANDROID_ABI_VERSION-clang ./build.sh -DLPM_VERSION='"'$FULL_VERSION-$ARCH'"' -DLPM_STATIC - ./build.sh clean && export ARCH="aarch64-android" && CFLAGS="-Dinline=" BIN=lpm.$ARCH CMAKE_DEFAULT_FLAGS="$CMAKE_DEFAULT_FLAGS -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a" CC=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android$ANDROID_ABI_VERSION-clang ./build.sh -DLPM_VERSION='"'$FULL_VERSION-$ARCH'"' -DLPM_STATIC - ./build.sh clean && export ARCH="x86-android" && CFLAGS="-Dinline=" BIN=lpm.$ARCH CMAKE_DEFAULT_FLAGS="$CMAKE_DEFAULT_FLAGS -DCMAKE_ANDROID_ARCH_ABI=x86" CC=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android$ANDROID_ABI_VERSION-clang ./build.sh -DLPM_VERSION='"'$FULL_VERSION-$ARCH'"' -DLPM_STATIC - ./build.sh clean && export ARCH="x86_64-android" && CFLAGS="-Dinline=" BIN=lpm.$ARCH CMAKE_DEFAULT_FLAGS="$CMAKE_DEFAULT_FLAGS -DCMAKE_ANDROID_ARCH_ABI=x86_64" CC=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android$ANDROID_ABI_VERSION-clang ./build.sh -DLPM_VERSION='"'$FULL_VERSION-$ARCH'"' -DLPM_STATIC + ./build.sh clean && export ARCH="arm-android" && CFLAGS="-Dinline=" BIN=ppm.$ARCH CMAKE_DEFAULT_FLAGS="$CMAKE_DEFAULT_FLAGS -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a" CC=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi$ANDROID_ABI_VERSION-clang ./build.sh -DPPM_VERSION='"'$FULL_VERSION-$ARCH'"' -DPPM_STATIC + ./build.sh clean && export ARCH="aarch64-android" && CFLAGS="-Dinline=" BIN=ppm.$ARCH CMAKE_DEFAULT_FLAGS="$CMAKE_DEFAULT_FLAGS -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a" CC=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android$ANDROID_ABI_VERSION-clang ./build.sh -DPPM_VERSION='"'$FULL_VERSION-$ARCH'"' -DPPM_STATIC + ./build.sh clean && export ARCH="x86-android" && CFLAGS="-Dinline=" BIN=ppm.$ARCH CMAKE_DEFAULT_FLAGS="$CMAKE_DEFAULT_FLAGS -DCMAKE_ANDROID_ARCH_ABI=x86" CC=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android$ANDROID_ABI_VERSION-clang ./build.sh -DPPM_VERSION='"'$FULL_VERSION-$ARCH'"' -DPPM_STATIC + ./build.sh clean && export ARCH="x86_64-android" && CFLAGS="-Dinline=" BIN=ppm.$ARCH CMAKE_DEFAULT_FLAGS="$CMAKE_DEFAULT_FLAGS -DCMAKE_ANDROID_ARCH_ABI=x86_64" CC=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android$ANDROID_ABI_VERSION-clang ./build.sh -DPPM_VERSION='"'$FULL_VERSION-$ARCH'"' -DPPM_STATIC # - name: Package Debian/Ubuntu - # env: { ARCH: "amd64", DESCRIPTION: "A plugin manager for the lite-xl text editor.", MAINTAINER: "Adam Harrison " } + # env: { ARCH: "amd64", DESCRIPTION: "A plugin manager for the pragtical text editor.", MAINTAINER: "Adam Harrison " } # run: | - # export NAME=lpm_$VERSION.0-$REV""_$ARCH - # mkdir -p $NAME/usr/bin $NAME/DEBIAN && cp lpm $NAME/usr/bin - # printf "Package: lpm\nVersion: $VERSION\nArchitecture: $ARCH\nMaintainer: $MAINTAINER\nDescription: $DESCRIPTION\n" > $NAME/DEBIAN/control + # export NAME=ppm_$VERSION.0-$REV""_$ARCH + # mkdir -p $NAME/usr/bin $NAME/DEBIAN && cp ppm $NAME/usr/bin + # printf "Package: ppm\nVersion: $VERSION\nArchitecture: $ARCH\nMaintainer: $MAINTAINER\nDescription: $DESCRIPTION\n" > $NAME/DEBIAN/control # dpkg-deb --build --root-owner-group $NAME - name: Build Windows run: | - sudo apt-get install mingw-w64 && ./build.sh clean && BIN=lpm.x86_64-windows.exe CC=x86_64-w64-mingw32-gcc AR=x86_64-w64-mingw32-gcc-ar WINDRES=x86_64-w64-mingw32-windres CMAKE_DEFAULT_FLAGS="-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=NEVER -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_INCLUDE_PATH=/usr/share/mingw-w64/include" LZMA_CONFIGURE="--host=x86_64-w64-mingw32" GIT2_CONFIGURE="-DDLLTOOL=x86_64-w64-mingw32-dlltool" ./build.sh -DLPM_STATIC -DLPM_VERSION='"'$VERSION-x86_64-windows'"' -O3 + sudo apt-get install mingw-w64 && ./build.sh clean && BIN=ppm.x86_64-windows.exe CC=x86_64-w64-mingw32-gcc AR=x86_64-w64-mingw32-gcc-ar WINDRES=x86_64-w64-mingw32-windres CMAKE_DEFAULT_FLAGS="-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=NEVER -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_INCLUDE_PATH=/usr/share/mingw-w64/include" LZMA_CONFIGURE="--host=x86_64-w64-mingw32" GIT2_CONFIGURE="-DDLLTOOL=x86_64-w64-mingw32-dlltool" ./build.sh -DPPM_STATIC -DPPM_VERSION='"'$VERSION-x86_64-windows'"' -O3 - name: Create Release(s) - env: { GITHUB_TOKEN: "${{ github.token }}", ARTIFACTS: "lpm.x86_64-linux lpm.aarch64-linux lpm.riscv64-linux lpm.x86_64-windows.exe lpm.arm-android lpm.aarch64-android lpm.x86-android lpm.x86_64-android" } + env: { GITHUB_TOKEN: "${{ github.token }}", ARTIFACTS: "ppm.x86_64-linux ppm.aarch64-linux ppm.riscv64-linux ppm.x86_64-windows.exe ppm.arm-android ppm.aarch64-android ppm.x86-android ppm.x86_64-android" } run: | perl -pe 'last if $_ =~ m/^\s*#/ && $_ !~ m/#\s*$ENV{VERSION}/' < CHANGELOG.md | tail -n +2 > NOTES.md gh release delete -y continuous || true; gh release create -t 'Continuous Release' -F NOTES.md continuous $ARTIFACTS - if [[ `git tag --points-at HEAD v* | head -c 1` == "v" ]]; then + if git tag --points-at HEAD | tail -n1 | grep "^v"; then gh release delete -y v$VERSION || true; gh release create -t v$VERSION -F NOTES.md v$VERSION $ARTIFACTS gh release delete -y latest || true; gh release create -t latest -F NOTES.md latest $ARTIFACTS fi - - name: Discord Notification - env: { DISCORD_WEBHOOK: "${{ secrets.DISCORD_WEBHOOK }}" } - run: | - if [[ `git tag --points-at HEAD v* | head -c 1` == "v" ]]; then - perl -e 'use JSON qw(encode_json from_json); $/ = undef; print encode_json({ content => "## Lite XL Plugin Manager $ENV{VERSION} has been released!\nhttps://github.com/lite-xl/lite-xl-plugin-manager/releases/tag/v$ENV{VERSION}\n@release:lpm\n### Changes in $ENV{VERSION}:\n" . <> })' < NOTES.md | - curl -H 'Content-Type:application/json' $DISCORD_WEBHOOK -X POST -d "$( Add a source repository. + ppm repo list List all extant repos. + ppm [repo] add Add a source repository. [...] - lpm [repo] rm Remove a source repository. + ppm [repo] rm Remove a source repository. [...] - lpm [repo] update [] Update all/the specified repos. + ppm [repo] update [] Update all/the specified repos. [...] - lpm [plugin|library|color] install Install specific addons. + ppm [plugin|library|color] install Install specific addons. [:] If installed, upgrades. [...:] - lpm [plugin|library|color] uninstall Uninstall the specific addon. + ppm [plugin|library|color] uninstall Uninstall the specific addon. [...] - lpm [plugin|library|color] reinstall Uninstall and installs the specific addon. + ppm [plugin|library|color] reinstall Uninstall and installs the specific addon. [...] - lpm [plugin|library|color] list List all/associated addons. + ppm [plugin|library|color] list List all/associated addons. [...] - lpm upgrade Upgrades all installed addons + ppm upgrade Upgrades all installed addons to new version if applicable. - lpm [lite-xl] install Installs lite-xl. Infers the + ppm [pragtical] install Installs pragtical. Infers the [binary] [datadir] paths on your system if not supplied. Automatically switches to be your system default if path auto inferred. - lpm lite-xl add Adds a local version of lite-xl to + ppm pragtical add Adds a local version of pragtical to the managed list, allowing it to be easily bottled. - lpm lite-xl remove Removes a local version of lite-xl + ppm pragtical remove Removes a local version of pragtical from the managed list. - lpm [lite-xl] switch [] Sets the active version of lite-xl + ppm [pragtical] switch [] Sets the active version of pragtical to be the specified version. Auto-detects - current install of lite-xl; if none found + current install of pragtical; if none found path can be specified. - lpm lite-xl list [name pattern] Lists all installed versions of - [...filters] lite-xl. Can specify the flags listed + ppm pragtical list [name pattern] Lists all installed versions of + [...filters] pragtical. Can specify the flags listed in the filtering seciton. - lpm run [...addons] Sets up a "bottle" to run the specified - lite version, with the specified addons + ppm run [...addons] Sets up a "bottle" to run the specified + pragtical version, with the specified addons and then opens it. - lpm describe [bottle] Describes the bottle specified in the form + ppm describe [bottle] Describes the bottle specified in the form of a list of commands, that allow someone else to run your configuration. - lpm table [readme path] Formats a markdown table of all specified + ppm table [readme path] Formats a markdown table of all specified addons. Dumps to stdout normally, but if supplied a readme, will remove all tables from the readme, and append the new one. - lpm purge Completely purge all state for LPM. - lpm - Read these commands from stdin in + ppm purge Completely purge all state for PPM. + ppm - Read these commands from stdin in an interactive print-eval loop. - lpm help Displays this help text. + ppm help Displays this help text. Flags have the following effects: --json Performs all communication in JSON. - --userdir=directory Sets the lite-xl userdir manually. - If omitted, uses the normal lite-xl logic. + --userdir=directory Sets the pragtical userdir manually. + If omitted, uses the normal pragtical logic. --cachedir=directory Sets the directory to store all repositories. --tmpdir=directory During install, sets the staging area. --datadir=directory Sets the data directory where core addons are located - for the system lite-xl. - --binary=path Sets the lite-xl binary path for the system lite-xl. + for the system pragtical. + --binary=path Sets the pragtical binary path for the system pragtical. --verbose Spits out more information, including intermediate steps to install and whatnot. --quiet Outputs nothing but explicit responses. - --mod-version=version Sets the mod version of lite-xl to install addons. + --mod-version=version Sets the mod version of pragtical to install addons. --version Returns version information. --help Displays this help text. --ssl-certs Sets the SSL certificate store. Can be a directory, @@ -344,12 +344,12 @@ in any circumstance unless explicitly supplied. There exist also other debug commands that are potentially useful, but are not commonly used publically. - lpm test [test file] Runs the specified test suite. - lpm table [...filters] Generates markdown table for the given + ppm test [test file] Runs the specified test suite. + ppm table [...filters] Generates markdown table for the given manifest. Used by repositories to build READMEs. - lpm download [target] Downloads the specified URL to stdout, + ppm download [target] Downloads the specified URL to stdout, or to the specified target file. - lpm extract Extracts the specified archive at + ppm extract Extracts the specified archive at [target] target, or the current working directory. ``` diff --git a/LICENSE b/LICENSE index 808d59d..140052b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ -## LPM License +## PPM License -Copyright (c) 2022 lite-xl Team +Copyright (c) 2022 pragtical Team Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/README.md b/README.md index 07182a1..729c85f 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,19 @@ -# Lite XL Plugin Manager (lpm) +**Warning:** This repository could be regularly rebased + +# Pragtical Plugin Manager (ppm) ![image](https://user-images.githubusercontent.com/1034518/216748882-3ae8c8d4-a767-4d97-acc4-c1cde7e3e331.png) A standalone binary that provides an easy way of installing, and uninstalling -plugins from lite-xl, as well as different version of lite-xl. +plugins from pragtical, as well as different version of pragtical. Can be used by a package manager plugin that works from inside the editor and calls this binary. -Also contains a `plugin_manager.lua` plugin to integrate the binary with lite-xl in +Also contains a `plugin_manager.lua` plugin to integrate the binary with pragtical in the form of an easy-to-use GUI. -By default in releases, `lpm` will automatically consume the `manifest.json` +By default in releases, `ppm` will automatically consume the `manifest.json` in the `latest` branch of this repository, which corresponds to the most recent versioned release. @@ -19,26 +21,26 @@ Conforms to [SCPS3](https://github.com/adamharrison/straightforward-c-project-st ## Status -`lpm` 1.0 has been just released, and so may still contain bugs, but is generally feature-complete. +`ppm` 1.0 has been just released, and so may still contain bugs, but is generally feature-complete. ## Specification -For details about the `manifest.json` files that `lpm` consumes, +For details about the `manifest.json` files that `ppm` consumes, [see here](SPEC.md). ## Quickstart -The fastest way to get started with lpm is to simply pull a release. +The fastest way to get started with ppm is to simply pull a release. ``` -wget https://github.com/lite-xl/lite-xl-plugin-manager/releases/download/latest/lpm.x86_64-linux -O lpm && chmod +x lpm +wget https://github.com/pragtical/plugin-manager/releases/download/latest/ppm.x86_64-linux -O ppm && chmod +x ppm ``` -If you want to get the GUI version installed with lite-xl, you can tell `lpm` to install `plugin_manager`, which will allow -you to access `Plugin Manager: Show` in the command palette in `lite-xl`. +If you want to get the GUI version installed with pragtical, you can tell `ppm` to install `plugin_manager`, which will allow +you to access `Plugin Manager: Show` in the command palette in `pragtical`. ``` -./lpm install plugin_manager --assume-yes +./ppm install plugin_manager --assume-yes ``` ### Compilation @@ -47,38 +49,38 @@ If you have a C compiler, and `git`, and want to compile from scratch, you can do: ``` -git clone https://github.com/lite-xl/lite-xl-plugin-manager.git \ - --shallow-submodules --recurse-submodules && cd lite-xl-plugin-manager &&\ - ./build.sh -DLPM_STATIC && ./lpm +git clone https://github.com/pragtical/plugin-manager.git \ + --shallow-submodules --recurse-submodules && cd plugin-manager &&\ + ./build.sh -DPPM_STATIC && ./ppm ```` If you want to build it quickly, and have the right modules installed, you can do: ``` -./build.sh -lgit2 -lzip -llua -lm -lmbedtls -lmbedx509 -lmbedcrypto -lz -DLPM_STATIC +./build.sh -lgit2 -lzip -llua -lm -lmbedtls -lmbedx509 -lmbedcrypto -lz -DPPM_STATIC ``` OR ``` -gcc src/lpm.c lib/microtar/src/microtar.c -Ilib/microtar/src -lz -lgit2 \ - -lzip -llua -lm -lmbedtls -lmbedx509 -lmbedcrypto -o lpm +gcc src/ppm.c lib/microtar/src/microtar.c -Ilib/microtar/src -lz -lgit2 \ + -lzip -llua -lm -lmbedtls -lmbedx509 -lmbedcrypto -o ppm ``` CI is enabled on this repository, so you can grab Windows and Linux builds from the -`continuous` [release page](https://github.com/lite-xl/lite-xl-plugin-manager/releases/tag/continuous), -which is a nightly, or the `latest` [release page](https://github.com/lite-xl/lite-xl-plugin-manager/releases/tag/latest), +`continuous` [release page](https://github.com/pragtical/plugin-manager/releases/tag/continuous), +which is a nightly, or the `latest` [release page](https://github.com/pragtical/plugin-manager/releases/tag/latest), which holds the most recent released version. There are also tagged releases, for specified versions. -You can get a feel for how to use `lpm` by typing `./lpm --help`. +You can get a feel for how to use `ppm` by typing `./ppm --help`. -You can also use `scoop` to grab `lpm`, courtesy of @cvladan: +You can also use `scoop` to grab `ppm`, courtesy of @cvladan: ``` -scoop install https://gist.githubusercontent.com/cvladan/416c1945c9e446a6fc64ba766d6ee4ef/raw/lite-xl-plugin-manager.json +scoop install https://gist.githubusercontent.com/cvladan/416c1945c9e446a6fc64ba766d6ee4ef/raw/plugin-manager.json ``` Please note, that _meson_ is _not_ necessarily the best way to compile `lpm`. If you have troubles with it, please do consider using the build.sh script. @@ -86,7 +88,7 @@ Please note, that _meson_ is _not_ necessarily the best way to compile `lpm`. If ## Supporting Libraries / Dependencies As seen in the `lib` folder, the following external libraries are used to -build `lpm` as git submodules: +build `ppm` as git submodules: * `lua` (core program written in) * `mbedtls` (https/SSL support) @@ -95,12 +97,12 @@ build `lpm` as git submodules: * `libzip` (for unpacking .zip files) * `libmicrotar` (for unpacking .tar.gz files) -To build, `lpm` only requires a C compiler. To run the underlying build process +To build, `ppm` only requires a C compiler. To run the underlying build process for `mbedtls` and `libgit2`, `cmake` is also required. ## Supported Platforms -`lpm` should work on all platforms `lite-xl` works on; but releases are offered for the following: +`ppm` should work on all platforms `pragtical` works on; but releases are offered for the following: * Windows x86_64 * Linux x86_64 @@ -118,23 +120,23 @@ Experimental support (i.e. doesn't work) exists for the following platforms: ## Use in CI -To make pre-fab lite builds, you can easily use `lpm` in CI. If you had a linux build container, you could do something like: +To make pre-fab pragtical builds, you can easily use `ppm` in CI. If you had a linux build container, you could do something like: ```sh -curl https://github.com/adamharrison/lite-xl-plugin-manager/releases/download/v0.1/lpm.x86_64-linux > lpm -export LITE_USERDIR=lite-xl/data && export LPM_CACHE=/tmp/cache -./lpm add https://github.com/adamharrison/lite-xl-plugin-manager && ./lpm install plugin_manager lsp +curl https://github.com/pragtical/plugin-manager/releases/download/v0.1/ppm.x86_64-linux > ppm +export PRAGTICAL_USERDIR=pragtical/data && export PPM_CACHE=/tmp/cache +./ppm add https://github.com/pragtical/plugin-manager && ./ppm install plugin_manager lsp ``` ## Usage ```sh -lpm install aligncarets -lpm uninstall aligncarets +ppm install aligncarets +ppm uninstall aligncarets ``` ```sh -lpm --help +ppm --help ``` ## Building & Running @@ -142,7 +144,7 @@ lpm --help ### Linux & MacOS & Windows MSYS ``` -./build.sh clean && ./build.sh -DLPM_STATIC && ./lpm +./build.sh clean && ./build.sh -DPPM_STATIC && ./ppm ``` ### Linux -> Windows @@ -150,12 +152,12 @@ lpm --help ``` ./build.sh clean && CC=x86_64-w64-mingw32-gcc AR=x86_64-w64-mingw32-gcc-ar WINDRES=x86_64-w64-mingw32-windres \ CMAKE_DEFAULT_FLAGS="-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER\ -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=NEVER -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_INCLUDE_PATH=/usr/share/mingw-w64/include"\ - GIT2_CONFIGURE="-DDLLTOOL=x86_64-w64-mingw32-dlltool" ./build.sh -DLPM_STATIC -DLPM_VERSION='"'$VERSION-x86_64-windows-`git rev-parse --short HEAD`'"' + GIT2_CONFIGURE="-DDLLTOOL=x86_64-w64-mingw32-dlltool" ./build.sh -DPPM_STATIC -DPPM_VERSION='"'$VERSION-x86_64-windows-`git rev-parse --short HEAD`'"' ``` ## Tests -To run the test suite, you can use `lpm` to execute the test by doing `./lpm test t/run.lua`. use `FAST=1 ./lpm test t/run.lua` to avoid the costs of tearing down and building up suites each time. +To run the test suite, you can use `ppm` to execute the test by doing `./ppm test t/run.lua`. use `FAST=1 ./ppm test t/run.lua` to avoid the costs of tearing down and building up suites each time. ## Extra Features @@ -172,5 +174,5 @@ An array of files to be marked as executable (after extraction, if applicable). If you find a bug, please create an issue with the following information: * Your operating system. -* The commit or version of LPM you're using (`lpm --version` for releases). -* The exact steps to reproduce in LPM invocations, if possible from a fresh LPM install (targeting an empty folder with `--userdir`). +* The commit or version of PPM you're using (`ppm --version` for releases). +* The exact steps to reproduce in PPM invocations, if possible from a fresh PPM install (targeting an empty folder with `--userdir`). diff --git a/SPEC.md b/SPEC.md index c6b2c57..699f3c3 100644 --- a/SPEC.md +++ b/SPEC.md @@ -1,17 +1,17 @@ # Manifest Specification -A lite-xl manifest is a JSON file containing three different keys: +A pragtical manifest is a JSON file containing three different keys: * Remotes * Addons -* Lite-XLs +* Pragticals ## Remotes A simple array of string repository identifiers. A repository identifier takes the form of a git remote url, i.e. `:`. An example would be: -`https://github.com/lite-xl/lite-xl-plugin-manager.git:latest` +`https://github.com/pragtical/plugin-manager.git:latest` ## Addons @@ -107,7 +107,7 @@ can also optionally contain the `arch` and `path` keys. * `checksum` is the sha256hex checksum for the file. If `"SKIP"` is specified, the check is skipped. This is fine for development purposes, but any publically accessible manifest, should specify a checksum. -* `arch` is the lite-xl/clang architecture tuple that the file is relevant for. +* `arch` is the pragtical/clang architecture tuple that the file is relevant for. if omitted, file is to be assumed to be valid for all arhcitectures. Can be an array. * `path` is the location to install this file inside the addon's directory. * `optional` is a boolean that determines whether the file is an optional addition; @@ -116,20 +116,20 @@ can also optionally contain the `arch` and `path` keys. If a file is an archive, of either `.zip`, `.gz` or `.tar.gz`, it will automatically be extracted inside the addon's directory. -## Lite-XLs +## Pragticals -Lite-XLs represent different version of lite-xl that are registered in this -repository. Lite-XLs has the following metadata, as well as a `files` array. +Pragticals represent different version of pragtical that are registered in this +repository. Pragticals has the following metadata, as well as a `files` array. * `version`: A version specifier. Must take the form of x.x(.x)(-suffix). - Suffixes can be used to denote different flavours of lite-xl. + Suffixes can be used to denote different flavours of pragtical. * `mod_version`: The modversion the binary corresponds to. ### Files The files array is identical to that of the `files` array under `addons`. Conventionally, there should be a single file per architecture that is a -`.tar.gz` or `.zip` containing all necessary files for `lite-xl` to run. +`.tar.gz` or `.zip` containing all necessary files for `pragtical` to run. ## Version Specifiers @@ -145,7 +145,7 @@ that any version greater than `0.1` can be used. { "id": "plugin_manager", # Unique name, used to reference the plugin. "version": "0.1", # Semantic version. - "description": "A GUI interface to the Adam's lite plugin manager.", # English description of the plugin. + "description": "A GUI interface to the Adam's pragtical plugin manager.", # English description of the plugin. "path": "plugins/plugin_manager", # The path to the plugin in this repository. "mod_version": "3", # The mod_version this plugin corresponds to. "provides": [ # A list of small strings that represent functionalities this plugin provides. @@ -153,12 +153,12 @@ that any version greater than `0.1` can be used. ], "files": [ # A list of files (usually binaries) this plugin requires to function. { - "url": "https://github.com/adamharrison/lite-xl-plugin-manager/releases/download/v0.1/lpm.x86_64-linux", # A publically accessible URL to download from. - "arch": "x86_64-linux", # The lite-xl/clang target tuple that represents the architecture this file is for. + "url": "https://github.com/pragtical/plugin-manager/releases/download/v0.1/ppm.x86_64-linux", # A publically accessible URL to download from. + "arch": "x86_64-linux", # The pragtical/clang target tuple that represents the architecture this file is for. "checksum": "d27f03c850bacdf808436722cd16e2d7649683e017fe6267934eeeedbcd21096" # the sha256hex checksum that corresponds to this file. }, { - "url": "https://github.com/adamharrison/lite-xl-plugin-manager/releases/download/v0.1/lpm.x86_64-windows.exe", + "url": "https://github.com/pragtical/plugin-manager/releases/download/v0.1/ppm.x86_64-windows.exe", "arch": "x86_64-windows", "checksum": "2ed993ed4376e1840b0824d7619f2d3447891d3aa234459378fcf9387c4e4680" } @@ -195,7 +195,7 @@ that any version greater than `0.1` can be used. "description": "Syntax for .gitignore, .dockerignore and some other `.*ignore` files", "version": "1.0", "mod_version": "3", - "remote": "https://github.com/anthonyaxenov/lite-xl-ignore-syntax:2ed993ed4376e1840b0824d7619f2d3447891d3aa234459378fcf9387c4e4680", # The remote to be used for this plugin. + "remote": "https://github.com/anthonyaxenov/pragtical-ignore-syntax:2ed993ed4376e1840b0824d7619f2d3447891d3aa234459378fcf9387c4e4680", # The remote to be used for this plugin. "id": "language_ignore", "post": {"x86-linux":"cp language_ignore.lua /tmp/somewhere-else", "x86-windows":"COPY language_ignore.lua C:\\Users\\Someone\\ignore.lua"} # Post download steps to run to fully set up the plugin. Does not run by default, requires --post. }, @@ -212,26 +212,26 @@ that any version greater than `0.1` can be used. }, { "description": "Syntax for Kaitai struct files", - "url": "https://raw.githubusercontent.com/whiteh0le/lite-plugins/main/plugins/language_ksy.lua?raw=1", # URL directly to the singleton plugin file. + "url": "https://raw.githubusercontent.com/whiteh0le/pragtical-plugins/main/plugins/language_ksy.lua?raw=1", # URL directly to the singleton plugin file. "id": "language_ksy", "version": "1.0", "mod_version": "3", "checksum": "08a9f8635b09a98cec9dfca8bb65f24fd7b6585c7e8308773e7ddff9a3e5a60f", # Checksum for this particular URL. } ], - "lite-xls": [ # An array of lite-xl releases. + "pragticals": [ # An array of pragtical releases. { "version": "2.1-simplified", # The version, followed by a release suffix defining the release flavour. The only releases that are permitted to not have suffixes are official relases. "mod_version": "3", # The mod_version this release corresponds to. "files": [ # Identical to `files` under `addons`, although these are usually simply archives to be extracted. { "arch": "x86_64-linux", - "url": "https://github.com/adamharrison/lite-xl-simplified/releases/download/v2.1/lite-xl-2.1.0-simplified-x86_64-linux.tar.gz", + "url": "https://github.com/adamharrison/lite-xl-simplified/releases/download/v2.1/pragtical-2.1.0-simplified-x86_64-linux.tar.gz", "checksum": "b5087bd03fb491c9424485ba5cb16fe3bb0a6473fdc801704e43f82cdf960448" }, { "arch": "x86_64-windows", - "url": "https://github.com/adamharrison/lite-xl-simplified/releases/download/v2.1/lite-xl-2.1.0-simplified-x86_64-windows.zip", + "url": "https://github.com/adamharrison/lite-xl-simplified/releases/download/v2.1/pragtical-2.1.0-simplified-x86_64-windows.zip", "checksum": "f12cc1c172299dd25575ae1b7473599a21431f9c4e14e73b271ff1429913275d" } ] @@ -242,21 +242,20 @@ that any version greater than `0.1` can be used. "files": [ { "arch": "x86_64-linux", - "url": "https://github.com/adamharrison/lite-xl-simplified/releases/download/v2.1/lite-xl-2.1.0-simplified-x86_64-linux-enhanced.tar.gz", + "url": "https://github.com/adamharrison/lite-xl-simplified/releases/download/v2.1/pragtical-2.1.0-simplified-x86_64-linux-enhanced.tar.gz", "checksum": "4625c7aac70a2834ef5ce5ba501af2d72d203441303e56147dcf8bcc4b889e40" }, { "arch": "x86_64-windows", - "url": "https://github.com/adamharrison/lite-xl-simplified/releases/download/v2.1/lite-xl-2.1.0-simplified-x86_64-windows-enhanced.zip", + "url": "https://github.com/adamharrison/lite-xl-simplified/releases/download/v2.1/pragtical-2.1.0-simplified-x86_64-windows-enhanced.zip", "checksum": "5ac009e3d5a5c99ca7fbd4f6b5bd4e25612909bf59c0925eddb41fe294ce28a4" } ] } ], "remotes": [ # A list of remote specifiers. The plugin manager will pull these in and add them as additional repositories if specified to do so with a flag. - "https://github.com/lite-xl/lite-xl-plugins.git:2.1", + "https://github.com/pragtical/plugins.git:2.1", "https://github.com/adamharrison/lite-xl-simplified.git:v2.1" ] } ``` - diff --git a/build.sh b/build.sh index cd8c67a..9117e2a 100755 --- a/build.sh +++ b/build.sh @@ -3,14 +3,14 @@ : ${CC=gcc} : ${AR=ar} : ${MAKE=make} -: ${BIN=lpm} +: ${BIN=ppm} : ${JOBS=4} SRCS="src/*.c" CFLAGS="$CFLAGS -Ilib/prefix/include" LDFLAGS="$LDFLAGS -lm -Llib/prefix/lib" -[[ "$@" == "clean" ]] && rm -rf lib/libgit2/build lib/zlib/build lib/libzip/build lib/mbedtls/build lib/prefix lua $BIN *.exe src/lpm.luac src/lpm.lua.c && exit 0 +[[ "$@" == "clean" ]] && rm -rf lib/libgit2/build lib/zlib/build lib/libzip/build lib/mbedtls/build lib/prefix lua $BIN *.exe src/ppm.luac src/ppm.lua.c && exit 0 cmake --version >/dev/null 2>/dev/null || { echo "Please ensure that you have cmake installed." && exit -1; } # Build supporting libraries, libz, libmbedtls, libmbedcrypto, libgit2, libzip, libmicrotar, liblua @@ -38,9 +38,9 @@ fi [[ "$@" != *"-llua"* ]] && CFLAGS="$CFLAGS -Ilib/lua -DMAKE_LIB=1" && SRCS="$SRCS lib/lua/onelua.c" # Build the pre-packaged lua file into the executbale. -if [[ "$@" == *"-DLPM_STATIC"* ]]; then +if [[ "$@" == *"-DPPM_STATIC"* ]]; then [[ ! -e "lua.exe" ]] && { gcc -Ilib/lua -o lua.exe lib/lua/onelua.c -lm || exit -1; } - ./lua.exe -e 'io.open("src/lpm.lua.c", "wb"):write("unsigned char lpm_luac[] = \""..string.dump(loadfile("src/lpm.lua")):gsub(".",function(c) return string.format("\\x%02X",string.byte(c)) end).."\";unsigned int lpm_luac_len = sizeof(lpm_luac)-1;")' + ./lua.exe -e 'io.open("src/ppm.lua.c", "wb"):write("unsigned char ppm_luac[] = \""..string.dump(loadfile("src/ppm.lua")):gsub(".",function(c) return string.format("\\x%02X",string.byte(c)) end).."\";unsigned int ppm_luac_len = sizeof(ppm_luac)-1;")' fi [[ $OSTYPE != 'msys'* && $CC != *'mingw'* && $CC != "emcc" ]] && CFLAGS="$CFLAGS -DLUA_USE_LINUX" && LDFLAGS="$LDFLAGS -ldl" diff --git a/libraries/json.lua b/libraries/json.lua index c463440..805550b 100644 --- a/libraries/json.lua +++ b/libraries/json.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 +-- mod-version:3 --pragtical 2.1 -- -- json.lua -- diff --git a/manifest.json b/manifest.json index f21d73e..495f9be 100644 --- a/manifest.json +++ b/manifest.json @@ -3,60 +3,61 @@ { "id": "plugin_manager", "version": "0.1", - "description": "A GUI interface to Adam's lite-xl plugin manager.", + "description": "A GUI interface to Adam's pragtical plugin manager.", + "type": "plugin", "path": "plugins/plugin_manager", "mod_version": 3, "files": [ { - "url": "https://github.com/lite-xl/lite-xl-plugin-manager/releases/download/latest/lpm.x86_64-linux", + "url": "https://github.com/pragtical/plugin-manager/releases/download/latest/ppm.x86_64-linux", "arch": "x86_64-linux", "checksum": "SKIP", "optional": true }, { - "url": "https://github.com/lite-xl/lite-xl-plugin-manager/releases/download/latest/lpm.aarch64-linux", + "url": "https://github.com/pragtical/plugin-manager/releases/download/latest/ppm.aarch64-linux", "arch": "aarch64-linux", "checksum": "SKIP", "optional": true }, { - "url": "https://github.com/lite-xl/lite-xl-plugin-manager/releases/download/latest/lpm.x86_64-windows.exe", + "url": "https://github.com/pragtical/plugin-manager/releases/download/latest/ppm.x86_64-windows.exe", "arch": "x86_64-windows", "checksum": "SKIP", "optional": true }, { - "url": "https://github.com/lite-xl/lite-xl-plugin-manager/releases/download/latest/lpm.x86_64-darwin", + "url": "https://github.com/pragtical/plugin-manager/releases/download/latest/ppm.x86_64-darwin", "arch": "x86_64-darwin", "checksum": "SKIP", "optional": true }, { - "url": "https://github.com/lite-xl/lite-xl-plugin-manager/releases/download/latest/lpm.aarch64-darwin", + "url": "https://github.com/pragtical/plugin-manager/releases/download/latest/ppm.aarch64-darwin", "arch": "aarch64-darwin", "checksum": "SKIP", "optional": true }, { - "url": "https://github.com/lite-xl/lite-xl-plugin-manager/releases/download/latest/lpm.aarch64-android", + "url": "https://github.com/pragtical/plugin-manager/releases/download/latest/ppm.aarch64-android", "arch": "aarch64-android", "checksum": "SKIP", "optional": true }, { - "url": "https://github.com/lite-xl/lite-xl-plugin-manager/releases/download/latest/lpm.arm-android", + "url": "https://github.com/pragtical/plugin-manager/releases/download/latest/ppm.arm-android", "arch": "arm-android", "checksum": "SKIP", "optional": true }, { - "url": "https://github.com/lite-xl/lite-xl-plugin-manager/releases/download/latest/lpm.x86-android", + "url": "https://github.com/pragtical/plugin-manager/releases/download/latest/ppm.x86-android", "arch": "x86-android", "checksum": "SKIP", "optional": true }, { - "url": "https://github.com/lite-xl/lite-xl-plugin-manager/releases/download/latest/lpm.x86_64-android", + "url": "https://github.com/pragtical/plugin-manager/releases/download/latest/ppm.x86_64-android", "arch": "x86_64-android", "checksum": "SKIP", "optional": true @@ -84,31 +85,8 @@ "path": "libraries/json.lua" } ], - "lite-xls": [ - { - "version": "2.1.1-simplified", - "mod_version": 3, - "files": [ - { - "arch": "x86_64-linux", - "url": "https://github.com/adamharrison/lite-xl-simplified/releases/download/v2.1.1-simplified/lite-xl-v2.1.1-simplified-x86_64-linux.tar.gz", - "checksum": "6a0589cf822e04563330bcf4d26b70be9a59ac268fbbd15073ae45ebb292917e" - }, - { - "arch": "x86_64-windows", - "url": "https://github.com/adamharrison/lite-xl-simplified/releases/download/v2.1.1-simplified/lite-xl-v2.1.1-simplified-x86_64-windows.zip", - "checksum": "15aca182dbf3768c6f9366d3715cca2154b1a1fbce8d79794aa350f9e24ca2bf" - }, - { - "arch": "x86_64-darwin", - "url": "https://github.com/adamharrison/lite-xl-simplified/releases/download/v2.1.1-simplified/lite-xl-v2.1.1-simplified-x86_64-darwin.tar.gz", - "checksum": "222f227adede48eb41fe98a800e3c67256a48ba2cc68bc8a9cce36ff9866e26c" - } - ] - } - ], "remotes": [ - "https://github.com/lite-xl/lite-xl-plugins.git:master", - "https://github.com/lite-xl/lite-xl-colors.git:master" + "https://github.com/pragtical/plugins.git:master", + "https://github.com/pragtical/colors.git:master" ] } diff --git a/meson.build b/meson.build index 39e83dc..807a980 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,7 @@ -project('lpm', +project('ppm', ['c'], - license : 'LPM', + license : 'PPM', + version : '1.2.0', meson_version : '>= 0.56', ) @@ -37,18 +38,18 @@ microtar_dep = declare_dependency( include_directories: ['lib/microtar/src'] ) -lpm_source = files('src/lpm.c') +ppm_source = files('src/ppm.c') cflags = [] if get_option('static') lua_exe = find_program('lua') - lpm_source += configure_file( + ppm_source += configure_file( capture: false, - command: [lua_exe, '-e', 'f = string.dump(assert(loadfile("@INPUT0@"))) io.open("@OUTPUT0@", "wb"):write("unsigned char lpm_luac[] = \"" .. f:gsub(".", function (c) return string.format("\\\x%02X",string.byte(c)) end) .. "\";unsigned int lpm_luac_len = " .. #f .. ";")'], - input: files('src/lpm.lua'), - output: 'lpm.lua.c' + command: [lua_exe, '-e', 'f = string.dump(assert(loadfile("@INPUT0@"))) io.open("@OUTPUT0@", "wb"):write("unsigned char ppm_luac[] = \"" .. f:gsub(".", function (c) return string.format("\\\x%02X",string.byte(c)) end) .. "\";unsigned int ppm_luac_len = " .. #f .. ";")'], + input: files('src/ppm.lua'), + output: 'ppm.lua.c' ) - cflags += '-DLPM_STATIC' + cflags += '-DPPM_STATIC' endif -executable('lpm', lpm_source, dependencies: [zlib_dep, mbedtls_dep, libgit2_dep, libzip_dep, lua_dep, microtar_dep], c_args: cflags) +executable('ppm', ppm_source, dependencies: [zlib_dep, mbedtls_dep, libgit2_dep, libzip_dep, lua_dep, microtar_dep], c_args: cflags) diff --git a/plugins/plugin_manager/init.lua b/plugins/plugin_manager/init.lua index 68e8d0b..0247766 100644 --- a/plugins/plugin_manager/init.lua +++ b/plugins/plugin_manager/init.lua @@ -1,4 +1,4 @@ --- mod-version:3 --lite-xl 2.1 --priority:5 +-- mod-version:3 --pragtical 2.1 --priority:5 local core = require "core" local common = require "core.common" @@ -14,47 +14,47 @@ local PluginManager = { } local binary_extension = (PLATFORM == "Windows" and ".exe" or (PLATFORM == "Android" and ".so" or "")) config.plugins.plugin_manager = common.merge({ - lpm_binary_name = "lpm." .. ARCH .. binary_extension, - lpm_binary_path = nil, + ppm_binary_name = "ppm." .. ARCH .. binary_extension, + ppm_binary_path = nil, -- Restarts the plugin manager on changes. restart_on_change = true, -- Path to a local copy of all repositories. - cachdir = USERDIR .. PATHSEP .. "lpm", + cachdir = USERDIR .. PATHSEP .. "ppm", -- Path to the folder that holds user-specified plugins. userdir = USERDIR, -- Path to ssl certificate directory or bunde. Nil will auto-detect. ssl_certs = nil, -- Whether or not to force install things. force = false, - -- Dumps commands that run to stdout, as well as responses from lpm. + -- Dumps commands that run to stdout, as well as responses from ppm. debug = false }, config.plugins.plugin_manager) package.path = package.path .. ";" .. USERDIR .. "/libraries/?.lua" .. ";" .. USERDIR .. "/libraries/?/init.lua" .. ";" .. DATADIR .. "/libraries/?.lua" .. ";" .. DATADIR .. "/libraries/?/init.lua" -if not config.plugins.plugin_manager.lpm_binary_path then +if not config.plugins.plugin_manager.ppm_binary_path then local paths = { - DATADIR .. PATHSEP .. "plugins" .. PATHSEP .. "plugin_manager" .. PATHSEP .. config.plugins.plugin_manager.lpm_binary_name, - USERDIR .. PATHSEP .. "plugins" .. PATHSEP .. "plugin_manager" .. PATHSEP .. config.plugins.plugin_manager.lpm_binary_name, - DATADIR .. PATHSEP .. "plugins" .. PATHSEP .. "plugin_manager" .. PATHSEP .. "lpm" .. binary_extension, - USERDIR .. PATHSEP .. "plugins" .. PATHSEP .. "plugin_manager" .. PATHSEP .. "lpm" .. binary_extension, + DATADIR .. PATHSEP .. "plugins" .. PATHSEP .. "plugin_manager" .. PATHSEP .. config.plugins.plugin_manager.ppm_binary_name, + USERDIR .. PATHSEP .. "plugins" .. PATHSEP .. "plugin_manager" .. PATHSEP .. config.plugins.plugin_manager.ppm_binary_name, + DATADIR .. PATHSEP .. "plugins" .. PATHSEP .. "plugin_manager" .. PATHSEP .. "ppm" .. binary_extension, + USERDIR .. PATHSEP .. "plugins" .. PATHSEP .. "plugin_manager" .. PATHSEP .. "ppm" .. binary_extension, } local path, s = os.getenv("PATH"), 1 while true do local _, e = path:find(":", s) - table.insert(paths, path:sub(s, e and (e-1) or #path) .. PATHSEP .. config.plugins.plugin_manager.lpm_binary_name) - table.insert(paths, path:sub(s, e and (e-1) or #path) .. PATHSEP .. "lpm" .. binary_extension) + table.insert(paths, path:sub(s, e and (e-1) or #path) .. PATHSEP .. config.plugins.plugin_manager.ppm_binary_name) + table.insert(paths, path:sub(s, e and (e-1) or #path) .. PATHSEP .. "ppm" .. binary_extension) if not e then break end s = e + 1 end for i, path in ipairs(paths) do if system.get_file_info(path) then - config.plugins.plugin_manager.lpm_binary_path = path + config.plugins.plugin_manager.ppm_binary_path = path break end end end -if not config.plugins.plugin_manager.lpm_binary_path then error("can't find lpm binary, please supply one with config.plugins.plugin_manager.lpm_binary_path") end +if not config.plugins.plugin_manager.ppm_binary_path then error("can't find ppm binary, please supply one with config.plugins.plugin_manager.ppm_binary_path") end local Promise = { } function Promise:__index(idx) return rawget(self, idx) or Promise[idx] end @@ -89,7 +89,7 @@ local function extract_progress(chunk) end local function run(cmd, progress) - table.insert(cmd, 1, config.plugins.plugin_manager.lpm_binary_path) + table.insert(cmd, 1, config.plugins.plugin_manager.ppm_binary_path) table.insert(cmd, "--json") table.insert(cmd, "--quiet") table.insert(cmd, "--progress") @@ -345,7 +345,7 @@ command.add(nil, { end, ["plugin-manager:refresh"] = function() PluginManager:refresh({ progress = PluginManager.view.progress_callback }):done(function() core.log("Successfully refreshed plugin listing.") end) end, ["plugin-manager:upgrade"] = function() PluginManager:upgrade({ progress = PluginManager.view.progress_callback }):done(function() core.log("Successfully upgraded installed plugins.") end) end, - ["plugin-manager:purge"] = function() PluginManager:purge({ progress = PluginManager.view.progress_callback }):done(function() core.log("Successfully purged lpm directory.") end) end, + ["plugin-manager:purge"] = function() PluginManager:purge({ progress = PluginManager.view.progress_callback }):done(function() core.log("Successfully purged ppm directory.") end) end, ["plugin-manager:show"] = function() local node = core.root_view:get_active_node_default() node:add_view(PluginManager.view(PluginManager)) @@ -359,7 +359,7 @@ if pcall(require, "plugins.terminal") then local arguments = { "-" } for i,v in ipairs(default_arguments) do table.insert(arguments, v) end local tv = terminal.class(common.merge(config.plugins.terminal, { - shell = config.plugins.plugin_manager.lpm_binary_path, + shell = config.plugins.plugin_manager.ppm_binary_path, arguments = arguments })) core.root_view:get_active_node_default():add_view(tv) @@ -367,4 +367,30 @@ if pcall(require, "plugins.terminal") then }) end +local cli = require "core.cli" + +cli.register { + command = "pm", + description = "Access to the plugin manager.", + usage = "[options] [subcommands]", + exit_editor = true, + execute = function() + if not config.plugins.plugin_manager.ppm_binary_path then + print(cli.colorize("Can't find ppm binary, please supply one with config.plugins.plugin_manager.ppm_binary_path", "red")) + else + local start = 0; + for i=0, #ARGS do + if ARGS[i] == "pm" then + start = i + 1 + break + end + end + os.execute( + '"' .. config.plugins.plugin_manager.ppm_binary_path .. '" ' + .. table.concat(ARGS, " ", start) + ) + end + end +} + return PluginManager diff --git a/src/lpm.c b/src/ppm.c similarity index 92% rename from src/lpm.c rename to src/ppm.c index 1a8bda8..ee206d1 100644 --- a/src/lpm.c +++ b/src/ppm.c @@ -129,7 +129,7 @@ static void lua_pushhexstring(lua_State* L, const unsigned char* buffer, size_t lua_pushlstring(L, hex_buffer, length * 2); } -static int lpm_hash(lua_State* L) { +static int ppm_hash(lua_State* L) { size_t len; const char* data = luaL_checklstring(L, 1, &len); const char* type = luaL_optstring(L, 2, "string"); @@ -161,7 +161,7 @@ static int lpm_hash(lua_State* L) { return 1; } -static int lpm_tcflush(lua_State* L) { +static int ppm_tcflush(lua_State* L) { int stream = luaL_checkinteger(L, 1); #ifndef _WIN32 if (isatty(stream)) @@ -170,7 +170,7 @@ static int lpm_tcflush(lua_State* L) { return 0; } -static int lpm_tcwidth(lua_State* L) { +static int ppm_tcwidth(lua_State* L) { int stream = luaL_checkinteger(L, 1); #ifndef _WIN32 if (isatty(stream)) { @@ -190,7 +190,7 @@ static int lpm_tcwidth(lua_State* L) { return 0; } -static int lpm_symlink(lua_State* L) { +static int ppm_symlink(lua_State* L) { #ifndef _WIN32 if (symlink(luaL_checkstring(L, 1), luaL_checkstring(L, 2))) return luaL_error(L, "can't create symlink %s: %s", luaL_checkstring(L, 2), strerror(errno)); @@ -200,7 +200,7 @@ static int lpm_symlink(lua_State* L) { #endif } -static int lpm_chmod(lua_State* L) { +static int ppm_chmod(lua_State* L) { #ifdef _WIN32 if (_wchmod(lua_toutf16(L, luaL_checkstring(L, 1)), luaL_checkinteger(L, 2))) #else @@ -210,7 +210,7 @@ static int lpm_chmod(lua_State* L) { return 0; } -static int lpm_ls(lua_State *L) { +static int ppm_ls(lua_State *L) { const char *path = luaL_checkstring(L, 1); int i = 1; #ifdef _WIN32 @@ -253,7 +253,7 @@ static int lpm_ls(lua_State *L) { return 1; } -static int lpm_rmdir(lua_State *L) { +static int ppm_rmdir(lua_State *L) { const char *path = luaL_checkstring(L, 1); #ifdef _WIN32 if (!RemoveDirectoryW(lua_toutf16(L, path))) @@ -265,7 +265,7 @@ static int lpm_rmdir(lua_State *L) { return 0; } -static int lpm_mkdir(lua_State *L) { +static int ppm_mkdir(lua_State *L) { const char *path = luaL_checkstring(L, 1); #ifdef _WIN32 int err = _wmkdir(lua_toutf16(L, path)); @@ -277,7 +277,7 @@ static int lpm_mkdir(lua_State *L) { return 0; } -static int lpm_stat(lua_State *L) { +static int ppm_stat(lua_State *L) { const char *path = luaL_checkstring(L, 1); #ifdef _WIN32 wchar_t full_path[MAX_PATH]; @@ -341,7 +341,7 @@ static int lpm_stat(lua_State *L) { lua_setfield(L, -2, "type"); return 1; } -/** END STOLEN LITE CODE **/ +/** END STOLEN PRAGTICAL CODE **/ static const char* git_error_last_string() { const git_error* last_error = git_error_last(); @@ -390,7 +390,7 @@ static git_commit* git_retrieve_commit(git_repository* repository, const char* c } // We move this out of main, because this is a significantly expensive function, -// and we don't need to call it every time we run lpm. +// and we don't need to call it every time we run ppm. static int git_initialized = 0; static int git_cert_type = 0; static char git_cert_path[MAX_PATH]; @@ -407,7 +407,7 @@ static void git_init() { } -static int lpm_reset(lua_State* L) { +static int ppm_reset(lua_State* L) { git_init(); git_repository* repository = luaL_checkgitrepo(L, 1); const char* commit_name = luaL_checkstring(L, 2); @@ -431,7 +431,7 @@ static int lpm_reset(lua_State* L) { } -static int lpm_init(lua_State* L) { +static int ppm_init(lua_State* L) { git_init(); const char* path = luaL_checkstring(L, 1); const char* url = luaL_checkstring(L, 2); @@ -455,11 +455,11 @@ static mbedtls_ctr_drbg_context drbg_context; static mbedtls_ssl_config ssl_config; static mbedtls_ssl_context ssl_context; -static int lpm_git_transport_certificate_check_cb(struct git_cert *cert, int valid, const char *host, void *payload) { +static int ppm_git_transport_certificate_check_cb(struct git_cert *cert, int valid, const char *host, void *payload) { return 0; // If no_verify_ssl is enabled, basically always return 0 when this is set as callback. } -static int lpm_git_transfer_progress_cb(const git_transfer_progress *stats, void *payload) { +static int ppm_git_transfer_progress_cb(const git_transfer_progress *stats, void *payload) { lua_State* L = payload; lua_pushvalue(L, 2); lua_pushinteger(L, stats->received_bytes); @@ -475,8 +475,8 @@ static int lpm_git_transfer_progress_cb(const git_transfer_progress *stats, void return value; } -static int lpm_fetch(lua_State* L) { - git_init(); +static int ppm_fetch(lua_State* L) { + git_init(); git_repository* repository = luaL_checkgitrepo(L, 1); git_remote* remote; if (git_remote_lookup(&remote, repository, "origin")) { @@ -491,9 +491,9 @@ static int lpm_fetch(lua_State* L) { fetch_opts.depth = 1; #endif if (no_verify_ssl) - fetch_opts.callbacks.certificate_check = lpm_git_transport_certificate_check_cb; + fetch_opts.callbacks.certificate_check = ppm_git_transport_certificate_check_cb; if (lua_type(L, 2) == LUA_TFUNCTION) - fetch_opts.callbacks.transfer_progress = lpm_git_transfer_progress_cb; + fetch_opts.callbacks.transfer_progress = ppm_git_transfer_progress_cb; git_strarray array = { (char**)&refspec, 1 }; int error = git_remote_connect(remote, GIT_DIRECTION_FETCH, &fetch_opts.callbacks, NULL, NULL) || git_remote_download(remote, refspec ? &array : NULL, &fetch_opts) || @@ -549,22 +549,22 @@ static int luaL_mbedtls_error(lua_State* L, int code, const char* str, ...) { return luaL_error(L, "%s: %s", vsnbuffer, mbed_buffer); } -static void lpm_tls_debug(void *ctx, int level, const char *file, int line, const char *str) { +static void ppm_tls_debug(void *ctx, int level, const char *file, int line, const char *str) { fprintf(stderr, "%s:%04d: |%d| %s", file, line, level, str); fflush(stderr); } -static void lpm_libgit2_debug(git_trace_level_t level, const char *msg) { +static void ppm_libgit2_debug(git_trace_level_t level, const char *msg) { fprintf(stderr, "[libgit2]: %s\n", msg); fflush(stderr); } -static int lpm_trace(lua_State* L) { +static int ppm_trace(lua_State* L) { print_trace = lua_toboolean(L, 1) ? 1 : 0; return 0; } -static int lpm_certs(lua_State* L) { +static int ppm_certs(lua_State* L) { const char* type = luaL_checkstring(L, 1); int status; if (has_setup_ssl) { @@ -590,9 +590,9 @@ static int lpm_certs(lua_State* L) { #if defined(MBEDTLS_DEBUG_C) if (print_trace) { mbedtls_debug_set_threshold(5); - mbedtls_ssl_conf_dbg(&ssl_config, lpm_tls_debug, NULL); + mbedtls_ssl_conf_dbg(&ssl_config, ppm_tls_debug, NULL); git_init(); - git_trace_set(GIT_TRACE_TRACE, lpm_libgit2_debug); + git_trace_set(GIT_TRACE_TRACE, ppm_libgit2_debug); } #endif has_setup_ssl = 1; @@ -701,7 +701,7 @@ static int mkdirp(char* path, int len) { #define FA_RDONLY 0x01 // FILE_ATTRIBUTE_READONLY #define FA_DIREC 0x10 // FILE_ATTRIBUTE_DIRECTORY -static int lpm_extract(lua_State* L) { +static int ppm_extract(lua_State* L) { const char* src = luaL_checkstring(L, 1); const char* dst = luaL_checkstring(L, 2); @@ -994,13 +994,13 @@ static int lpm_extract(lua_State* L) { } -static int lpm_socket_write(int fd, const char* buf, int len, mbedtls_ssl_context* ctx) { +static int ppm_socket_write(int fd, const char* buf, int len, mbedtls_ssl_context* ctx) { if (ctx) return mbedtls_ssl_write(ctx, buf, len); return write(fd, buf, len); } -static int lpm_socket_read(int fd, char* buf, int len, mbedtls_ssl_context* ctx) { +static int ppm_socket_read(int fd, char* buf, int len, mbedtls_ssl_context* ctx) { if (ctx) return mbedtls_ssl_read(ctx, buf, len); return read(fd, buf, len); @@ -1048,7 +1048,7 @@ static const char* get_header(const char* buffer, const char* header, int* len) static int imin(int a, int b) { return a < b ? a : b; } static int imax(int a, int b) { return a > b ? a : b; } -static int lpm_get(lua_State* L) { +static int ppm_get(lua_State* L) { long response_code; char err[1024] = {0}; const char* protocol = luaL_checkstring(L, 1); @@ -1111,7 +1111,7 @@ static int lpm_get(lua_State* L) { const char* rest = luaL_checkstring(L, 4); char buffer[HTTPS_RESPONSE_HEADER_BUFFER_LENGTH]; int buffer_length = snprintf(buffer, sizeof(buffer), "GET %s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\n\r\n", rest, hostname); - buffer_length = lpm_socket_write(s, buffer, buffer_length, ssl_ctx); + buffer_length = ppm_socket_write(s, buffer, buffer_length, ssl_ctx); if (buffer_length < 0) { mbedtls_snprintf(ssl_ctx ? 1 : 0, err, sizeof(err), ssl_ctx ? buffer_length : errno, "can't write to socket %s", hostname); goto cleanup; } @@ -1120,7 +1120,7 @@ static int lpm_get(lua_State* L) { while (!header_end && bytes_read < sizeof(buffer) - 1) { - buffer_length = lpm_socket_read(s, &buffer[bytes_read], sizeof(buffer) - bytes_read - 1, ssl_ctx); + buffer_length = ppm_socket_read(s, &buffer[bytes_read], sizeof(buffer) - bytes_read - 1, ssl_ctx); if (buffer_length < 0) { mbedtls_snprintf(ssl_ctx ? 1 : 0, err, sizeof(err), ssl_ctx ? buffer_length : errno, "can't read from socket %s", hostname); goto cleanup; } else if (buffer_length > 0) { @@ -1195,7 +1195,7 @@ static int lpm_get(lua_State* L) { snprintf(err, sizeof(err), "can't find chunk length for %s%s", hostname, rest); goto cleanup; } else { - int length = lpm_socket_read(s, &buffer[buffer_length], sizeof(buffer) - buffer_length, ssl_ctx); + int length = ppm_socket_read(s, &buffer[buffer_length], sizeof(buffer) - buffer_length, ssl_ctx); if (length <= 0 || (ssl_ctx && length == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY)) { mbedtls_snprintf(ssl_ctx ? 1 : 0, err, sizeof(err), ssl_ctx ? length : errno, "error retrieving full response for %s%s", hostname, rest); goto cleanup; @@ -1240,7 +1240,7 @@ static int lpm_get(lua_State* L) { } } if (chunk_length > 0) { - int length = lpm_socket_read(s, &buffer[buffer_length], imin(sizeof(buffer) - buffer_length, chunk_length - chunk_written + (chunked ? 2 : 0)), ssl_ctx); + int length = ppm_socket_read(s, &buffer[buffer_length], imin(sizeof(buffer) - buffer_length, chunk_length - chunk_written + (chunked ? 2 : 0)), ssl_ctx); if ((!ssl_ctx && length == 0) || (ssl_ctx && content_length == -1 && length == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY)) goto finish; if (length <= 0) { @@ -1282,7 +1282,7 @@ static int lpm_get(lua_State* L) { return 2; } -static int lpm_chdir(lua_State* L) { +static int ppm_chdir(lua_State* L) { #ifdef _WIN32 if (_wchdir(lua_toutf16(L, luaL_checkstring(L, 1)))) #else @@ -1292,7 +1292,7 @@ static int lpm_chdir(lua_State* L) { return 0; } -static int lpm_pwd(lua_State* L) { +static int ppm_pwd(lua_State* L) { #ifdef _WIN32 wchar_t buffer[MAX_PATH]; if (!_wgetcwd(buffer, sizeof(buffer))) @@ -1307,7 +1307,7 @@ static int lpm_pwd(lua_State* L) { return 1; } -static int lpm_flock(lua_State* L) { +static int ppm_flock(lua_State* L) { const char* path = luaL_checkstring(L, 1); luaL_checktype(L, 2, LUA_TFUNCTION); int error_handler = lua_type(L, 3) == LUA_TFUNCTION ? 3 : 0; @@ -1372,32 +1372,32 @@ static double get_time() { #endif } -static int lpm_time(lua_State* L) { +static int ppm_time(lua_State* L) { lua_pushnumber(L, get_time()); return 1; } static const luaL_Reg system_lib[] = { - { "ls", lpm_ls }, // Returns an array of files. - { "stat", lpm_stat }, // Returns info about a single file. - { "mkdir", lpm_mkdir }, // Makes a directory. - { "rmdir", lpm_rmdir }, // Removes a directory. - { "hash", lpm_hash }, // Returns a hex sha256 hash. - { "tcflush", lpm_tcflush }, // Flushes an terminal stream. - { "tcwidth", lpm_tcwidth }, // Gets the terminal width in columns. - { "symlink", lpm_symlink }, // Creates a symlink. - { "chmod", lpm_chmod }, // Chmod's a file. - { "init", lpm_init }, // Initializes a git repository with the specified remote. - { "fetch", lpm_fetch }, // Updates a git repository with the specified remote. - { "reset", lpm_reset }, // Updates a git repository to the specified commit/hash/branch. - { "get", lpm_get }, // HTTP(s) GET request. - { "extract", lpm_extract }, // Extracts .tar.gz, and .zip files. - { "trace", lpm_trace }, // Sets trace bit. - { "certs", lpm_certs }, // Sets the SSL certificate chain folder/file. - { "chdir", lpm_chdir }, // Changes directory. Only use for --post actions. - { "pwd", lpm_pwd }, // Gets existing directory. Only use for --post actions. - { "flock", lpm_flock }, // Locks a file. - { "time", lpm_time }, // Get high-precision system time. + { "ls", ppm_ls }, // Returns an array of files. + { "stat", ppm_stat }, // Returns info about a single file. + { "mkdir", ppm_mkdir }, // Makes a directory. + { "rmdir", ppm_rmdir }, // Removes a directory. + { "hash", ppm_hash }, // Returns a hex sha256 hash. + { "tcflush", ppm_tcflush }, // Flushes an terminal stream. + { "tcwidth", ppm_tcwidth }, // Gets the terminal width in columns. + { "symlink", ppm_symlink }, // Creates a symlink. + { "chmod", ppm_chmod }, // Chmod's a file. + { "init", ppm_init }, // Initializes a git repository with the specified remote. + { "fetch", ppm_fetch }, // Updates a git repository with the specified remote. + { "reset", ppm_reset }, // Updates a git repository to the specified commit/hash/branch. + { "get", ppm_get }, // HTTP(s) GET request. + { "extract", ppm_extract }, // Extracts .tar.gz, and .zip files. + { "trace", ppm_trace }, // Sets trace bit. + { "certs", ppm_certs }, // Sets the SSL certificate chain folder/file. + { "chdir", ppm_chdir }, // Changes directory. Only use for --post actions. + { "pwd", ppm_pwd }, // Gets existing directory. Only use for --post actions. + { "flock", ppm_flock }, // Locks a file. + { "time", ppm_time }, // Get high-precision system time. { NULL, NULL } }; @@ -1431,29 +1431,29 @@ static const luaL_Reg system_lib[] = { #error "Please define -DARCH_PLATFORM." #endif #endif -#ifndef LITE_ARCH_TUPLE - #define LITE_ARCH_TUPLE ARCH_PROCESSOR "-" ARCH_PLATFORM +#ifndef PRAGTICAL_ARCH_TUPLE + #define PRAGTICAL_ARCH_TUPLE ARCH_PROCESSOR "-" ARCH_PLATFORM #endif -#ifndef LPM_VERSION - #define LPM_VERSION "unknown" +#ifndef PPM_VERSION + #define PPM_VERSION "unknown" #endif -#ifndef LPM_DEFAULT_REPOSITORY - #define LPM_DEFAULT_REPOSITORY "https://github.com/lite-xl/lite-xl-plugin-manager.git:latest" +#ifndef PPM_DEFAULT_REPOSITORY + #define PPM_DEFAULT_REPOSITORY "https://github.com/pragtical/plugin-manager.git:latest" #endif // If this is defined as empty string, we disable self-upgrading. -#ifndef LPM_DEFAULT_RELEASE +#ifndef PPM_DEFAULT_RELEASE #if _WIN32 - #define LPM_DEFAULT_RELEASE "https://github.com/lite-xl/lite-xl-plugin-manager/releases/download/%r/lpm." LITE_ARCH_TUPLE ".exe" + #define PPM_DEFAULT_RELEASE "https://github.com/pragtical/plugin-manager/releases/download/%r/ppm." PRAGTICAL_ARCH_TUPLE ".exe" #else - #define LPM_DEFAULT_RELEASE "https://github.com/lite-xl/lite-xl-plugin-manager/releases/download/%r/lpm." LITE_ARCH_TUPLE + #define PPM_DEFAULT_RELEASE "https://github.com/pragtical/plugin-manager/releases/download/%r/ppm." PRAGTICAL_ARCH_TUPLE #endif #endif -#ifdef LPM_STATIC - extern const char lpm_luac[]; - extern unsigned int lpm_luac_len; +#ifdef PPM_STATIC + extern const char ppm_luac[]; + extern unsigned int ppm_luac_len; #endif int main(int argc, char* argv[]) { @@ -1467,7 +1467,7 @@ int main(int argc, char* argv[]) { lua_rawseti(L, -2, i+1); } lua_setglobal(L, "ARGV"); - lua_pushliteral(L, LPM_VERSION); + lua_pushliteral(L, PPM_VERSION); lua_setglobal(L, "VERSION"); lua_pushliteral(L, ARCH_PLATFORM); lua_setglobal(L, "PLATFORM"); @@ -1519,16 +1519,16 @@ int main(int argc, char* argv[]) { #endif lua_setglobal(L, "EXEFILE"); - lua_pushliteral(L, LITE_ARCH_TUPLE); + lua_pushliteral(L, PRAGTICAL_ARCH_TUPLE); lua_setglobal(L, "ARCH"); - lua_pushliteral(L, LPM_DEFAULT_REPOSITORY); + lua_pushliteral(L, PPM_DEFAULT_REPOSITORY); lua_setglobal(L, "DEFAULT_REPO_URL"); - lua_pushliteral(L, LPM_DEFAULT_RELEASE); + lua_pushliteral(L, PPM_DEFAULT_RELEASE); lua_setglobal(L, "DEFAULT_RELEASE_URL"); - #ifndef LPM_STATIC - if (luaL_loadfile(L, "src/lpm.lua") || lua_pcall(L, 0, 1, 0)) { + #ifndef PPM_STATIC + if (luaL_loadfile(L, "src/ppm.lua") || lua_pcall(L, 0, 1, 0)) { #else - if (luaL_loadbuffer(L, lpm_luac, lpm_luac_len, "lpm.lua") || lua_pcall(L, 0, 1, 0)) { + if (luaL_loadbuffer(L, ppm_luac, ppm_luac_len, "ppm.lua") || lua_pcall(L, 0, 1, 0)) { #endif fprintf(stderr, "internal error when starting the application: %s\n", lua_tostring(L, -1)); return -1; diff --git a/src/lpm.lua b/src/ppm.lua similarity index 83% rename from src/lpm.lua rename to src/ppm.lua index cb95b1a..3974650 100644 --- a/src/lpm.lua +++ b/src/ppm.lua @@ -530,11 +530,11 @@ function common.args(arguments, options) return args end -local LATEST_MOD_VERSION = "3.0.0" +local LATEST_MOD_VERSION = "3.4.0" local EXECUTABLE_EXTENSION = PLATFORM == "windows" and ".exe" or "" -local HOME, USERDIR, CACHEDIR, JSON, TABLE, HEADER, RAW, VERBOSE, FILTRATION, MOD_VERSION, QUIET, FORCE, REINSTALL, CONFIG, NO_COLOR, AUTO_PULL_REMOTES, ARCH, ASSUME_YES, NO_INSTALL_OPTIONAL, TMPDIR, DATADIR, BINARY, POST, PROGRESS, SYMLINK, REPOSITORY, EPHEMERAL, MASK, settings, repositories, lite_xls, system_bottle, progress_bar_label, write_progress_bar +local HOME, USERDIR, CACHEDIR, JSON, TABLE, HEADER, RAW, VERBOSE, FILTRATION, MOD_VERSION, QUIET, FORCE, REINSTALL, CONFIG, NO_COLOR, AUTO_PULL_REMOTES, ARCH, ASSUME_YES, NO_INSTALL_OPTIONAL, TMPDIR, DATADIR, BINARY, POST, PROGRESS, SYMLINK, REPOSITORY, EPHEMERAL, MASK, settings, repositories, pragticals, system_bottle, progress_bar_label, write_progress_bar local SHOULD_COLOR = (PLATFORM == "windows" or (os.getenv("TERM") and os.getenv("TERM") ~= "dumb")) and not os.getenv("NO_COLOR") -local Addon, Repository, LiteXL, Bottle, lpm, log = {}, {}, {}, {}, {}, {} +local Addon, Repository, Pragtical, Bottle, ppm, log = {}, {}, {}, {}, {}, {} local function engage_locks(func, err, warn) if not system.stat(CACHEDIR) then common.mkdirp(CACHEDIR) end @@ -669,19 +669,19 @@ local function match_version(version, pattern) return version == pattern end -local function compatible_modversion(lite_xl_modversion, addon_modversion) - local result = compare_version(lite_xl_modversion, addon_modversion) +local function compatible_modversion(pragtical_modversion, addon_modversion) + local result = compare_version(pragtical_modversion, addon_modversion) return result >= 0 and result < 3 end --- There can exist many different versions of an addon. All statuses are relative to a particular lite bottle. +-- There can exist many different versions of an addon. All statuses are relative to a particular pragtical bottle. -- available: Addon is available in a repository, and can be installed. There is no comparable version on the system. -- upgradable: Addon is installed, but does not match the highest version in any repository. -- orphan: Addon is installed, but there is no corresponding addon in any repository. -- installed: Addon is installed, and matches the highest version in any repository, or highest version is incompatible. --- core: Addon is a part of the lite data directory, and doesn't have corresponding addons in any repository. --- bundled: Addon is part of the lite data directory, but has corresponding addons in any repository. +-- core: Addon is a part of the pragtical data directory, and doesn't have corresponding addons in any repository. +-- bundled: Addon is part of the pragtical data directory, but has corresponding addons in any repository. -- incompatible: Addon is not installed and conflicts with existing installed addons. function Addon.__index(self, idx) return rawget(self, idx) or Addon[idx] end function Addon.new(repository, metadata) @@ -755,7 +755,7 @@ end function Addon:get_install_path(bottle) local folder = self.type == "library" and "libraries" or (self.type .. "s") - local path = (((self:is_core(bottle) or self:is_bundled()) and bottle.lite_xl.datadir_path) or (bottle.local_path and (bottle.local_path .. PATHSEP .. "user") or USERDIR)) .. PATHSEP .. folder + local path = (((self:is_core(bottle) or self:is_bundled()) and bottle.pragtical.datadir_path) or (bottle.local_path and (bottle.local_path .. PATHSEP .. "user") or USERDIR)) .. PATHSEP .. folder if self:is_asset() and self.organization == "singleton" then path = path .. PATHSEP .. (self.path or (self.url and common.basename(self.url) or self.id)) else @@ -805,7 +805,7 @@ function Addon:get_compatibilities(bottle) local dependency_list = common.canonical_order(self.dependencies) for _, addon in ipairs(dependency_list) do local v = self.dependencies[addon] - local potential_addons = { bottle:get_addon(addon, v.version, { mod_version = bottle.lite_xl.mod_version }) } + local potential_addons = { bottle:get_addon(addon, v.version, { mod_version = bottle.pragtical.mod_version }) } for i, potential_addon in ipairs(potential_addons) do local incomaptibilities = common.grep(installed_addons, function(p) return p:is_incompatible(potential_addon) end) if #incomaptibilities == 0 then @@ -1057,7 +1057,7 @@ function Repository.new(hash) live = nil, addons = nil, repo_path = hash.repo_path or (CACHEDIR .. PATHSEP .. "repos" .. PATHSEP .. system.hash(hash.remote)), - lite_xls = {}, + pragticals = {}, last_retrieval = nil }, Repository) if not self:is_local() then @@ -1115,8 +1115,8 @@ function Repository:parse_manifest(repo_id) for i, metadata in ipairs(self.manifest["addons"] or self.manifest["plugins"] or {}) do table.insert(self.addons, Addon.new(self, metadata)) end - for i, metadata in ipairs(self.manifest["lite-xls"] or {}) do - table.insert(self.lite_xls, LiteXL.new(self, metadata)) + for i, metadata in ipairs(self.manifest["pragticals"] or {}) do + table.insert(self.pragticals, Pragtical.new(self, metadata)) end self.remotes = common.map(self.manifest["remotes"] or {}, function(r) return Repository.url(r) end) end) @@ -1289,7 +1289,7 @@ function Repository:update(pull_remotes) if self.branch then log.progress_action("Updating " .. self:url() .. "...") local status, err = pcall(system.fetch, self.local_path, write_progress_bar, "+refs/heads/" .. self.branch .. ":refs/remotes/origin/" .. self.branch) - if not status then -- see https://github.com/lite-xl/lite-xl-plugin-manager/issues/85 + if not status then -- see https://github.com/pragtical/pragtical-plugin-manager/issues/85 if not err:find("object not found %- no match for id") then error(err, 0) end common.rmrf(self.local_path) return self:fetch() @@ -1317,46 +1317,46 @@ function Repository:remove() end -function LiteXL.__index(t, k) return LiteXL[k] end -function LiteXL.new(repository, metadata) - if not metadata.version then error("lite-xl entry requires a version") end +function Pragtical.__index(t, k) return Pragtical[k] end +function Pragtical.new(repository, metadata) + if not metadata.version then error("pragtical entry requires a version") end local self = setmetatable(common.merge({ repository = repository, tags = {}, files = {} - }, metadata), LiteXL) + }, metadata), Pragtical) self.hash = system.hash((repository and repository:url() or "") .. "-" .. metadata.version .. common.join("", common.map(self.files, function(f) return f.checksum end))) - self.local_path = self:is_local() and self.path or (CACHEDIR .. PATHSEP .. "lite_xls" .. PATHSEP .. self.version .. PATHSEP .. self.hash) + self.local_path = self:is_local() and self.path or (CACHEDIR .. PATHSEP .. "pragticals" .. PATHSEP .. self.version .. PATHSEP .. self.hash) self.binary_path = self.binary_path or { } self.datadir_path = self.datadir_path or (self.local_path .. PATHSEP .. "data") return self end -function LiteXL:get_binary_path(arch) +function Pragtical:get_binary_path(arch) if self.binary_path and self.binary_path[arch or _G.ARCH] then return self.binary_path[arch or _G.ARCH] end - return self.local_path .. PATHSEP .. "lite-xl." .. (arch or _G.ARCH) + return self.local_path .. PATHSEP .. "pragtical." .. (arch or _G.ARCH) end -function LiteXL:is_system() return system_bottle and system_bottle.lite_xl == self end -function LiteXL:is_local() return not self.repository and self.path end -function LiteXL:is_compatible(addon) return not addon.mod_version or compatible_modversion(self.mod_version, addon.mod_version) end -function LiteXL:is_installed() return system.stat(self.local_path) ~= nil end +function Pragtical:is_system() return system_bottle and system_bottle.pragtical == self end +function Pragtical:is_local() return not self.repository and self.path end +function Pragtical:is_compatible(addon) return not addon.mod_version or compatible_modversion(self.mod_version, addon.mod_version) end +function Pragtical:is_installed() return system.stat(self.local_path) ~= nil end -function LiteXL:install() - if self:is_installed() then log.warning("lite-xl " .. self.version .. " already installed") return end +function Pragtical:install() + if self:is_installed() then log.warning("pragtical " .. self.version .. " already installed") return end common.mkdirp(self.local_path) - if system_bottle.lite_xl == self then -- system lite-xl. We have to copy it because we can't really set the user directory. - local executable, datadir = common.path("lite-xl" .. EXECUTABLE_EXTENSION) - if not executable then error("can't find system lite-xl executable") end + if system_bottle.pragtical == self then -- system pragtical. We have to copy it because we can't really set the user directory. + local executable, datadir = common.path("pragtical" .. EXECUTABLE_EXTENSION) + if not executable then error("can't find system pragtical executable") end local stat = system.stat(executable) executable = stat.symlink and stat.symlink or executable datadir = common.dirname(executable) .. PATHSEP .. "data" - if not system.stat(datadir) then error("can't find system lite-xl data dir") end - common.copy(executable, self.local_path .. PATHSEP .. "lite-xl") - system.chmod(self.local_path .. PATHSEP .. "lite-xl", 448) -- chmod to rwx------- + if not system.stat(datadir) then error("can't find system pragtical data dir") end + common.copy(executable, self.local_path .. PATHSEP .. "pragtical") + system.chmod(self.local_path .. PATHSEP .. "pragtical", 448) -- chmod to rwx------- common.copy(datadir, self.local_path .. PATHSEP .. "data") elseif self.path and not self.repository then -- local repository - system.symlink(self:get_binary_path(), self.local_path .. PATHSEP .. "lite_xl") + system.symlink(self:get_binary_path(), self.local_path .. PATHSEP .. "pragtical") else if self.remote then system.init(self.local_path, self.remote) @@ -1367,7 +1367,7 @@ function LiteXL:install() if not file.checksum then error("requires a checksum") end local basename = common.basename(file.url) local archive = basename:find("%.zip$") or basename:find("%.tar%.gz$") - local path = self.local_path .. PATHSEP .. (archive and basename or "lite-xl") + local path = self.local_path .. PATHSEP .. (archive and basename or "pragtical") log.action("Downloading file " .. file.url .. "...") common.get(file.url, { target = path, checksum = file.checksum, callback = write_progress_bar }) log.action("Downloaded file " .. file.url .. " to " .. path) @@ -1378,26 +1378,26 @@ function LiteXL:install() end end end - if not system.stat(self.local_path .. PATHSEP .. "lite-xl") then error("can't find executable for lite-xl " .. self.version) end + if not system.stat(self.local_path .. PATHSEP .. "pragtical") then error("can't find executable for pragtical " .. self.version) end end -function LiteXL:uninstall() - if not system.stat(self.local_path) then error("lite-xl " .. self.version .. " not installed") end +function Pragtical:uninstall() + if not system.stat(self.local_path) then error("pragtical " .. self.version .. " not installed") end common.rmrf(self.local_path) end function Bottle.__index(t, k) return Bottle[k] end -function Bottle.new(lite_xl, addons, config, is_system) +function Bottle.new(pragtical, addons, config, is_system) local self = setmetatable({ - lite_xl = lite_xl, + pragtical = pragtical, addons = addons, config = config, is_system = is_system }, Bottle) if not is_system then table.sort(self.addons, function(a, b) return (a.id .. ":" .. a.version) < (b.id .. ":" .. b.version) end) - self.hash = system.hash(lite_xl.version .. " " .. common.join(" ", common.map(self.addons, function(p) return (p.repository and p.repository:url() or "") .. ":" .. p.id .. ":" .. p.version end)) .. (config or "") .. (EPHEMERAL and "E" or "")) + self.hash = system.hash(pragtical.version .. " " .. common.join(" ", common.map(self.addons, function(p) return (p.repository and p.repository:url() or "") .. ":" .. p.id .. ":" .. p.version end)) .. (config or "") .. (EPHEMERAL and "E" or "")) self.local_path = CACHEDIR .. PATHSEP .. "bottles" .. PATHSEP .. self.hash end return self @@ -1413,7 +1413,7 @@ function Bottle:construct() self.local_path = TMPDIR .. PATHSEP .. "bottles" .. PATHSEP .. self.hash common.rmrf(self.local_path) - if not self.lite_xl:is_installed() then self.lite_xl:install() end + if not self.pragtical:is_installed() then self.pragtical:install() end common.mkdirp(self.local_path .. PATHSEP .. "user") if self.config then io.open(self.local_path .. PATHSEP .. "user" .. PATHSEP .. "init.lua", "wb"):write([[ @@ -1426,13 +1426,13 @@ function Bottle:construct() ):close() end - -- Always copy the executbale, because of the way that lite determines the user folder (for now). - common.copy(self.lite_xl:get_binary_path(), self.local_path .. PATHSEP .. "lite-xl" .. EXECUTABLE_EXTENSION) - system.chmod(self.local_path .. PATHSEP .. "lite-xl" .. EXECUTABLE_EXTENSION, 448) -- chmod to rwx-------\ + -- Always copy the executbale, because of the way that pragtical determines the user folder (for now). + common.copy(self.pragtical:get_binary_path(), self.local_path .. PATHSEP .. "pragtical" .. EXECUTABLE_EXTENSION) + system.chmod(self.local_path .. PATHSEP .. "pragtical" .. EXECUTABLE_EXTENSION, 448) -- chmod to rwx-------\ if SYMLINK then - system.symlink(self.lite_xl.datadir_path, self.local_path .. PATHSEP .. "data") + system.symlink(self.pragtical.datadir_path, self.local_path .. PATHSEP .. "data") else - common.copy(self.lite_xl.datadir_path, self.local_path .. PATHSEP .. "data") + common.copy(self.pragtical.datadir_path, self.local_path .. PATHSEP .. "data") end local installing = {} for i,addon in ipairs(self.addons) do @@ -1449,14 +1449,14 @@ end function Bottle:destruct() if self.is_system then error("system bottle cannot be destructed") end - if not self:is_constructed() then error("lite-xl " .. self.version .. " not constructed") end + if not self:is_constructed() then error("pragtical " .. self.version .. " not constructed") end common.rmrf(self.local_path) end function Bottle:run(args) args = args or {} if self.is_system then error("system bottle cannot be run") end - local path = self.local_path .. PATHSEP .. "lite-xl" .. EXECUTABLE_EXTENSION + local path = self.local_path .. PATHSEP .. "pragtical" .. EXECUTABLE_EXTENSION if not system.stat(path) then error("cannot find bottle executable " .. path) end local line = path .. (#args > 0 and " " or "") .. table.concat(common.map(args, function(arg) return "'" .. arg:gsub("'", "'\"'\"'"):gsub("\\", "\\\\") .. "'" @@ -1508,7 +1508,7 @@ function Bottle:all_addons() for _, addon_type in ipairs({ "plugins", "libraries", "fonts", "colors" }) do local addon_paths = { (self.local_path and (self.local_path .. PATHSEP .. "user") or USERDIR) .. PATHSEP .. addon_type, - self.lite_xl.datadir_path .. PATHSEP .. addon_type + self.pragtical.datadir_path .. PATHSEP .. addon_type } for i, addon_path in ipairs(common.grep(addon_paths, function(e) return system.stat(e) end)) do for j, v in ipairs(system.ls(addon_path)) do @@ -1527,7 +1527,7 @@ function Bottle:all_addons() location = (i == 2 and (hash[id] and "bundled" or "core")) or "user", organization = (v:find("%.lua$") and "singleton" or "complex"), local_path = path, - mod_version = self.lite_xl.mod_version, + mod_version = self.pragtical.mod_version, path = addon_type .. PATHSEP .. v, description = (hash[id] and hash[id][1].description or nil), repo_path = (hash[id] and hash[id][1].local_path or nil) @@ -1604,33 +1604,33 @@ local function get_repository(url) return nil end -function lpm.settings_save() +function ppm.settings_save() common.write(CACHEDIR .. PATHSEP .. "settings.json", json.encode(settings)) end -function lpm.repo_save() +function ppm.repo_save() settings.repositories = common.map(repositories, function(r) return r:url() end) - lpm.settings_save() + ppm.settings_save() end local DEFAULT_REPOS -function lpm.repo_init(repos) +function ppm.repo_init(repos) DEFAULT_REPOS = { Repository.url(DEFAULT_REPO_URL) } common.mkdirp(CACHEDIR) if not system.stat(CACHEDIR .. PATHSEP .. "settings.json") then for i, repository in ipairs(repos or DEFAULT_REPOS) do table.insert(repositories, repository:add(true)) end - lpm.repo_save() + ppm.repo_save() end end -function lpm.repo_add(...) +function ppm.repo_add(...) for i, url in ipairs({ ... }) do local idx, repo = get_repository(url) if repo then -- if we're alreayd a repo, put this at the head of the resolution list @@ -1641,22 +1641,22 @@ function lpm.repo_add(...) table.insert(repositories, 1, repo) repo:update() end - lpm.repo_save() + ppm.repo_save() end -function lpm.repo_rm(...) +function ppm.repo_rm(...) for i, url in ipairs({ ... }) do local idx, repo = get_repository(url) if not repo then error("cannot find repository " .. url) end table.remove(repositories, idx) repo:remove() end - lpm.repo_save() + ppm.repo_save() end -function lpm.repo_update(...) +function ppm.repo_update(...) local t = { ... } if #t == 0 then table.insert(t, false) end for i, url in ipairs(t) do @@ -1669,114 +1669,114 @@ function lpm.repo_update(...) end end -local function get_lite_xl(version) - return common.first(common.concat(lite_xls, common.flat_map(repositories, function(e) return e.lite_xls end)), function(lite_xl) return lite_xl.version == version end) +local function get_pragtical(version) + return common.first(common.concat(pragticals, common.flat_map(repositories, function(e) return e.pragticals end)), function(pragtical) return pragtical.version == version end) end -function lpm.lite_xl_save() - settings.lite_xls = common.map(common.grep(lite_xls, function(l) return l:is_local() and not l:is_system() end), function(l) return { version = l.version, mod_version = l.mod_version, path = l.path, binary_path = l.binary_path, datadir_path = l.datadir_path } end) - lpm.settings_save() +function ppm.pragtical_save() + settings.pragticals = common.map(common.grep(pragticals, function(l) return l:is_local() and not l:is_system() end), function(l) return { version = l.version, mod_version = l.mod_version, path = l.path, binary_path = l.binary_path, datadir_path = l.datadir_path } end) + ppm.settings_save() end -function lpm.lite_xl_add(version, path) +function ppm.pragtical_add(version, path) if not version then error("requires a version") end if not version:find("^%d") then error("versions must begin numerically (i.e. 2.1.1-debug)") end - if common.first(lite_xls, function(lite_xl) return lite_xl.version == version end) then error(version .. " lite-xl already exists") end - local binary_path = BINARY or (path and(path .. PATHSEP .. "lite-xl" .. EXECUTABLE_EXTENSION)) + if common.first(pragticals, function(pragtical) return pragtical.version == version end) then error(version .. " pragtical already exists") end + local binary_path = BINARY or (path and(path .. PATHSEP .. "pragtical" .. EXECUTABLE_EXTENSION)) local data_path = DATADIR or (path and (path .. PATHSEP .. "data")) local binary_stat, data_stat = system.stat(binary_path), system.stat(data_path) if not binary_stat then error("can't find binary path " .. binary_path) end if not data_stat then error("can't find data path " .. data_path) end local path_stat = system.stat(path:gsub(PATHSEP .. "$", "")) - if not path_stat then error("can't find lite-xl path " .. path) end - table.insert(lite_xls, LiteXL.new(nil, { version = version, binary_path = { [ARCH[1]] = binary_stat.abs_path }, datadir_path = data_stat.abs_path, path = path_stat.abs_path, mod_version = MOD_VERSION or LATEST_MOD_VERSION })) - lpm.lite_xl_save() + if not path_stat then error("can't find pragtical path " .. path) end + table.insert(pragticals, Pragtical.new(nil, { version = version, binary_path = { [ARCH[1]] = binary_stat.abs_path }, datadir_path = data_stat.abs_path, path = path_stat.abs_path, mod_version = MOD_VERSION or LATEST_MOD_VERSION })) + ppm.pragtical_save() end -function lpm.lite_xl_rm(version) +function ppm.pragtical_rm(version) if not version then error("requires a version") end - local lite_xl = get_lite_xl(version) or error("can't find lite_xl version " .. version) - lite_xls = common.grep(lite_xls, function(l) return l ~= lite_xl end) - lpm.lite_xl_save() + local pragtical = get_pragtical(version) or error("can't find pragtical version " .. version) + pragticals = common.grep(pragticals, function(l) return l ~= pragtical end) + ppm.pragtical_save() end -function lpm.lite_xl_install(version) +function ppm.pragtical_install(version) if not version then error("requires a version") end - (get_lite_xl(version) or error("can't find lite-xl version " .. version)):install() + (get_pragtical(version) or error("can't find pragtical version " .. version)):install() end -function lpm.lite_xl_switch(version, target) +function ppm.pragtical_switch(version, target) if not version then error("requires a version") end - target = target or common.path("lite-xl" .. EXECUTABLE_EXTENSION) - if not target then error("can't find installed lite-xl. please provide a target to install the symlink explicitly as a second argument") end - local lite_xl = get_lite_xl(version) or error("can't find lite-xl version " .. version) - if not lite_xl:is_installed() then log.action("Installing lite-xl " .. lite_xl.version) lite_xl:install() end + target = target or common.path("pragtical" .. EXECUTABLE_EXTENSION) + if not target then error("can't find installed pragtical. please provide a target to install the symlink explicitly as a second argument") end + local pragtical = get_pragtical(version) or error("can't find pragtical version " .. version) + if not pragtical:is_installed() then log.action("Installing pragtical " .. pragtical.version) pragtical:install() end local stat = system.stat(target) if stat and stat.symlink then os.remove(target) end - system.symlink(lite_xl:get_binary_path(), target) - if not common.path('lite-xl' .. EXECUTABLE_EXTENSION) then + system.symlink(pragtical:get_binary_path(), target) + if not common.path('pragtical' .. EXECUTABLE_EXTENSION) then os.remove(target) - error(target .. " is not on your $PATH; please supply a target that can be found on your $PATH, called `lite-xl`.") + error(target .. " is not on your $PATH; please supply a target that can be found on your $PATH, called `pragtical`.") end end -function lpm.lite_xl_uninstall(version) - (get_lite_xl(version) or error("can't find lite-xl version " .. version)):uninstall() +function ppm.pragtical_uninstall(version) + (get_pragtical(version) or error("can't find pragtical version " .. version)):uninstall() end -function lpm.lite_xl_list() - local result = { ["lite-xls"] = { } } +function ppm.pragtical_list() + local result = { ["pragticals"] = { } } local max_version = 0 - for i,lite_xl in ipairs(lite_xls) do - table.insert(result["lite-xls"], { - version = lite_xl.version, - mod_version = lite_xl.mod_version, - tags = lite_xl.tags, - is_system = lite_xl:is_system(), - is_installed = lite_xl:is_installed(), - status = (lite_xl:is_installed() or lite_xl:is_system()) and (lite_xl:is_local() and "local" or "installed") or "available", - local_path = lite_xl:is_installed() and lite_xl.local_path or nil, - datadir_path = lite_xl:is_installed() and lite_xl.datadir_path or nil, - binary_path = lite_xl:is_installed() and lite_xl.binary_path or nil + for i,pragtical in ipairs(pragticals) do + table.insert(result["pragticals"], { + version = pragtical.version, + mod_version = pragtical.mod_version, + tags = pragtical.tags, + is_system = pragtical:is_system(), + is_installed = pragtical:is_installed(), + status = (pragtical:is_installed() or pragtical:is_system()) and (pragtical:is_local() and "local" or "installed") or "available", + local_path = pragtical:is_installed() and pragtical.local_path or nil, + datadir_path = pragtical:is_installed() and pragtical.datadir_path or nil, + binary_path = pragtical:is_installed() and pragtical.binary_path or nil }) - max_version = math.max(max_version, #lite_xl.version) + max_version = math.max(max_version, #pragtical.version) end for i,repo in ipairs(repositories) do - if not repo.lite_xls then error("can't find lite-xl for repo " .. repo:url()) end - for j, lite_xl in ipairs(repo.lite_xls) do - table.insert(result["lite-xls"], { - version = lite_xl.version, - mod_version = lite_xl.mod_version, + if not repo.pragticals then error("can't find pragtical for repo " .. repo:url()) end + for j, pragtical in ipairs(repo.pragticals) do + table.insert(result["pragticals"], { + version = pragtical.version, + mod_version = pragtical.mod_version, repository = repo:url(), - tags = lite_xl.tags, - is_system = lite_xl:is_system(), - is_installed = lite_xl:is_installed(), - status = (lite_xl:is_installed() or lite_xl:is_system()) and (lite_xl:is_local() and "local" or "installed") or "available", - local_path = lite_xl:is_installed() and lite_xl.local_path + tags = pragtical.tags, + is_system = pragtical:is_system(), + is_installed = pragtical:is_installed(), + status = (pragtical:is_installed() or pragtical:is_system()) and (pragtical:is_local() and "local" or "installed") or "available", + local_path = pragtical:is_installed() and pragtical.local_path }) - max_version = math.max(max_version, #lite_xl.version) + max_version = math.max(max_version, #pragtical.version) end end if JSON then io.stdout:write(json.encode(result) .. "\n") else if VERBOSE then - for i, lite_xl in ipairs(result["lite-xls"]) do + for i, pragtical in ipairs(result["pragticals"]) do if i ~= 0 then print("---------------------------") end - print("Version: " .. lite_xl.version) - print("Status: " .. lite_xl.status) - print("Mod-Version: " .. (lite_xl.mod_version or "unknown")) - print("Tags: " .. common.join(", ", lite_xl.tags)) + print("Version: " .. pragtical.version) + print("Status: " .. pragtical.status) + print("Mod-Version: " .. (pragtical.mod_version or "unknown")) + print("Tags: " .. common.join(", ", pragtical.tags)) end else max_version = max_version + 2 print(string.format("%" .. max_version .. "s | %10s | %s", "Version", "Status", "Location")) print(string.format("%" .. max_version .."s | %10s | %s", "-------", "---------", "---------------------------")) - for i, lite_xl in ipairs(result["lite-xls"]) do - print(string.format("%" .. max_version .. "s | %10s | %s", (lite_xl.is_system and "* " or "") .. lite_xl.version, lite_xl.status, (lite_xl.is_installed and lite_xl.local_path or lite_xl.repository))) + for i, pragtical in ipairs(result["pragticals"]) do + print(string.format("%" .. max_version .. "s | %10s | %s", (pragtical.is_system and "* " or "") .. pragtical.version, pragtical.status, (pragtical.is_installed and pragtical.local_path or pragtical.repository))) end end end @@ -1786,14 +1786,14 @@ local function is_argument_repo(arg) return arg:find("^http") or arg:find("[\\/]") or arg == "." end -function lpm.lite_xl_run(version, ...) +function ppm.pragtical_run(version, ...) if not version then error("requires a version or arguments") end local arguments = { ... } if not version:find("^%d+") and version ~= "system" then table.insert(arguments, 1, version) version = "system" end - local lite_xl = get_lite_xl(version) or error("can't find lite-xl version " .. version) + local pragtical = get_pragtical(version) or error("can't find pragtical version " .. version) local addons = {} local i = 1 while i <= #arguments do @@ -1804,7 +1804,7 @@ function lpm.lite_xl_run(version, ...) system_bottle:invalidate_cache() else local id, version = common.split(":", str) - local potentials = { system_bottle:get_addon(id, version, { mod_version = lite_xl.mod_version }) } + local potentials = { system_bottle:get_addon(id, version, { mod_version = pragtical.mod_version }) } local uniq = {} local found_one = false for i, addon in ipairs(potentials) do @@ -1821,7 +1821,7 @@ function lpm.lite_xl_run(version, ...) end i = i + 1 end - local bottle = Bottle.new(lite_xl, addons, CONFIG) + local bottle = Bottle.new(pragtical, addons, CONFIG) if not bottle:is_constructed() or REINSTALL then bottle:construct() end return function() bottle:run(common.slice(arguments, i + 1)) @@ -1830,7 +1830,7 @@ function lpm.lite_xl_run(version, ...) end -function lpm.install(type, ...) +function ppm.install(type, ...) local repo_only = nil local to_install = {} local to_explicitly_install = {} @@ -1838,8 +1838,8 @@ function lpm.install(type, ...) local s = identifier:find(":") local id, version = (s and identifier:sub(1, s-1) or identifier), (s and identifier:sub(s+1) or nil) if not id then error('unrecognized identifier ' .. identifier) end - if id == "lite-xl" then - lpm.lite_xl_install(version) + if id == "pragtical" then + ppm.pragtical_install(version) else if is_argument_repo(identifier) then table.insert(repositories, 1, Repository.url(identifier):add(AUTO_PULL_REMOTES)) @@ -1847,9 +1847,9 @@ function lpm.install(type, ...) if repo_only == nil then repo_only = true end else repo_only = false - local potential_addons = { system_bottle:get_addon(id, version, { mod_version = system_bottle.lite_xl.mod_version, type = type }) } + local potential_addons = { system_bottle:get_addon(id, version, { mod_version = system_bottle.pragtical.mod_version, type = type }) } local addons = common.grep(potential_addons, function(e) return e:is_installable(system_bottle) and (not e:is_installed(system_bottle) or REINSTALL) end) - if #addons == 0 and #potential_addons == 0 then error("can't find " .. (type or "addon") .. " " .. id .. " mod-version: " .. (system_bottle.lite_xl.mod_version or 'any')) end + if #addons == 0 and #potential_addons == 0 then error("can't find " .. (type or "addon") .. " " .. id .. " mod-version: " .. (system_bottle.pragtical.mod_version or 'any')) end if #addons == 0 then log.warning((potential_addons[1].type or "addon") .. " " .. id .. " already installed") if not common.first(settings.installed, id) then table.insert(to_explicitly_install, id) end @@ -1870,7 +1870,7 @@ function lpm.install(type, ...) end end) settings.installed = common.concat(settings.installed, to_explicitly_install) - lpm.settings_save() + ppm.settings_save() end local function get_table(headers, rows) @@ -1904,14 +1904,14 @@ local function print_addon_info(type, addons, filters) elseif addon.path then url = string.format("[`%s`](%s)", addon.name or addon.id, addon.path) end local hash = { id = addon.id, - status = addon.repository and (addon:is_installed(system_bottle) and "installed" or (system_bottle.lite_xl:is_compatible(addon) and "available" or "incompatible")) or (addon:is_bundled(system_bottle) and "bundled" or (addon:is_core(system_bottle) and "core" or (addon:is_upgradable(system_bottle) and "upgradable" or "orphan"))), + status = addon.repository and (addon:is_installed(system_bottle) and "installed" or (system_bottle.pragtical:is_compatible(addon) and "available" or "incompatible")) or (addon:is_bundled(system_bottle) and "bundled" or (addon:is_core(system_bottle) and "core" or (addon:is_upgradable(system_bottle) and "upgradable" or "orphan"))), stub = addon:is_stub(), name = addon.name or addon.id, version = "" .. addon.version, dependencies = addon.dependencies, remote = addon.remote, description = addon.description, - author = addon.author or (addon:is_core(system_bottle) and "lite-xl") or nil, + author = addon.author or (addon:is_core(system_bottle) and "pragtical") or nil, mod_version = addon.mod_version or LATEST_MOD_VERSION, tags = addon.tags, type = addon.type, @@ -1967,7 +1967,7 @@ local function print_addon_info(type, addons, filters) end -function lpm.unstub(type, ...) +function ppm.unstub(type, ...) local addons = {} for i, identifier in ipairs({ ... }) do if not identifier then error('unrecognized identifier ' .. identifier) end @@ -1975,9 +1975,9 @@ function lpm.unstub(type, ...) table.insert(repositories, 1, Repository.url(identifier):add(AUTO_PULL_REMOTES)) system_bottle:invalidate_cache() else - local potential_addons = { system_bottle:get_addon(identifier, nil, { mod_version = system_bottle.lite_xl.mod_version }) } + local potential_addons = { system_bottle:get_addon(identifier, nil, { mod_version = system_bottle.pragtical.mod_version }) } addons = common.grep(potential_addons, function(e) return e:is_stub() end) - if #addons == 0 and #potential_addons == 0 then error("can't find " .. (type or "addon") .. " " .. identifier .. " mod-version: " .. (system_bottle.lite_xl.mod_version or 'any')) end + if #addons == 0 and #potential_addons == 0 then error("can't find " .. (type or "addon") .. " " .. identifier .. " mod-version: " .. (system_bottle.pragtical.mod_version or 'any')) end if #addons == 0 then log.warning((potential_addons[1].type or "addon") .. " " .. identifier .. " already unstubbed") end @@ -1988,7 +1988,7 @@ function lpm.unstub(type, ...) end -function lpm.addon_uninstall(type, ...) +function ppm.addon_uninstall(type, ...) for i, id in ipairs({ ... }) do local addons = { system_bottle:get_addon(id, nil, { type = type }) } if #addons == 0 then error("can't find addon " .. id) end @@ -1999,12 +1999,12 @@ function lpm.addon_uninstall(type, ...) settings.installed = common.grep(settings.installed, function(e) return e ~= addon.id end) end end - lpm.settings_save() + ppm.settings_save() end -function lpm.addon_reinstall(type, ...) for i, id in ipairs({ ... }) do pcall(lpm.addon_uninstall, type, id) end lpm.install(type, ...) end +function ppm.addon_reinstall(type, ...) for i, id in ipairs({ ... }) do pcall(ppm.addon_uninstall, type, id) end ppm.install(type, ...) end -function lpm.repo_list() +function ppm.repo_list() if JSON then io.stdout:write(json.encode({ repositories = common.map(repositories, function(repo) return { remote = repo.remote, commit = repo.commit, branch = repo.branch, path = repo.local_path, remotes = common.map(repo.remotes or {}, function(r) return r:url() end) } end) }) .. "\n") else @@ -2018,54 +2018,54 @@ function lpm.repo_list() end end -function lpm.addon_list(type, id, filters) +function ppm.addon_list(type, id, filters) print_addon_info(type, common.grep(system_bottle:all_addons(), function(p) return (not type or p.type == type) and (not id or p.id:find(id)) end), filters) end -function lpm.describe() +function ppm.describe() local repo_urls = common.grep(common.map(repositories, function(e) return e:url() end), function(url) return #common.grep(DEFAULT_REPOS, function(r) return r:url() == url end) == 0 end) - print("lpm run " .. common.join(" ", { system_bottle.lite_xl.version, table.unpack(repo_urls) }) .. " " .. common.join(" ", common.map(system_bottle:installed_addons(), function(p) return p.id .. ":" .. p.version end))) + print("ppm run " .. common.join(" ", { system_bottle.pragtical.version, table.unpack(repo_urls) }) .. " " .. common.join(" ", common.map(system_bottle:installed_addons(), function(p) return p.id .. ":" .. p.version end))) end -function lpm.addon_upgrade() +function ppm.addon_upgrade() for i,addon in ipairs(system_bottle:installed_addons()) do local upgrade = common.sort({ system_bottle:get_addon(addon.id, ">" .. addon.version) }, function(a, b) return compare_version(b.version, a.version) end)[1] if upgrade then upgrade:install(system_bottle) end end end -function lpm.self_upgrade(release) - if not DEFAULT_RELEASE_URL or #DEFAULT_RELEASE_URL == 0 then error("self-upgrade has been disabled on lpm version " .. VERSION .. "; please upgrade it however you installed it") end +function ppm.self_upgrade(release) + if not DEFAULT_RELEASE_URL or #DEFAULT_RELEASE_URL == 0 then error("self-upgrade has been disabled on ppm version " .. VERSION .. "; please upgrade it however you installed it") end release = release or "latest" local release_url = release and release:find("^https://") and release or (DEFAULT_RELEASE_URL:gsub("%%r", release)) local stat = EXEFILE and system.stat(EXEFILE) - if not stat then error("can't find lpm at " .. EXEFILE) end - local new_temporary_file = SYSTMPDIR .. PATHSEP .. "lpm.upgrade" - local old_temporary_file = SYSTMPDIR .. PATHSEP .. "lpm.backup" + if not stat then error("can't find ppm at " .. EXEFILE) end + local new_temporary_file = SYSTMPDIR .. PATHSEP .. "ppm.upgrade" + local old_temporary_file = SYSTMPDIR .. PATHSEP .. "ppm.backup" common.rmrf(new_temporary_file) common.rmrf(old_temporary_file) local status, err = pcall(common.get, release_url, { cache = SYSTMPDIR, target = new_temporary_file, callback = write_progress_bar }) - if not status then error("can't find release for lpm at " .. release_url .. (VERBOSE and (": " .. err) or "")) end + if not status then error("can't find release for ppm at " .. release_url .. (VERBOSE and (": " .. err) or "")) end if common.is_path_different(new_temporary_file, EXEFILE) then status, err = pcall(common.rename, EXEFILE, old_temporary_file) - if not status then error("can't move lpm executable; do you need to " .. (PLATFORM == "windows" and "run as administrator" or "be root") .. "?" .. (VERBOSE and ": " .. err or "")) end + if not status then error("can't move ppm executable; do you need to " .. (PLATFORM == "windows" and "run as administrator" or "be root") .. "?" .. (VERBOSE and ": " .. err or "")) end common.rename(new_temporary_file, EXEFILE) system.chmod(EXEFILE, stat.mode) if PLATFORM ~= "windows" then -- because we can't delete the running executbale on windows common.rmrf(old_temporary_file) end - log.action("Upgraded lpm to " .. release .. ".") + log.action("Upgraded ppm to " .. release .. ".") else log.warning("aborting upgrade; remote executable is identical to current") common.rmrf(new_temporary_file) end end -function lpm.bottle_purge() +function ppm.bottle_purge() common.rmrf(CACHEDIR .. PATHSEP .. "bottles") end -function lpm.purge() +function ppm.purge() log.action("Purged " .. CACHEDIR .. ".", "green") common.rmrf(CACHEDIR) end @@ -2075,36 +2075,36 @@ end local function run_command(ARGS) if not ARGS[2]:find("%S") then return elseif ARGS[2] == "init" then return - elseif ARGS[2] == "repo" and ARGS[3] == "add" then lpm.repo_add(table.unpack(common.slice(ARGS, 4))) - elseif ARGS[2] == "repo" and ARGS[3] == "rm" then lpm.repo_rm(table.unpack(common.slice(ARGS, 4))) - elseif ARGS[2] == "add" then lpm.repo_add(table.unpack(common.slice(ARGS, 3))) - elseif ARGS[2] == "rm" then lpm.repo_rm(table.unpack(common.slice(ARGS, 3))) - elseif ARGS[2] == "update" then lpm.repo_update(table.unpack(common.slice(ARGS, 3))) - elseif ARGS[2] == "repo" and ARGS[3] == "update" then lpm.repo_update(table.unpack(common.slice(ARGS, 4))) - elseif ARGS[2] == "repo" and (#ARGS == 2 or ARGS[3] == "list") then return lpm.repo_list() - elseif (ARGS[2] == "plugin" or ARGS[2] == "color" or ARGS[2] == "library" or ARGS[2] == "font") and ARGS[3] == "install" then lpm.install(ARGS[2], table.unpack(common.slice(ARGS, 4))) - elseif (ARGS[2] == "plugin" or ARGS[2] == "color" or ARGS[2] == "library" or ARGS[2] == "font") and ARGS[3] == "uninstall" then lpm.addon_uninstall(ARGS[2], table.unpack(common.slice(ARGS, 4))) - elseif (ARGS[2] == "plugin" or ARGS[2] == "color" or ARGS[2] == "library" or ARGS[2] == "font") and ARGS[3] == "reinstall" then lpm.addon_reinstall(ARGS[2], table.unpack(common.slice(ARGS, 4))) - elseif (ARGS[2] == "plugin" or ARGS[2] == "color" or ARGS[2] == "library" or ARGS[2] == "font") and (#ARGS == 2 or ARGS[3] == "list") then return lpm.addon_list(ARGS[2], ARGS[4], ARGS) - elseif ARGS[2] == "upgrade" then return lpm.addon_upgrade(table.unpack(common.slice(ARGS, 3))) - elseif ARGS[2] == "install" then lpm.install(nil, table.unpack(common.slice(ARGS, 3))) - elseif ARGS[2] == "unstub" then return lpm.unstub(nil, table.unpack(common.slice(ARGS, 3))) - elseif ARGS[2] == "uninstall" then lpm.addon_uninstall(nil, table.unpack(common.slice(ARGS, 3))) - elseif ARGS[2] == "reinstall" then lpm.addon_reinstall(nil, table.unpack(common.slice(ARGS, 3))) - elseif ARGS[2] == "describe" then lpm.describe(nil, table.unpack(common.slice(ARGS, 3))) - elseif ARGS[2] == "list" then return lpm.addon_list(nil, ARGS[3], ARGS) - elseif ARGS[2] == "lite-xl" and (#ARGS == 2 or ARGS[3] == "list") then return lpm.lite_xl_list(table.unpack(common.slice(ARGS, 4))) - elseif ARGS[2] == "lite-xl" and ARGS[3] == "uninstall" then return lpm.lite_xl_uninstall(table.unpack(common.slice(ARGS, 4))) - elseif ARGS[2] == "lite-xl" and ARGS[3] == "install" then return lpm.lite_xl_install(table.unpack(common.slice(ARGS, 4))) - elseif ARGS[2] == "lite-xl" and ARGS[3] == "switch" then return lpm.lite_xl_switch(table.unpack(common.slice(ARGS, 4))) - elseif ARGS[2] == "lite-xl" and ARGS[3] == "run" then return lpm.lite_xl_run(table.unpack(common.slice(ARGS, 4))) - elseif ARGS[2] == "lite-xl" and ARGS[3] == "add" then return lpm.lite_xl_add(table.unpack(common.slice(ARGS, 4))) - elseif ARGS[2] == "lite-xl" and ARGS[3] == "rm" then return lpm.lite_xl_rm(table.unpack(common.slice(ARGS, 4))) - elseif ARGS[2] == "lite-xl" then error("unknown lite-xl command: " .. ARGS[3]) - elseif ARGS[2] == "bottle" and ARGS[3] == "purge" then return lpm.bottle_purge(common.slice(ARGS, 4)) - elseif ARGS[2] == "run" then return lpm.lite_xl_run(table.unpack(common.slice(ARGS, 3))) - elseif ARGS[2] == "switch" then return lpm.lite_xl_switch(table.unpack(common.slice(ARGS, 3))) - elseif ARGS[2] == "purge" then lpm.purge() + elseif ARGS[2] == "repo" and ARGS[3] == "add" then ppm.repo_add(table.unpack(common.slice(ARGS, 4))) + elseif ARGS[2] == "repo" and ARGS[3] == "rm" then ppm.repo_rm(table.unpack(common.slice(ARGS, 4))) + elseif ARGS[2] == "add" then ppm.repo_add(table.unpack(common.slice(ARGS, 3))) + elseif ARGS[2] == "rm" then ppm.repo_rm(table.unpack(common.slice(ARGS, 3))) + elseif ARGS[2] == "update" then ppm.repo_update(table.unpack(common.slice(ARGS, 3))) + elseif ARGS[2] == "repo" and ARGS[3] == "update" then ppm.repo_update(table.unpack(common.slice(ARGS, 4))) + elseif ARGS[2] == "repo" and (#ARGS == 2 or ARGS[3] == "list") then return ppm.repo_list() + elseif (ARGS[2] == "plugin" or ARGS[2] == "color" or ARGS[2] == "library" or ARGS[2] == "font") and ARGS[3] == "install" then ppm.install(ARGS[2], table.unpack(common.slice(ARGS, 4))) + elseif (ARGS[2] == "plugin" or ARGS[2] == "color" or ARGS[2] == "library" or ARGS[2] == "font") and ARGS[3] == "uninstall" then ppm.addon_uninstall(ARGS[2], table.unpack(common.slice(ARGS, 4))) + elseif (ARGS[2] == "plugin" or ARGS[2] == "color" or ARGS[2] == "library" or ARGS[2] == "font") and ARGS[3] == "reinstall" then ppm.addon_reinstall(ARGS[2], table.unpack(common.slice(ARGS, 4))) + elseif (ARGS[2] == "plugin" or ARGS[2] == "color" or ARGS[2] == "library" or ARGS[2] == "font") and (#ARGS == 2 or ARGS[3] == "list") then return ppm.addon_list(ARGS[2], ARGS[4], ARGS) + elseif ARGS[2] == "upgrade" then return ppm.addon_upgrade(table.unpack(common.slice(ARGS, 3))) + elseif ARGS[2] == "install" then ppm.install(nil, table.unpack(common.slice(ARGS, 3))) + elseif ARGS[2] == "unstub" then return ppm.unstub(nil, table.unpack(common.slice(ARGS, 3))) + elseif ARGS[2] == "uninstall" then ppm.addon_uninstall(nil, table.unpack(common.slice(ARGS, 3))) + elseif ARGS[2] == "reinstall" then ppm.addon_reinstall(nil, table.unpack(common.slice(ARGS, 3))) + elseif ARGS[2] == "describe" then ppm.describe(nil, table.unpack(common.slice(ARGS, 3))) + elseif ARGS[2] == "list" then return ppm.addon_list(nil, ARGS[3], ARGS) + elseif ARGS[2] == "pragtical" and (#ARGS == 2 or ARGS[3] == "list") then return ppm.pragtical_list(table.unpack(common.slice(ARGS, 4))) + elseif ARGS[2] == "pragtical" and ARGS[3] == "uninstall" then return ppm.pragtical_uninstall(table.unpack(common.slice(ARGS, 4))) + elseif ARGS[2] == "pragtical" and ARGS[3] == "install" then return ppm.pragtical_install(table.unpack(common.slice(ARGS, 4))) + elseif ARGS[2] == "pragtical" and ARGS[3] == "switch" then return ppm.pragtical_switch(table.unpack(common.slice(ARGS, 4))) + elseif ARGS[2] == "pragtical" and ARGS[3] == "run" then return ppm.pragtical_run(table.unpack(common.slice(ARGS, 4))) + elseif ARGS[2] == "pragtical" and ARGS[3] == "add" then return ppm.pragtical_add(table.unpack(common.slice(ARGS, 4))) + elseif ARGS[2] == "pragtical" and ARGS[3] == "rm" then return ppm.pragtical_rm(table.unpack(common.slice(ARGS, 4))) + elseif ARGS[2] == "pragtical" then error("unknown pragtical command: " .. ARGS[3]) + elseif ARGS[2] == "bottle" and ARGS[3] == "purge" then return ppm.bottle_purge(common.slice(ARGS, 4)) + elseif ARGS[2] == "run" then return ppm.pragtical_run(table.unpack(common.slice(ARGS, 3))) + elseif ARGS[2] == "switch" then return ppm.pragtical_switch(table.unpack(common.slice(ARGS, 3))) + elseif ARGS[2] == "purge" then ppm.purge() else error("unknown command: " .. ARGS[2]) end if JSON then io.stdout:write(json.encode({ actions = actions, warnings = warnings })) @@ -2131,7 +2131,7 @@ local function error_handler(err) status = -1 end local function lock_warning() - log.warning("waiting for lpm global lock to be released (only one instance of lpm can be run at once)") + log.warning("waiting for ppm global lock to be released (only one instance of ppm can be run at once)") end @@ -2154,20 +2154,20 @@ xpcall(function() end if ARGS["help"] or #ARGS == 1 or ARGS[2] == "help" then io.stdout:write([[ -Usage: lpm COMMAND [...ARGUMENTS] [--json] [--userdir=directory] +Usage: ppm COMMAND [...ARGUMENTS] [--json] [--userdir=directory] [--cachedir=directory] [--quiet] [--version] [--help] [--remotes] [--ssl-certs=directory/file] [--force] [--arch=]] .. _G.ARCH .. [[] [--assume-yes] [--no-install-optional] [--verbose] [--mod-version=3] [--datadir=directory] [--binary=path] [--symlink] [--post] [--reinstall] [--no-color] [--table=...] [--plugin=file/url] -LPM is a package manager for `lite-xl`, written in C (and packed-in lua). +PPM is a package manager for `pragtical`, written in C (and packed-in lua). It's designed to install packages from our central github repository (and -affiliated repositories), directly into your lite-xl user directory. It can -be called independently, or from the lite-xl `plugin_manager` addon. +affiliated repositories), directly into your pragtical user directory. It can +be called independently, or from the pragtical `plugin_manager` addon. -LPM will always use +PPM will always use ]] .. DEFAULT_REPO_URL .. [[ as its base repository, if none are present, and the cache directory @@ -2175,7 +2175,7 @@ doesn't exist, but others can be added, and this base one can be removed. It has the following commands: - lpm init [repo 1] [repo 2] [...] Implicitly called before all commands + ppm init [repo 1] [repo 2] [...] Implicitly called before all commands if necessary, but can be called independently to save time later, or to set things up differently. @@ -2189,73 +2189,73 @@ It has the following commands: If "none" is specified, initializes an empty repository list. - lpm repo list List all extant repos. - lpm [repo] add Add a source repository. + ppm repo list List all extant repos. + ppm [repo] add Add a source repository. [...] - lpm [repo] rm Remove a source repository. + ppm [repo] rm Remove a source repository. [...] - lpm [repo] update [] Update all/the specified repos. + ppm [repo] update [] Update all/the specified repos. [...] - lpm [plugin|library|color] install Install specific addons. + ppm [plugin|library|color] install Install specific addons. [:] If installed, upgrades. [...:] - lpm [plugin|library|color] uninstall Uninstall the specific addon. + ppm [plugin|library|color] uninstall Uninstall the specific addon. [...] - lpm [plugin|library|color] reinstall Uninstall and installs the specific addon. + ppm [plugin|library|color] reinstall Uninstall and installs the specific addon. [...] - lpm [plugin|library|color] list List all/associated addons. + ppm [plugin|library|color] list List all/associated addons. [...] - lpm upgrade Upgrades all installed addons + ppm upgrade Upgrades all installed addons to new version if applicable. - lpm self-upgrade [version] Upgrades lpm to a new version, + ppm self-upgrade [version] Upgrades ppm to a new version, if applicable. Defaults to latest. - lpm [lite-xl] install Installs lite-xl. Infers the + ppm [pragtical] install Installs pragtical. Infers the [binary] [datadir] paths on your system if not supplied. Automatically switches to be your system default if path auto inferred. - lpm lite-xl add Adds a local version of lite-xl to + ppm pragtical add Adds a local version of pragtical to the managed list, allowing it to be easily bottled. - lpm lite-xl rm Removes a local version of lite-xl + ppm pragtical rm Removes a local version of pragtical from the managed list. - lpm [lite-xl] switch [] Sets the active version of lite-xl + ppm [pragtical] switch [] Sets the active version of pragtical to be the specified version. Auto-detects - current install of lite-xl; if none found + current install of pragtical; if none found path can be specified. - lpm lite-xl list [name pattern] Lists all installed versions of - [...filters] lite-xl. Can specify the flags listed + ppm pragtical list [name pattern] Lists all installed versions of + [...filters] pragtical. Can specify the flags listed in the filtering section. - lpm run [...addons] Sets up a "bottle" to run the specified - lite version, with the specified addons + ppm run [...addons] Sets up a "bottle" to run the specified + pragtical version, with the specified addons and then opens it. - lpm describe [bottle] Describes the bottle specified in the form + ppm describe [bottle] Describes the bottle specified in the form of a list of commands, that allow someone else to run your configuration. - lpm purge Completely purge all state for LPM. - lpm - Read these commands from stdin in + ppm purge Completely purge all state for PPM. + ppm - Read these commands from stdin in an interactive print-eval loop. - lpm help Displays this help text. + ppm help Displays this help text. Flags have the following effects: --json Performs all communication in JSON. - --userdir=directory Sets the lite-xl userdir manually. - If omitted, uses the normal lite-xl logic. + --userdir=directory Sets the pragtical userdir manually. + If omitted, uses the normal pragtical logic. --cachedir=directory Sets the directory to store all repositories. --tmpdir=directory During install, sets the staging area. --datadir=directory Sets the data directory where core addons are located - for the system lite-xl. - --binary=path Sets the lite-xl binary path for the system lite-xl. + for the system pragtical. + --binary=path Sets the pragtical binary path for the system pragtical. --verbose Spits out more information, including intermediate steps to install and whatnot. --quiet Outputs nothing but explicit responses. - --mod-version=version Sets the mod version of lite-xl to install addons. + --mod-version=version Sets the mod version of pragtical to install addons. --version Returns version information. --help Displays this help text. --ssl-certs Sets the SSL certificate store. Can be a directory, @@ -2288,11 +2288,11 @@ Flags have the following effects: repositories, simply act as if the only repositories are those specified in this option. --ephemeral Designates a bottle as 'ephemeral', meaning that it - is fully cleaned up when lpm exits. - --plugin Loads the specified plugin as part of lpm. Used - for customizing lpm for various tasks. Can be + is fully cleaned up when ppm exits. + --plugin Loads the specified plugin as part of ppm. Used + for customizing ppm for various tasks. Can be specified as a remote URL. By default, will always - load all the plugins specified in $HOME/.config/lpm/plugins. + load all the plugins specified in $HOME/.config/ppm/plugins. The following flags are useful when listing addons, or generating the addon table. Putting a ! infront of the string will invert the filter. Multiple @@ -2328,15 +2328,15 @@ in any circumstance unless explicitly supplied. There exist also other debug commands that are potentially useful, but are not commonly used publically. - lpm test Runs the specified test suite. - lpm exec Runs the specified lua file/string with the internal + ppm test Runs the specified test suite. + ppm exec Runs the specified lua file/string with the internal interpreter. - lpm download [target] Downloads the specified URL to stdout, + ppm download [target] Downloads the specified URL to stdout, or to the specified target file. - lpm hash Returns the sha256sum of the file. - lpm update-checksums Pulls all remote files, computes their + ppm hash Returns the sha256sum of the file. + ppm update-checksums Pulls all remote files, computes their checksums, and updates them in the file. - lpm extract Extracts the specified archive at + ppm extract Extracts the specified archive at [target] target, or the current working directory. ]] ) @@ -2344,9 +2344,9 @@ not commonly used publically. end VERBOSE = ARGS["verbose"] or false - JSON = ARGS["json"] or os.getenv("LPM_JSON") - QUIET = ARGS["quiet"] or os.getenv("LPM_QUIET") - EPHEMERAL = ARGS["ephemeral"] or os.getenv("LPM_EPHEMERAL") + JSON = ARGS["json"] or os.getenv("PPM_JSON") + QUIET = ARGS["quiet"] or os.getenv("PPM_QUIET") + EPHEMERAL = ARGS["ephemeral"] or os.getenv("PPM_EPHEMERAL") local arg = ARGS["table"] or ARGS["raw"] if arg then local offset,s,e,i = 1, 1, 0, 1 @@ -2388,13 +2388,13 @@ not commonly used publically. NO_INSTALL_OPTIONAL = ARGS["no-install-optional"] ARCH = ARGS["arch"] or { _G.ARCH } ASSUME_YES = ARGS["assume-yes"] or FORCE - MOD_VERSION = ARGS["mod-version"] or os.getenv("LPM_MODVERSION") + MOD_VERSION = ARGS["mod-version"] or os.getenv("PPM_MODVERSION") if MOD_VERSION == "any" then MOD_VERSION = nil end HOME = (os.getenv("USERPROFILE") or os.getenv("HOME")):gsub(PATHSEP .. "$", "") - USERDIR = common.normalize_path(ARGS["userdir"]) or os.getenv("LITE_USERDIR") or (os.getenv("XDG_CONFIG_HOME") and os.getenv("XDG_CONFIG_HOME") .. PATHSEP .. "lite-xl") - or (HOME and (HOME .. PATHSEP .. '.config' .. PATHSEP .. 'lite-xl')) + USERDIR = common.normalize_path(ARGS["userdir"]) or os.getenv("PRAGTICAL_USERDIR") or (os.getenv("XDG_CONFIG_HOME") and os.getenv("XDG_CONFIG_HOME") .. PATHSEP .. "pragtical") + or (HOME and (HOME .. PATHSEP .. '.config' .. PATHSEP .. 'pragtical')) AUTO_PULL_REMOTES = ARGS["remotes"] - CACHEDIR = common.normalize_path(ARGS["cachedir"]) or os.getenv("LPM_CACHE") or USERDIR .. PATHSEP .. "lpm" + CACHEDIR = common.normalize_path(ARGS["cachedir"]) or os.getenv("PPM_CACHE") or USERDIR .. PATHSEP .. "ppm" TMPDIR = common.normalize_path(ARGS["tmpdir"]) or CACHEDIR .. PATHSEP .. "tmp" if ARGS["trace"] then system.trace(true) end @@ -2455,7 +2455,7 @@ not commonly used publically. end repositories = {} - if ARGS[2] == "purge" then return lpm.purge() end + if ARGS[2] == "purge" then return ppm.purge() end local ssl_certs = ARGS["ssl-certs"] or os.getenv("SSL_CERT_DIR") or os.getenv("SSL_CERT_FILE") if ssl_certs then if ssl_certs == "noverify" then @@ -2497,21 +2497,21 @@ not commonly used publically. end end - local lpm_plugins_path = HOME .. PATHSEP .. ".config" .. PATHSEP .. "lpm" .. PATHSEP .. "plugins" - local lpm_plugins = system.stat(lpm_plugins_path) and common.map(common.grep(system.ls(lpm_plugins_path), function(path) return path:find("%.lua$") end), function(path) return lpm_plugins_path .. PATHSEP .. path end) or {} + local ppm_plugins_path = HOME .. PATHSEP .. ".config" .. PATHSEP .. "ppm" .. PATHSEP .. "plugins" + local ppm_plugins = system.stat(ppm_plugins_path) and common.map(common.grep(system.ls(ppm_plugins_path), function(path) return path:find("%.lua$") end), function(path) return ppm_plugins_path .. PATHSEP .. path end) or {} local env = setmetatable({ EXECUTABLE_EXTENSION = EXECUTABLE_EXTENSION, SHOULD_COLOR = SHOULD_COLOR, HOME = HOME, USERDIR = USERDIR, CACHEDIR = CACHEDIR, JSON = JSON, TABLE = TABLE, HEADER = HEADER, RAW = RAW, VERBOSE = VERBOSE, FILTRATION = FILTRATION, MOD_VERSION = MOD_VERSION, QUIET = QUIET, FORCE = FORCE, REINSTALL = REINSTALL, CONFIG = CONFIG, NO_COLOR = NO_COLOR, AUTO_PULL_REMOTES = AUTO_PULL_REMOTES, ARCH = ARCH, ASSUME_YES = ASSUME_YES, NO_INSTALL_OPTIONAL = NO_INSTALL_OPTIONAL, TMPDIR = TMPDIR, DATADIR = DATADIR, BINARY = BINARY, POST = POST, PROGRESS = PROGRESS, SYMLINK = SYMLINK, REPOSITORY = REPOSITORY, EPHEMERAL = EPHEMERAL, MASK = MASK, - Addon = Addon, Repository = Repository, LiteXL = LiteXL, Bottle = Bottle, lpm = lpm, common = common, json = json, log = log, - settings = settings, repositories = repositories, lite_xls = lite_xls, system_bottle = system_bottle, progress_bar_label = progress_bar_label, write_progress_bar = write_progress_bar + Addon = Addon, Repository = Repository, Pragtical = Pragtical, Bottle = Bottle, ppm = ppm, common = common, json = json, log = log, + settings = settings, repositories = repositories, pragticals = pragticals, system_bottle = system_bottle, progress_bar_label = progress_bar_label, write_progress_bar = write_progress_bar }, { __index = _G, __newindex = function(t, k, v) _G[k] = v end }) - for i,v in ipairs(common.concat(ARGS["plugin"] or {}, { common.split(":", os.getenv("LPM_PLUGINS") or "") }, lpm_plugins)) do + for i,v in ipairs(common.concat(ARGS["plugin"] or {}, { common.split(":", os.getenv("PPM_PLUGINS") or "") }, ppm_plugins)) do if v ~= "" then local contents = v:find("^https?://") and common.get(v) or common.read(v) local func, err = load(contents, v, "bt", env) if func then func() else - log.warning("unable to load lpm plugin " .. v .. ": " .. err) + log.warning("unable to load ppm plugin " .. v .. ": " .. err) end end end @@ -2557,7 +2557,7 @@ not commonly used publically. os.exit(0) end if ARGS[2] == "update-checksums" then - if #ARGS == 2 then error("usage: lpm update-checksums manifest.json") end + if #ARGS == 2 then error("usage: ppm update-checksums manifest.json") end local contents = common.read(ARGS[3]) local m = json.decode(contents) local computed = {} @@ -2568,7 +2568,7 @@ not commonly used publically. if i > 3 then filter[arg] = true end end end - for _, section in ipairs(common.concat(m.addons or {}, m["lite-xls"] or {})) do + for _, section in ipairs(common.concat(m.addons or {}, m["pragticals"] or {})) do for _, file in ipairs(common.concat({ section }, section.files or {})) do if (not filter or (section.id and filter[section.id])) and file.url and file.checksum ~= "SKIP" and type(file.checksum) == "string" then log.action("Computing checksum for " .. (section.id or section.version) .. " (" .. file.url .. ")...") @@ -2591,53 +2591,53 @@ not commonly used publically. os.exit(0) end if ARGS[2] == "self-upgrade" then - lpm.self_upgrade(table.unpack(common.slice(ARGS, 3))) + ppm.self_upgrade(table.unpack(common.slice(ARGS, 3))) os.exit(0) end if not system.stat(USERDIR) then common.mkdirp(USERDIR) end - -- Base setup; initialize default repos if applicable, read them in. Determine Lite XL system binary if not specified, and pull in a list of all local lite-xl's. + -- Base setup; initialize default repos if applicable, read them in. Determine Pragtical system binary if not specified, and pull in a list of all local pragtical's. if engage_locks(function() - settings = { lite_xls = {}, repositories = {}, installed = {}, version = VERSION } - lpm.repo_init(ARGS[2] == "init" and #ARGS > 2 and (ARGS[3] ~= "none" and common.map(common.slice(ARGS, 3), function(url) return Repository.url(url) end) or {}) or nil) - repositories, lite_xls = {}, {} + settings = { pragticals = {}, repositories = {}, installed = {}, version = VERSION } + ppm.repo_init(ARGS[2] == "init" and #ARGS > 2 and (ARGS[3] ~= "none" and common.map(common.slice(ARGS, 3), function(url) return Repository.url(url) end) or {}) or nil) + repositories, pragticals = {}, {} if system.stat(CACHEDIR .. PATHSEP .. "settings.json") then settings = json.decode(common.read(CACHEDIR .. PATHSEP .. "settings.json")) end repositories = common.map(settings.repositories or {}, function(url) local repo = Repository.url(url) repo:parse_manifest() return repo end) - lite_xls = common.map(settings.lite_xls or {}, function(lite_xl) return LiteXL.new(nil, { version = lite_xl.version, mod_version = lite_xl.mod_version, binary_path = lite_xl.binary_path, datadir_path = lite_xl.datadir_path, path = lite_xl.path, tags = { "local" } }) end) + pragticals = common.map(settings.pragticals or {}, function(pragtical) return Pragtical.new(nil, { version = pragtical.version, mod_version = pragtical.mod_version, binary_path = pragtical.binary_path, datadir_path = pragtical.datadir_path, path = pragtical.path, tags = { "local" } }) end) if BINARY and not system.stat(BINARY) then error("can't find specified --binary") end if DATADIR and not system.stat(DATADIR) then error("can't find specified --datadir") end - local lite_xl_binary = BINARY or common.path("lite-xl" .. EXECUTABLE_EXTENSION) - if lite_xl_binary then - local stat = system.stat(lite_xl_binary) - if not stat then error("can't find lite-xl binary " .. lite_xl_binary) end - lite_xl_binary = stat.symlink or lite_xl_binary - local system_lite_xl = common.first(common.concat(common.flat_map(repositories, function(r) return r.lite_xls end), lite_xls), function(lite_xl) return lite_xl:get_binary_path() == lite_xl_binary end) - if not system_lite_xl then - system_lite_xl = common.first(lite_xls, function(e) return e.version == "system" end) - - local directory = common.dirname(lite_xl_binary) - local lite_xl_datadirs = { DATADIR or "", directory .. PATHSEP .. "data", directory:find(PATHSEP .. "bin$") and common.dirname(directory) .. PATHSEP .. "share" .. PATHSEP .. "lite-xl" or "", directory .. PATHSEP .. "data" } - local lite_xl_datadir = common.first(lite_xl_datadirs, function(p) return p and system.stat(p) end) - - if not BINARY and not DATADIR and system_lite_xl then error("can't find existing system lite (does " .. system_lite_xl:get_binary_path() .. " exist? was it moved?); run `lpm purge`, or specify --binary and --datadir.") end - local detected_lite_xl = LiteXL.new(nil, { path = directory, datadir_path = lite_xl_datadir, binary_path = { [_G.ARCH] = lite_xl_binary }, mod_version = MOD_VERSION or LATEST_MOD_VERSION, version = "system", tags = { "system", "local" } }) - if not system_lite_xl then - system_lite_xl = detected_lite_xl - table.insert(lite_xls, system_lite_xl) - lpm.lite_xl_save() + local pragtical_binary = BINARY or common.path("pragtical" .. EXECUTABLE_EXTENSION) + if pragtical_binary then + local stat = system.stat(pragtical_binary) + if not stat then error("can't find pragtical binary " .. pragtical_binary) end + pragtical_binary = stat.symlink or pragtical_binary + local system_pragtical = common.first(common.concat(common.flat_map(repositories, function(r) return r.pragticals end), pragticals), function(pragtical) return pragtical:get_binary_path() == pragtical_binary end) + if not system_pragtical then + system_pragtical = common.first(pragticals, function(e) return e.version == "system" end) + + local directory = common.dirname(pragtical_binary) + local pragtical_datadirs = { DATADIR or "", directory .. PATHSEP .. "data", directory:find(PATHSEP .. "bin$") and common.dirname(directory) .. PATHSEP .. "share" .. PATHSEP .. "pragtical" or "", directory .. PATHSEP .. "data" } + local pragtical_datadir = common.first(pragtical_datadirs, function(p) return p and system.stat(p) end) + + if not BINARY and not DATADIR and system_pragtical then error("can't find existing system pragtical (does " .. system_pragtical:get_binary_path() .. " exist? was it moved?); run `ppm purge`, or specify --binary and --datadir.") end + local detected_pragtical = Pragtical.new(nil, { path = directory, datadir_path = pragtical_datadir, binary_path = { [_G.ARCH] = pragtical_binary }, mod_version = MOD_VERSION or LATEST_MOD_VERSION, version = "system", tags = { "system", "local" } }) + if not system_pragtical then + system_pragtical = detected_pragtical + table.insert(pragticals, system_pragtical) + ppm.pragtical_save() else - lite_xls = common.grep(lite_xls, function(e) return e ~= system_lite_xl end) - system_lite_xl = detected_lite_xl - table.insert(lite_xls, system_lite_xl) + pragticals = common.grep(pragticals, function(e) return e ~= system_pragtical end) + system_pragtical = detected_pragtical + table.insert(pragticals, system_pragtical) end else - if DATADIR then system_lite_xl.datadir_path = DATADIR end - table.insert(system_lite_xl.tags, "system") + if DATADIR then system_pragtical.datadir_path = DATADIR end + table.insert(system_pragtical.tags, "system") end - system_bottle = Bottle.new(system_lite_xl, nil, nil, true) + system_bottle = Bottle.new(system_pragtical, nil, nil, true) else - system_bottle = Bottle.new(LiteXL.new(nil, { mod_version = MOD_VERSION or LATEST_MOD_VERSION, datadir_path = DATADIR, version = "system", tags = { "system", "local" } }), nil, nil, true) + system_bottle = Bottle.new(Pragtical.new(nil, { mod_version = MOD_VERSION or LATEST_MOD_VERSION, datadir_path = DATADIR, version = "system", tags = { "system", "local" } }), nil, nil, true) end if not system_bottle then system_bottle = Bottle.new(nil, nil, nil, true) end if REPOSITORY then repositories = common.map(type(REPOSITORY) == "table" and REPOSITORY or { REPOSITORY }, function(url) local repo = Repository.url(url) repo:parse_manifest() return repo end) end diff --git a/t/run.lua b/t/run.lua index a7af537..1d95420 100644 --- a/t/run.lua +++ b/t/run.lua @@ -1,89 +1,89 @@ -local lpm +local ppm local function assert_exists(path) if not io.open(path, "rb") then error("assertion failed: file " .. path .. " does not exist", 2) end end local function assert_not_exists(path) if io.open(path, "rb") then error("assertion failed: file " .. path .. " exists", 2) end end local tmpdir = os.getenv("TMPDIR") or "/tmp" local fast = os.getenv("FAST") -local userdir = tmpdir .. "/lpmtest" +local userdir = tmpdir .. "/ppmtest" setmetatable(_G, { __index = function(t, k) if not rawget(t, k) then error("cannot get undefined global variable: " .. k, 2) end end, __newindex = function(t, k) error("cannot set global variable: " .. k, 2) end }) local tests = { ["00_install_singleton"] = function() - local plugins = lpm("list bracketmatch")["addons"] + local plugins = ppm("list bracketmatch")["addons"] assert(#plugins == 1) assert(plugins[1].organization == "singleton") assert(plugins[1].status == "available") - local actions = lpm("install bracketmatch")["actions"] + local actions = ppm("install bracketmatch")["actions"] assert(actions[1]:find("Installing singleton")) assert_exists(userdir .. "/plugins/bracketmatch.lua") - actions = lpm("uninstall bracketmatch")["actions"] + actions = ppm("uninstall bracketmatch")["actions"] assert_not_exists(userdir .. "/plugins/bracketmatch.lua") end, ["01_upgrade_singleton"] = function() - lpm("install bracketmatch") - local plugins = lpm("list bracketmatch")["addons"] + ppm("install bracketmatch") + local plugins = ppm("list bracketmatch")["addons"] assert(#plugins == 1) assert(plugins[1].status == "installed") assert_exists(plugins[1].path) io.open(plugins[1].path, "ab"):write("-- this is a test comment to modify the checksum"):close() - plugins = lpm("list bracketmatch")["addons"] + plugins = ppm("list bracketmatch")["addons"] assert(#plugins == 2) - lpm("install bracketmatch") - plugins = lpm("list bracketmatch")["addons"] + ppm("install bracketmatch") + plugins = ppm("list bracketmatch")["addons"] assert(#plugins == 1) - lpm("install console") + ppm("install console") assert_exists(userdir .. "/plugins/console/init.lua") end, ["02_install_complex"] = function() - local plugins = lpm("list plugin_manager")["addons"] + local plugins = ppm("list plugin_manager")["addons"] assert(#plugins == 1) assert(plugins[1].organization == "complex") assert(plugins[1].status == "available") assert(plugins[1].dependencies.json) - local actions = lpm("install plugin_manager")["actions"] + local actions = ppm("install plugin_manager")["actions"] assert_exists(userdir .. "/libraries/json.lua") assert_exists(userdir .. "/plugins/plugin_manager") assert_exists(userdir .. "/plugins/plugin_manager/init.lua") - actions = lpm("uninstall plugin_manager")["actions"] + actions = ppm("uninstall plugin_manager")["actions"] assert_not_exists(userdir .. "/plugins/plugin_manager") - lpm("install editorconfig") + ppm("install editorconfig") assert_exists(userdir .. "/plugins/editorconfig") assert_exists(userdir .. "/plugins/editorconfig/init.lua") end, ["03_upgrade_complex"] = function() - local actions = lpm("install plugin_manager") - local plugins = lpm("list plugin_manager")["addons"] + local actions = ppm("install plugin_manager") + local plugins = ppm("list plugin_manager")["addons"] assert(#plugins == 1) assert(plugins[1].organization == "complex") assert(plugins[1].status == "installed") end, ["04_list_plugins"] = function() - local plugins = lpm("list")["addons"] + local plugins = ppm("list")["addons"] assert(#plugins > 20) - lpm("list --status core") + ppm("list --status core") end, ["05_install_url"] = function() - local plugins = lpm("list eofnewline")["addons"] + local plugins = ppm("list eofnewline")["addons"] assert(#plugins == 1) assert(plugins[1].organization == "singleton") assert(plugins[1].status == "available") - local actions = lpm("install eofnewline") + local actions = ppm("install eofnewline") assert_exists(userdir .. "/plugins/eofnewline.lua") end, ["06_install_stub"] = function() - local plugins = lpm("list lsp")["addons"] + local plugins = ppm("list lsp")["addons"] assert(#plugins > 1) for i, plugin in ipairs(plugins) do if plugin.id == "lsp" then assert(plugins[1].organization == "complex") assert(plugins[1].status == "available") - local actions = lpm("install lsp") + local actions = ppm("install lsp") assert_exists(userdir .. "/plugins/lsp/init.lua") assert_exists(userdir .. "/libraries/widget/init.lua") break end end - local actions = lpm("install encodings") + local actions = ppm("install encodings") assert_exists(userdir .. "/plugins/encodings.lua") local stat = system.stat(userdir .. "/plugins/encodings.lua") assert(stat) @@ -99,41 +99,41 @@ local tests = { assert(#results["addons"] == 3) end, ["08_install_many"] = function() - lpm("install encoding gitblame gitstatus language_ts lsp minimap") + ppm("install encoding gitblame gitstatus language_ts lsp minimap") end, ["09_misc_commands"] = function() - lpm("update") - lpm("upgrade") + ppm("update") + ppm("upgrade") end, ["10_install_multiarch"] = function() - lpm("install plugin_manager --arch x86_64-windows --arch x86_64-linux") - assert_exists(userdir .. "/plugins/plugin_manager/lpm.x86_64-linux") - assert_exists(userdir .. "/plugins/plugin_manager/lpm.x86_64-windows.exe") + ppm("install plugin_manager --arch x86_64-windows --arch x86_64-linux") + assert_exists(userdir .. "/plugins/plugin_manager/ppm.x86_64-linux") + assert_exists(userdir .. "/plugins/plugin_manager/ppm.x86_64-windows.exe") assert_exists(userdir .. "/plugins/plugin_manager/init.lua") end, ["11_dependency_check"] = function() - lpm("install lsp") + ppm("install lsp") assert_exists(userdir .. "/plugins/lsp") assert_exists(userdir .. "/plugins/lintplus") - lpm("uninstall lsp") + ppm("uninstall lsp") assert_not_exists(userdir .. "/plugins/lsp") assert_not_exists(userdir .. "/plugins/lintplus") end, ["12_masking"] = function() - lpm("install lsp --mask lintplus") + ppm("install lsp --mask lintplus") assert_exists(userdir .. "/plugins/lsp") assert_not_exists(userdir .. "/plugins/lintplus") end } local last_command_result, last_command -lpm = function(cmd) +ppm = function(cmd) last_command = arg[0] .. " --quiet --json --assume-yes --userdir=" .. userdir .. " " .. cmd local pipe = io.popen(last_command, "r") local result = pipe:read("*all") last_command_result = result ~= "" and json.decode(result) or nil local success = pipe:close() - if not success then error("error calling lpm", 2) end + if not success then error("error calling ppm", 2) end return last_command_result end @@ -147,14 +147,14 @@ local function run_tests(tests, arg) end table.sort(names) local max_name = 0 - os.execute("rm -rf " .. tmpdir .. "/lpmtest && mkdir -p " .. tmpdir .. "/lpmtest"); + os.execute("rm -rf " .. tmpdir .. "/ppmtest && mkdir -p " .. tmpdir .. "/ppmtest"); for i,k in ipairs(names) do max_name = math.max(max_name, #k) end for i,k in ipairs(names) do local v = tests[k] if fast then - os.execute("rm -rf " .. tmpdir .. "/lpmtest/plugins && mkdir -p " .. tmpdir .. "/lpmtest"); + os.execute("rm -rf " .. tmpdir .. "/ppmtest/plugins && mkdir -p " .. tmpdir .. "/ppmtest"); else - os.execute("rm -rf " .. tmpdir .. "/lpmtest && mkdir -p " .. tmpdir .. "/lpmtest"); + os.execute("rm -rf " .. tmpdir .. "/ppmtest && mkdir -p " .. tmpdir .. "/ppmtest"); end io.stdout:write(string.format("test %-" .. (max_name + 1) .. "s: ", k)) local failed = false