mirror of
https://github.com/davidallendj/gdpm.git
synced 2026-02-04 09:06:27 -07:00
Compare commits
No commits in common. "main" and "v0.0.1" have entirely different histories.
31 changed files with 80 additions and 312 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -16,5 +16,3 @@ vgcore.*
|
||||||
config.json
|
config.json
|
||||||
*.txt
|
*.txt
|
||||||
actions-runner/
|
actions-runner/
|
||||||
**.tar.gz
|
|
||||||
**.tar.zst
|
|
||||||
|
|
|
||||||
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -16,6 +16,3 @@
|
||||||
[submodule "modules/argparse"]
|
[submodule "modules/argparse"]
|
||||||
path = modules/argparse
|
path = modules/argparse
|
||||||
url = https://github.com/p-ranav/argparse
|
url = https://github.com/p-ranav/argparse
|
||||||
[submodule "modules/indicators"]
|
|
||||||
path = modules/indicators
|
|
||||||
url = https://github.com/p-ranav/indicators
|
|
||||||
|
|
|
||||||
3
.trunk/.gitignore
vendored
Normal file
3
.trunk/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
*out
|
||||||
|
*logs
|
||||||
|
external
|
||||||
1
.trunk/actions
Symbolic link
1
.trunk/actions
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
/home/david/.cache/trunk/repos/4c139ff7a07a0441c956056eef1736ac/actions
|
||||||
1
.trunk/notifications
Symbolic link
1
.trunk/notifications
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
/home/david/.cache/trunk/repos/4c139ff7a07a0441c956056eef1736ac/notifications
|
||||||
11
.trunk/trunk.yaml
Normal file
11
.trunk/trunk.yaml
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
version: 0.1
|
||||||
|
cli:
|
||||||
|
version: 1.2.1
|
||||||
|
lint:
|
||||||
|
enabled:
|
||||||
|
- git-diff-check@SYSTEM
|
||||||
|
- gitleaks@8.9.0
|
||||||
|
- markdownlint@0.32.1
|
||||||
|
- prettier@2.7.1
|
||||||
|
- shellcheck@0.8.0
|
||||||
|
- shfmt@3.5.0
|
||||||
|
|
@ -23,7 +23,7 @@ find_package(RapidJSON CONFIG REQUIRED)
|
||||||
find_package(fmt CONFIG REQUIRED)
|
find_package(fmt CONFIG REQUIRED)
|
||||||
find_package(Catch2 CONFIG REQUIRED)
|
find_package(Catch2 CONFIG REQUIRED)
|
||||||
find_package(cxxopts CONFIG REQUIRED)
|
find_package(cxxopts CONFIG REQUIRED)
|
||||||
#find_package(Poco CONFIG REQUIRED COMPONENTS Net JSON Util)
|
find_package(Poco CONFIG REQUIRED COMPONENTS Net JSON Util)
|
||||||
find_package(libzip CONFIG REQUIRED)
|
find_package(libzip CONFIG REQUIRED)
|
||||||
find_package(SQLiteCpp CONFIG REQUIRED)
|
find_package(SQLiteCpp CONFIG REQUIRED)
|
||||||
|
|
||||||
|
|
@ -36,9 +36,6 @@ set(INCLUDE_DIRS
|
||||||
"include"
|
"include"
|
||||||
"/usr/include/doctest"
|
"/usr/include/doctest"
|
||||||
${RAPIDJSON_INCLUDE_DIRS}
|
${RAPIDJSON_INCLUDE_DIRS}
|
||||||
# Poco::Net
|
|
||||||
# Poco::JSON
|
|
||||||
#Poco::Util
|
|
||||||
)
|
)
|
||||||
set(LINK_LIBS
|
set(LINK_LIBS
|
||||||
fmt::fmt
|
fmt::fmt
|
||||||
|
|
@ -46,9 +43,6 @@ set(LINK_LIBS
|
||||||
Catch2::Catch2
|
Catch2::Catch2
|
||||||
cxxopts::cxxopts
|
cxxopts::cxxopts
|
||||||
SQLiteCpp
|
SQLiteCpp
|
||||||
#Poco::Net
|
|
||||||
#Poco::JSON
|
|
||||||
#Poco::Util
|
|
||||||
-lcurlpp
|
-lcurlpp
|
||||||
-lzip
|
-lzip
|
||||||
-lsqlite3
|
-lsqlite3
|
||||||
|
|
|
||||||
17
Dockerfile
17
Dockerfile
|
|
@ -1,17 +0,0 @@
|
||||||
FROM cgr.dev/chainguard/wolfi-base
|
|
||||||
|
|
||||||
RUN apk add --no-cache tini
|
|
||||||
|
|
||||||
# run as nobody
|
|
||||||
USER 65534:65534
|
|
||||||
|
|
||||||
|
|
||||||
# build the binary then copy into container
|
|
||||||
RUN bin/compile.sh --link
|
|
||||||
RUN bin/compile.sh --all
|
|
||||||
|
|
||||||
COPY build/gdpm.static /gdpm
|
|
||||||
|
|
||||||
CMD ["/gdpm"]
|
|
||||||
|
|
||||||
ENTRYPOINT [ "/sbin/tini", "--" ]
|
|
||||||
100
README.md
100
README.md
|
|
@ -7,12 +7,10 @@ GDPM is an attempt to make a simple, front-end, command-line, package manager de
|
||||||
|
|
||||||
\*GDPM has not been tested for Windows or Mac.
|
\*GDPM has not been tested for Windows or Mac.
|
||||||
|
|
||||||
- [Godot Package Manager (GDPM)](#godot-package-manager-gdpm)
|
|
||||||
- [Quick Start](#quick-start)
|
- [Quick Start](#quick-start)
|
||||||
- [Rationale](#rationale)
|
- [Rational](#rationale)
|
||||||
- [How It Works](#how-it-works)
|
- [How It Works](#how-it-works)
|
||||||
- [Features](#features)
|
- [Features](#features)
|
||||||
- [Installing with Package Managers](#installing-with-package-managers)
|
|
||||||
- [Building from Source](#building-from-source)
|
- [Building from Source](#building-from-source)
|
||||||
- [Prerequisites](#prerequisites)
|
- [Prerequisites](#prerequisites)
|
||||||
- [Macro Definitions](#macro-definitions)
|
- [Macro Definitions](#macro-definitions)
|
||||||
|
|
@ -35,16 +33,10 @@ GDPM is an attempt to make a simple, front-end, command-line, package manager de
|
||||||
Common commands for searching, installing, listing, and removing assets.
|
Common commands for searching, installing, listing, and removing assets.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# fetch updates local database if "no packages to install" error
|
gdpm search demo
|
||||||
gdpm fetch
|
gdpm install "Third Person Controller" --skip-prompt
|
||||||
|
|
||||||
# search and install "Godot Jolt" globally
|
|
||||||
gdpm search jolt
|
|
||||||
gdpm install "Godot Jolt" --skip-prompt
|
|
||||||
|
|
||||||
# list installed packages and remove
|
|
||||||
gdpm list --style=table
|
gdpm list --style=table
|
||||||
gdpm remove "Godot Jolt" --clean
|
gdpm remove "Third Person Controller" --clean
|
||||||
```
|
```
|
||||||
|
|
||||||
Use `gdpm help` to see full list of commands.
|
Use `gdpm help` to see full list of commands.
|
||||||
|
|
@ -106,20 +98,6 @@ The local database stores all the information sent by the Asset API with additio
|
||||||
|
|
||||||
* Export list of installed packages to reinstall later.
|
* Export list of installed packages to reinstall later.
|
||||||
|
|
||||||
* Parallel downloads using `libcurl`.
|
|
||||||
|
|
||||||
|
|
||||||
## Installing with Package Managers
|
|
||||||
|
|
||||||
Currently, `gdpm` can only be installed using `makepkg` on Arch Linux with plans of packaging for other distributions in the future.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone https://github.com/davidallendj/gdpm && cd gdpm/dist/archlinux
|
|
||||||
makepkg -si
|
|
||||||
```
|
|
||||||
|
|
||||||
This should build the static binary from source and then install it in `/usr/bin/gdpm`.
|
|
||||||
|
|
||||||
## Building from Source
|
## Building from Source
|
||||||
|
|
||||||
The project uses the CMake or Meson build system and has been tested with GCC and Clang on Arch/Manjaro Linux. CMake is preferred, but a `meson.build` script is provided and should work with some tweaking. Building on Windows or Mac has not been tested yet so it's not guaranteed to work. Compiling with CMake will build 2 executables, 3 shared libraries, and an archive library to link, while compiling with Meson only builds an executable that links with a shared library.
|
The project uses the CMake or Meson build system and has been tested with GCC and Clang on Arch/Manjaro Linux. CMake is preferred, but a `meson.build` script is provided and should work with some tweaking. Building on Windows or Mac has not been tested yet so it's not guaranteed to work. Compiling with CMake will build 2 executables, 3 shared libraries, and an archive library to link, while compiling with Meson only builds an executable that links with a shared library.
|
||||||
|
|
@ -138,58 +116,27 @@ The project uses the CMake or Meson build system and has been tested with GCC an
|
||||||
|
|
||||||
* fmt (may be removed later in favor of C++20 std::format)
|
* fmt (may be removed later in favor of C++20 std::format)
|
||||||
|
|
||||||
* SQLite 3 and SQLite C++ wrapper
|
* SQLite 3
|
||||||
|
|
||||||
* cxxopts
|
|
||||||
|
|
||||||
* doctest (optional; for tests, but still WIP)
|
* doctest (optional; for tests, but still WIP)
|
||||||
|
|
||||||
* Doxygen (optional; to generate API docs)
|
* Doxygen (optional; to generate API docs)
|
||||||
|
|
||||||
Arch Linux users can simply install required libs through `pacman` and/or `yay`:
|
After installing all necessary dependencies, build the project::
|
||||||
|
|
||||||
```bash
|
|
||||||
pacman -S base-devel fmt sqlite rapidjson cmake libzip curl catch2 cxxopts doctest
|
|
||||||
yay -S sqlitecpp libcurlpp
|
|
||||||
```
|
|
||||||
|
|
||||||
After installing the packages, clone the submodules and link the headers:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git submodule add https://github.com/p-ranav/argparse modules/argparse
|
|
||||||
git submodule add https://github.com/p-ranav/tabulate modules/tabulate
|
|
||||||
git submodule add https://github.com/p-ranav/indicators modules/indicators
|
|
||||||
git submodule add https://github.com/p-ranav/csv2 modules/csv2
|
|
||||||
|
|
||||||
ln -s ../modules/argparse/include/argparse include/argparse
|
|
||||||
ln -s ../modules/tabulate/include/tabulate include/tabulate
|
|
||||||
ln -s ../modules/indicators/include/indicators include/indicators
|
|
||||||
ln -s ../modules/csv2/include/csv2 include/csv2
|
|
||||||
```
|
|
||||||
|
|
||||||
Otherwise, you can just update the modules if they're already there and out-of-date:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git submodule update --init --recursive
|
|
||||||
```
|
|
||||||
|
|
||||||
And then build the binaries (check the "build" directory):
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Start by cloning the repo, then...
|
# Start by cloning the repo, then...
|
||||||
git clone https://github.com/davidallendj/gdpm && cd gdpm
|
git clone https://github.com/davidallendj/gdpm
|
||||||
|
cd gdpm
|
||||||
# ... if using CMake with Ninja instead (preferred and tested)...
|
export project_root=${pwd}
|
||||||
cmake -B build -S . -D CMAKE_EXPORT_COMPILE_COMMANDS=1 -D CMAKE_BUILD_TYPE=Release -G Ninja
|
|
||||||
ninja -C build -j$(nproc)
|
|
||||||
|
|
||||||
# ...if using Meson with Clang on Linux...
|
# ...if using Meson with Clang on Linux...
|
||||||
meson build
|
meson build
|
||||||
meson configure build # only needed if reconfiguring build
|
meson configure build # only needed if reconfiguring build
|
||||||
meson compile -C build -j$(nproc)
|
meson compile -C build -j$(nproc)
|
||||||
CXX=clang++ meson compile -C build -j$(nproc)
|
CXX=clang++ meson compile -C build -j$(npoc)
|
||||||
|
|
||||||
# ...if using CMake with Make on Linux (needs work!)...
|
# ...if using CMake on Linux (needs work!)...
|
||||||
cd build
|
cd build
|
||||||
cmake ..
|
cmake ..
|
||||||
make -j$(nproc)
|
make -j$(nproc)
|
||||||
|
|
@ -280,19 +227,6 @@ $ gdpm export path/to/packages.txt
|
||||||
$ gdpm install -f path/to/packages.txt --sync=disable --skip-prompt
|
$ gdpm install -f path/to/packages.txt --sync=disable --skip-prompt
|
||||||
```
|
```
|
||||||
|
|
||||||
If you get a "no packages found to install" error message, try doing a `gdpm fetch` to update the local cache database, then try again.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ gdpm install "Godot Jolt"
|
|
||||||
[ERROR 07:18:41 PM; 2024-03-03] package::install(): no packages found to install.
|
|
||||||
$ gdpm fetch ✔
|
|
||||||
[INFO 07:19:19 PM; 2024-03-03] Sychronizing database...Done.
|
|
||||||
$ gdpm install "Godot Jolt" ✔
|
|
||||||
Title Author Category Version Godot Last Modified Installed?
|
|
||||||
Godot Jolt mihe Misc 16 4.2 2024-01-08 11:10:46 ❌
|
|
||||||
Do you want to install these packages? (Y/n)
|
|
||||||
```
|
|
||||||
|
|
||||||
If you leave out the `--skip-prompt` flag, hit enter to install by default.
|
If you leave out the `--skip-prompt` flag, hit enter to install by default.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
@ -404,9 +338,7 @@ $ gdpm config set username towk
|
||||||
|
|
||||||
- [x] Parallel downloading.
|
- [x] Parallel downloading.
|
||||||
|
|
||||||
- [X] PKGBUILD for ArchLinux/Manjaro.
|
- [ ] PKGBUILD for ArchLinux/Manjaro.
|
||||||
|
|
||||||
- [X] Dockerfile to run in sandbox.
|
|
||||||
|
|
||||||
- [ ] Proper updating.
|
- [ ] Proper updating.
|
||||||
|
|
||||||
|
|
@ -418,17 +350,17 @@ $ gdpm config set username towk
|
||||||
|
|
||||||
- [ ] Adapted to new Asset API.
|
- [ ] Adapted to new Asset API.
|
||||||
|
|
||||||
- [ ] Unit tests.
|
|
||||||
|
|
||||||
- [ ] User interface.
|
- [ ] User interface.
|
||||||
|
|
||||||
- [ ] Experimental dependency management. There is no way of handling dependencies using the Godot Asset API. This is a [hot topic](https://github.com/godotengine/godot-proposals/issues/142) and might change in the near future.
|
- [ ] Experimental dependency management. There is no way of handling dependencies using the Godot Asset API. This is a [hot topic](https://github.com/godotengine/godot-proposals/issues/142) and might change in the near future.
|
||||||
## Known Issues
|
## Known Issues
|
||||||
|
|
||||||
* Logging doesn't write to file yet.
|
* The code is currently still changing so API is unstable.
|
||||||
|
|
||||||
|
* Logging doesn't write to file.
|
||||||
|
|
||||||
* Download progress bars are not showing when downloading archives. This is being reworked to display multiple bars dynamically to better show download status.
|
* Download progress bars are not showing when downloading archives. This is being reworked to display multiple bars dynamically to better show download status.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
See the `LICENSE.md` file.
|
See the LICENSE.md file.
|
||||||
|
|
|
||||||
25
SConstruct
25
SConstruct
|
|
@ -1,25 +0,0 @@
|
||||||
|
|
||||||
# set up variables and glob files
|
|
||||||
env = Environment(
|
|
||||||
CPPPATH = Glob('include/*.hpp'),
|
|
||||||
CPPDEFINES = [],
|
|
||||||
LIBS = []
|
|
||||||
)
|
|
||||||
base_name = "gdpm"
|
|
||||||
include_files = Glob('include/*.hpp')
|
|
||||||
source_files = Glob('src/*.cpp')
|
|
||||||
test_files = Glob('tests/*.cpp')
|
|
||||||
compile_flags = ""
|
|
||||||
|
|
||||||
# build the main executable and tests
|
|
||||||
env.Program(f'{base_name}', source_files)
|
|
||||||
env.Program(f'{base_name}.tests', test_files)
|
|
||||||
|
|
||||||
# build the static library
|
|
||||||
StaticLibrary(f'{base_name}-static')
|
|
||||||
|
|
||||||
# build the shared libraries
|
|
||||||
SharedLibrary(f'{base_name}-shared')
|
|
||||||
SharedLibrary(f'{base_name}-static')
|
|
||||||
SharedLibrary(f'{base_name}-http')
|
|
||||||
SharedLibrary(f'{base_name}-restapi')
|
|
||||||
|
|
@ -46,16 +46,6 @@ function link_all(){
|
||||||
link_exe $script_dir/../build/gdpm.tests $script_dir/../bin/$tests
|
link_exe $script_dir/../build/gdpm.tests $script_dir/../bin/$tests
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_deps() {
|
|
||||||
#git submodule init -f
|
|
||||||
#git submodule init -f
|
|
||||||
|
|
||||||
# link the include headers
|
|
||||||
ln -s ../modules/indicators/include/indicators include/indicators
|
|
||||||
ln -s ../modules/tabulate/include/tabulate include/tabulate
|
|
||||||
ln -s ../modules/argparse/include/argparse include/argparse
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function clean(){
|
function clean(){
|
||||||
rm ${script_dir}/../bin/$exe
|
rm ${script_dir}/../bin/$exe
|
||||||
|
|
@ -63,12 +53,6 @@ function clean(){
|
||||||
rm ${script_dir}/../bin/$tests
|
rm ${script_dir}/../bin/$tests
|
||||||
}
|
}
|
||||||
|
|
||||||
function checksums(){
|
|
||||||
sha256sums ${script_dir}/../bin/$exe
|
|
||||||
sha256sums ${script_dir}/../bin/$static
|
|
||||||
sha256sums ${script_dir}/../bin/$tests
|
|
||||||
}
|
|
||||||
|
|
||||||
# Run this script at project root
|
# Run this script at project root
|
||||||
#meson configure build
|
#meson configure build
|
||||||
#CXX=clang++ meson compile -C build -j$(proc)
|
#CXX=clang++ meson compile -C build -j$(proc)
|
||||||
|
|
@ -88,7 +72,6 @@ function build_all(){
|
||||||
function build_exe(){
|
function build_exe(){
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
$CMAKE_COMMAND \
|
$CMAKE_COMMAND \
|
||||||
--build . \
|
|
||||||
--target gdpm \
|
--target gdpm \
|
||||||
--target gdpm.static
|
--target gdpm.static
|
||||||
$NINJA_COMMAND
|
$NINJA_COMMAND
|
||||||
|
|
@ -98,7 +81,6 @@ function build_exe(){
|
||||||
function build_libs(){
|
function build_libs(){
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
$CMAKE_COMMAND \
|
$CMAKE_COMMAND \
|
||||||
--build . \
|
|
||||||
--target gdpm-static \
|
--target gdpm-static \
|
||||||
--target gdpm-shared \
|
--target gdpm-shared \
|
||||||
--target gdpm-http \
|
--target gdpm-http \
|
||||||
|
|
@ -108,7 +90,7 @@ function build_libs(){
|
||||||
|
|
||||||
function build_tests(){
|
function build_tests(){
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
$CMAKE_COMMAND --build . --target gdpm.tests
|
$CMAKE_COMMAND --target gdpm.tests
|
||||||
$NINJA_COMMAND
|
$NINJA_COMMAND
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -136,8 +118,6 @@ do
|
||||||
--exe) build_exe shift;;
|
--exe) build_exe shift;;
|
||||||
--libs) build_libs shift;;
|
--libs) build_libs shift;;
|
||||||
--tests) build_tests shift;;
|
--tests) build_tests shift;;
|
||||||
--deps) get_deps shift;;
|
|
||||||
--sums) checksums shift;;
|
|
||||||
-d|--docs) build_docs shift;;
|
-d|--docs) build_docs shift;;
|
||||||
-c|--clean) clean shift;;
|
-c|--clean) clean shift;;
|
||||||
-s|--strip) strip_all shift;;
|
-s|--strip) strip_all shift;;
|
||||||
|
|
|
||||||
56
dist/archlinux/PKGBUILD
vendored
56
dist/archlinux/PKGBUILD
vendored
|
|
@ -1,56 +0,0 @@
|
||||||
# Maintainer: David J. Allen <davidallendj@gmail.com>
|
|
||||||
pkgname=gdpm-git
|
|
||||||
pkgver=r94.341f075
|
|
||||||
pkgrel=1
|
|
||||||
pkgdesc="CLI tool to automate managing Godot game engine assets from the command-line. This includes a pre-built, static binary."
|
|
||||||
arch=('x86_64')
|
|
||||||
url="https://github.com/davidallendj/gdpm"
|
|
||||||
license=('MIT')
|
|
||||||
depends=('glibc')
|
|
||||||
makedepends=('cmake' 'ninja' 'clang' 'gcc')
|
|
||||||
optdepends=('meson' 'make')
|
|
||||||
source=("$pkgname-$pkgver::git+https://github.com/davidallendj/gdpm")
|
|
||||||
sha256sums=('SKIP')
|
|
||||||
|
|
||||||
pkgver() {
|
|
||||||
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
|
|
||||||
}
|
|
||||||
|
|
||||||
prepare() {
|
|
||||||
cd "$srcdir/$pkgname-$pkgver"
|
|
||||||
|
|
||||||
# remove all links to modules
|
|
||||||
rm -f include/argparse
|
|
||||||
rm -f include/tabulate
|
|
||||||
rm -f include/indicators
|
|
||||||
rm -f include/csv2
|
|
||||||
|
|
||||||
# update and initialize submodules
|
|
||||||
git submodule update --init modules/argparse
|
|
||||||
git submodule update --init modules/tabulate
|
|
||||||
git submodule update --init modules/indicators
|
|
||||||
git submodule update --init modules/csv2
|
|
||||||
|
|
||||||
# link module headers to include/*
|
|
||||||
ln -s ../modules/argparse/include/argparse include/argparse
|
|
||||||
ln -s ../modules/tabulate/include/tabulate include/tabulate
|
|
||||||
ln -s ../modules/indicators/include/indicators include/indicators
|
|
||||||
ln -s ../modules/csv2/include/csv2 include/csv2
|
|
||||||
}
|
|
||||||
|
|
||||||
build () {
|
|
||||||
cd "$srcdir/$pkgname-$pkgver"
|
|
||||||
bin/compile.sh --all
|
|
||||||
}
|
|
||||||
|
|
||||||
package() {
|
|
||||||
cd "$srcdir/$pkgname-$pkgver"
|
|
||||||
|
|
||||||
# install the binary to /usr/bin
|
|
||||||
mkdir -p "${pkgdir}/usr/bin"
|
|
||||||
install -m755 build/gdpm.static "${pkgdir}/usr/bin/gdpm"
|
|
||||||
}
|
|
||||||
|
|
||||||
clean() {
|
|
||||||
rm -rf "$srcdir/$pkgname-$pkgver"
|
|
||||||
}
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
../modules/argparse/include/argparse
|
|
||||||
|
|
@ -16,7 +16,6 @@ namespace gdpm::cache {
|
||||||
string table_name = GDPM_PACKAGE_CACHE_TABLENAME;
|
string table_name = GDPM_PACKAGE_CACHE_TABLENAME;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool exists(const params& = params());
|
|
||||||
error create_package_database(bool overwrite = false, const params& = params());
|
error create_package_database(bool overwrite = false, const params& = params());
|
||||||
error insert_package_info(const package::info_list& packages, const params& = params());
|
error insert_package_info(const package::info_list& packages, const params& = params());
|
||||||
result_t<package::info_list> get_package_info_by_id(const package::id_list& package_ids, const params& = params());
|
result_t<package::info_list> get_package_info_by_id(const package::id_list& package_ids, const params& = params());
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ namespace gdpm::config{
|
||||||
bool enable_sync = true;
|
bool enable_sync = true;
|
||||||
bool enable_cache = true;
|
bool enable_cache = true;
|
||||||
bool skip_prompt = false;
|
bool skip_prompt = false;
|
||||||
bool ignore_validation = false;
|
|
||||||
bool enable_file_logging;
|
bool enable_file_logging;
|
||||||
bool clean_temporary;
|
bool clean_temporary;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
namespace gdpm::constants::error{
|
namespace gdpm::constants::error{
|
||||||
|
|
||||||
enum class ec{
|
enum class ec{
|
||||||
IGNORE = 0,
|
NONE = 0,
|
||||||
UNKNOWN,
|
UNKNOWN,
|
||||||
UNKNOWN_COMMAND,
|
UNKNOWN_COMMAND,
|
||||||
UNKNOWN_ARGUMENT,
|
UNKNOWN_ARGUMENT,
|
||||||
|
|
@ -93,7 +93,7 @@ namespace gdpm{
|
||||||
namespace ce = constants::error;
|
namespace ce = constants::error;
|
||||||
class error {
|
class error {
|
||||||
public:
|
public:
|
||||||
constexpr explicit error(ec code = ec::IGNORE, const string& message = "{default}"):
|
constexpr explicit error(ec code = ec::NONE, const string& message = "{default}"):
|
||||||
m_code(code),
|
m_code(code),
|
||||||
m_message(utils::replace_all(message, "{default}", ce::get_message(code)))
|
m_message(utils::replace_all(message, "{default}", ce::get_message(code)))
|
||||||
{}
|
{}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ namespace gdpm::rest_api{
|
||||||
int support;
|
int support;
|
||||||
string user = "";
|
string user = "";
|
||||||
string cost = "";
|
string cost = "";
|
||||||
string godot_version = "4.3";
|
string godot_version = "4.0";
|
||||||
int max_results = 500;
|
int max_results = 500;
|
||||||
int page;
|
int page;
|
||||||
int offset;
|
int offset;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@
|
||||||
#include <variant>
|
#include <variant>
|
||||||
#include <future>
|
#include <future>
|
||||||
#include <any>
|
#include <any>
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
namespace gdpm{
|
namespace gdpm{
|
||||||
class error;
|
class error;
|
||||||
|
|
|
||||||
|
|
@ -78,11 +78,6 @@ namespace gdpm::utils {
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename...Args>
|
|
||||||
std::string format(std::string_view fmt, Args&&...args){
|
|
||||||
return std::vformat(fmt, std::make_format_args(args...));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool to_bool(const std::string& s);
|
bool to_bool(const std::string& s);
|
||||||
std::vector<std::string> split_lines(const std::string& contents);
|
std::vector<std::string> split_lines(const std::string& contents);
|
||||||
std::string readfile(const std::string& path);
|
std::string readfile(const std::string& path);
|
||||||
|
|
@ -102,7 +97,6 @@ namespace gdpm::utils {
|
||||||
std::string join(const std::vector<std::string>& target, const std::string& delimiter = ", ");
|
std::string join(const std::vector<std::string>& target, const std::string& delimiter = ", ");
|
||||||
std::string join(const std::unordered_map<std::string, std::string>& target, const std::string& prefix = "", const std::string& delimiter = "\n");
|
std::string join(const std::unordered_map<std::string, std::string>& target, const std::string& prefix = "", const std::string& delimiter = "\n");
|
||||||
std::string convert_size(long size);
|
std::string convert_size(long size);
|
||||||
|
|
||||||
// TODO: Add function to get size of decompressed zip
|
// TODO: Add function to get size of decompressed zip
|
||||||
|
|
||||||
namespace json {
|
namespace json {
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,14 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "error.hpp"
|
|
||||||
#include "result.hpp"
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
namespace gdpm::version{
|
namespace gdpm::version{
|
||||||
struct context{
|
struct version_context{
|
||||||
int major = 0;
|
int major;
|
||||||
int minor = 0;
|
int minor;
|
||||||
int patch = 0;
|
int patch;
|
||||||
string description = "";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string to_string(const context& context);
|
std::string to_string(const version_context& context);
|
||||||
result_t<context> to_version(const std::string& version);
|
version_context to_version(const std::string& version);
|
||||||
bool is_valid_version_string(const std::string& version);
|
|
||||||
}
|
}
|
||||||
1
modules/clipp
Submodule
1
modules/clipp
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 02783b6782ebedbb2bebc2e6ceda738ee51c7df2
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 222382c3a6abbce32503792c59826063660ddb56
|
|
||||||
|
|
@ -17,10 +17,6 @@ namespace gdpm::cache{
|
||||||
return utils::replace_all(s, "'", "''");
|
return utils::replace_all(s, "'", "''");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool exists(const params& params) {
|
|
||||||
return std::filesystem::exists(params.cache_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
error create_package_database(
|
error create_package_database(
|
||||||
bool overwrite,
|
bool overwrite,
|
||||||
const params& params
|
const params& params
|
||||||
|
|
|
||||||
|
|
@ -343,7 +343,7 @@ namespace gdpm::config{
|
||||||
error.set_message("Key `remote_sources` is not a JSON object.");
|
error.set_message("Key `remote_sources` is not a JSON object.");
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
error.set_code(ec::IGNORE);
|
error.set_code(ec::NONE);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
13
src/main.cpp
13
src/main.cpp
|
|
@ -1,7 +1,10 @@
|
||||||
|
|
||||||
// Godot Package Manager (GPM)
|
// Godot Package Manager (GPM)
|
||||||
|
#include "constants.hpp"
|
||||||
|
#include "log.hpp"
|
||||||
|
#include "config.hpp"
|
||||||
#include "package_manager.hpp"
|
#include "package_manager.hpp"
|
||||||
|
#include "result.hpp"
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -10,13 +13,7 @@ int main(int argc, char **argv){
|
||||||
using namespace gdpm::package_manager;
|
using namespace gdpm::package_manager;
|
||||||
|
|
||||||
error error = initialize(argc, argv);
|
error error = initialize(argc, argv);
|
||||||
if(error.has_occurred()) {
|
parse_arguments(argc, argv);
|
||||||
log::error(error);
|
|
||||||
}
|
|
||||||
error = parse_arguments(argc, argv);
|
|
||||||
if(error.has_occurred()) {
|
|
||||||
log::error(error);
|
|
||||||
}
|
|
||||||
finalize();
|
finalize();
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ namespace gdpm::package{
|
||||||
if(p_cache.empty()){
|
if(p_cache.empty()){
|
||||||
return log::error_rc(
|
return log::error_rc(
|
||||||
ec::NOT_FOUND, /* TODO: change to PACKAGE_NOT_FOUND */
|
ec::NOT_FOUND, /* TODO: change to PACKAGE_NOT_FOUND */
|
||||||
"package::install(): no package(s) found to install."
|
"package::install(): no packages found to install."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -147,13 +147,6 @@ namespace gdpm::package_manager{
|
||||||
.help("set verbosity level")
|
.help("set verbosity level")
|
||||||
.nargs(nargs_pattern::optional);
|
.nargs(nargs_pattern::optional);
|
||||||
|
|
||||||
program.add_argument("--ignore-validation")
|
|
||||||
.action([&](const auto&){ config.ignore_validation = true; })
|
|
||||||
.default_value(false)
|
|
||||||
.implicit_value(true)
|
|
||||||
.help("ignore checking if current directory is a Godot project")
|
|
||||||
.nargs(0);
|
|
||||||
|
|
||||||
install_command.add_description("install package(s)");
|
install_command.add_description("install package(s)");
|
||||||
install_command.add_argument("packages")
|
install_command.add_argument("packages")
|
||||||
.required()
|
.required()
|
||||||
|
|
@ -416,13 +409,6 @@ namespace gdpm::package_manager{
|
||||||
return log::error_rc(ec::ARGPARSE_ERROR, e.what());
|
return log::error_rc(ec::ARGPARSE_ERROR, e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if we're running in a directory with 'project.godot' file */
|
|
||||||
if (!config.ignore_validation) {
|
|
||||||
if(!std::filesystem::exists("project.godot")){
|
|
||||||
return error(ec::FILE_NOT_FOUND, "no 'project.godot' file found in current directory");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(program.is_subcommand_used(install_command)){
|
if(program.is_subcommand_used(install_command)){
|
||||||
action = action_e::install;
|
action = action_e::install;
|
||||||
// if(install_command.is_used("packages"))
|
// if(install_command.is_used("packages"))
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,10 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
||||||
|
#include <curlpp/cURLpp.hpp>
|
||||||
|
#include <curlpp/Easy.hpp>
|
||||||
|
#include <curlpp/Options.hpp>
|
||||||
|
#include <curlpp/Exception.hpp>
|
||||||
|
|
||||||
namespace gdpm::rest_api{
|
namespace gdpm::rest_api{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,16 @@
|
||||||
|
|
||||||
|
|
||||||
#include "version.hpp"
|
#include "version.hpp"
|
||||||
|
|
||||||
#include <regex>
|
|
||||||
|
|
||||||
|
|
||||||
namespace gdpm::version{
|
namespace gdpm::version{
|
||||||
|
|
||||||
void print(){
|
std::string to_string(const version_context& context){
|
||||||
|
return std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
string to_string(const context& c){
|
version_context to_version(const std::string& version){
|
||||||
return utils::format("{}.{}.{}", c.major, c.minor, c.patch);
|
version_context v;
|
||||||
}
|
|
||||||
|
|
||||||
result_t<context> to_version(const string& version){
|
return v;
|
||||||
context v;
|
|
||||||
|
|
||||||
// check if string is valid
|
|
||||||
if(!is_valid_version_string(version)){
|
|
||||||
return result_t(context(), error(ec::IGNORE, "invalid version string"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// convert string to version context
|
|
||||||
|
|
||||||
|
|
||||||
return result_t(v, error());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool is_valid_version_string(const string &version){
|
|
||||||
return std::regex_match(version, std::regex("^(\\d+\\.)?(\\d+\\.)?(\\*|\\d+)$"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
1
submodules/indicators
Submodule
1
submodules/indicators
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit ef71abd9bc7254f7734fa84d5b1c336be2deb9f7
|
||||||
Loading…
Add table
Add a link
Reference in a new issue