Refactor build process, update project configs, and clean up documentation

The build process has been refactored to improve maintainability and productivity. This includes simplifying the .gitlab-ci.yml file by utilizing a more updated image which has the necessary dependencies pre-installed.

The Makefile has been heavily restructured to improve understandability and increase the flexibility of the build process. With these changes, the dependencies installation, uninstallation and removal of build artifacts can now be handled directly from the Makefile.

The configuration in project.json was updated, reducing redundancy and clarifying output paths.

In addition, README.md has been cleaned up to improve readability and keep the documentation up-to-date with the codebase changes. For instance, unnecessary functions in the usage section have been removed and links in the table of contents have been fixed.

Lastly, the copyright dates in the LICENSE file have been extended to include 2023 and the format improved for better readability.
This commit is contained in:
Netkas 2023-10-10 21:29:13 -04:00
parent 7895dc2464
commit 429ca491ed
No known key found for this signature in database
GPG key ID: 5DAF58535614062B
5 changed files with 58 additions and 73 deletions

View file

@ -1,43 +1,25 @@
image: php:8.1 image: repo.n64.cc:443/nosial/ncc:latest
before_script: stages:
# Install some stuff that the image doesn't come with - build
- apt update -yqq - publish
- apt install git libpq-dev libzip-dev zip make wget gnupg -yqq
# Install phive variables:
- wget -O phive.phar https://phar.io/releases/phive.phar PACKAGE_NAME: $CI_COMMIT_REF_NAME
- wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc
- gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79
- gpg --verify phive.phar.asc phive.phar
- chmod +x phive.phar
- mv phive.phar /usr/local/bin/phive
# Install phab
- phive install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
# Install the latest version of ncc (Nosial Code Compiler)
- git clone https://git.n64.cc/nosial/ncc.git
- cd ncc
- make redist
- php build/src/INSTALL --auto --install-composer
- cd .. && rm -rf ncc
build: build:
stage: build
script: script:
- ncc build --config release --log-level debug - ncc build --config release --log-level debug -o "build/release/net.nosial.optslib.ncc"
artifacts: artifacts:
paths: paths:
- build/ - "build/release/net.nosial.optslib.ncc"
rules:
- if: $CI_COMMIT_BRANCH
release: publish:
stage: deploy stage: publish
before_script:
- 'if [ "$CI_COMMIT_REF_NAME" == "master" ]; then PACKAGE_NAME="latest"; fi'
script: script:
- ncc build --config release --log-level debug - |
artifacts: curl --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" --upload-file build/release/net.nosial.optslib.ncc \
paths: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${PACKAGE_NAME}/${CI_COMMIT_SHA}/net.nosial.optslib.ncc"
- build/
rules:
- if: $CI_COMMIT_TAG

26
LICENSE
View file

@ -1,18 +1,14 @@
Copyright 2022 Nosial All Rights Reserved. Copyright 2022-2023 Nosial All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
a copy of this software and associated documentation files (the "Software"), documentation files (the "Software"), to deal in the Software without restriction, including without limitation
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
the rights to use, copy, modify, merge, publish, distribute, sublicense, permit persons to whom the Software is furnished to do so, subject to the following conditions:
and/or sell copies of the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all The above copyright notice and this permission notice shall be included in all copies or substantial portions of
copies or substantial portions of the Software. the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -1,8 +1,27 @@
release: # Variables
ncc build --config="release" NCC = ncc
PACKAGE_NAME = net.nosial.optslib.ncc
BUILD_CONFIG = release
install: # Directories
ncc package install --package="build/release/net.nosial.optslib.ncc" --skip-dependencies --reinstall -y SRC_DIR = src
BUILD_DIR = build/$(BUILD_CONFIG)
.PHONY: all release install uninstall clean
all: release install
release: prepare_build
$(NCC) build --config=$(BUILD_CONFIG)
install: prepare_build
$(NCC) package install --package="$(BUILD_DIR)/$(PACKAGE_NAME)" --skip-dependencies -y
uninstall: uninstall:
ncc package uninstall -y --package="net.nosial.optslib" $(NCC) package uninstall -y --package="$(PACKAGE_NAME)"
clean:
rm -rf $(BUILD_DIR)
prepare_build:
mkdir -p $(BUILD_DIR)

View file

@ -10,12 +10,11 @@ A basic Options parser and command-line arguments handling a library for PHP.
* [Installation](#installation) * [Installation](#installation)
* [Compiling from source](#compiling-from-source) * [Compiling from source](#compiling-from-source)
* [Usage](#usage) * [Usage](#usage)
* [parseArgument()](#parseargument--) * [parseArgument()](#parseargument)
* [getArguments()](#getarguments--) * [getArguments()](#getarguments)
* [Additional functionality](#additional-functionality) * [Additional functionality](#additional-functionality)
* [getRegex()](#getregex--) * [getRegex()](#getregex)
* [setRegex()](#setregex--) * [setRegex()](#setregex)
* [getArgsCache()](#getargscache--)
* [Changelog](#changelog) * [Changelog](#changelog)
* [License](#license) * [License](#license)
* [Logo](#logo) * [Logo](#logo)
@ -37,7 +36,6 @@ the `build.dependencies` section:
{ {
"name": "net.nosial.optslib", "name": "net.nosial.optslib",
"version": "latest", "version": "latest",
"source_type": "remote",
"source": "nosial/libs.opts=latest@n64" "source": "nosial/libs.opts=latest@n64"
} }
``` ```
@ -46,7 +44,7 @@ If you don't have the n64 source configured you can add it
by running the following command: by running the following command:
```bash ```bash
ncc source add --name n64 --type gitlab --host git.n64.cc ncc repository add --name n64 --type gitlab --host git.n64.cc
``` ```
## Compiling from source ## Compiling from source
@ -165,12 +163,6 @@ the arguments, you can modify the default pattern to suit your needs.
``` ```
### getArgsCache()
This method is used to return the arguments cache parsed from the global
`$argv` variable, this can be used as a means of troubleshooting.
## Changelog ## Changelog
For a list of changes, see the [CHANGELOG.md](CHANGELOG.md) file. For a list of changes, see the [CHANGELOG.md](CHANGELOG.md) file.

View file

@ -13,8 +13,7 @@
"host": "git.n64.cc", "host": "git.n64.cc",
"ssl": true "ssl": true
} }
}, }
"options": []
}, },
"assembly": { "assembly": {
"name": "OptsLib", "name": "OptsLib",
@ -31,10 +30,7 @@
{ {
"name": "release", "name": "release",
"build_type": "ncc", "build_type": "ncc",
"options": { "output_path": "build/release/%ASSEMBLY.PACKAGE%.ncc"
"compression": "high"
},
"output_path": "build/release"
} }
] ]
} }