diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c416e4a..ddd1b0b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,43 +1,25 @@ -image: php:8.1 +image: repo.n64.cc:443/nosial/ncc:latest -before_script: - # Install some stuff that the image doesn't come with - - apt update -yqq - - apt install git libpq-dev libzip-dev zip make wget gnupg -yqq +stages: + - build + - publish - # Install phive - - wget -O phive.phar https://phar.io/releases/phive.phar - - 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 +variables: + PACKAGE_NAME: $CI_COMMIT_REF_NAME build: + stage: build script: - - ncc build --config release --log-level debug + - ncc build --config release --log-level debug -o "build/release/net.nosial.optslib.ncc" artifacts: paths: - - build/ - rules: - - if: $CI_COMMIT_BRANCH + - "build/release/net.nosial.optslib.ncc" -release: - stage: deploy +publish: + stage: publish + before_script: + - 'if [ "$CI_COMMIT_REF_NAME" == "master" ]; then PACKAGE_NAME="latest"; fi' script: - - ncc build --config release --log-level debug - artifacts: - paths: - - build/ - rules: - - if: $CI_COMMIT_TAG \ No newline at end of file + - | + curl --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" --upload-file build/release/net.nosial.optslib.ncc \ + "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${PACKAGE_NAME}/${CI_COMMIT_SHA}/net.nosial.optslib.ncc" \ No newline at end of file diff --git a/LICENSE b/LICENSE index 10ffa64..7d57fa6 100644 --- a/LICENSE +++ b/LICENSE @@ -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 -a copy of this software and associated documentation files (the "Software"), - 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 permit persons to whom the Software - is furnished to do so, subject to the following conditions: +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 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 +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 -copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of +the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF -CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS +OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/Makefile b/Makefile index 5664ff5..7ed6723 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,27 @@ -release: - ncc build --config="release" +# Variables +NCC = ncc +PACKAGE_NAME = net.nosial.optslib.ncc +BUILD_CONFIG = release -install: - ncc package install --package="build/release/net.nosial.optslib.ncc" --skip-dependencies --reinstall -y +# Directories +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: - ncc package uninstall -y --package="net.nosial.optslib" \ No newline at end of file + $(NCC) package uninstall -y --package="$(PACKAGE_NAME)" + +clean: + rm -rf $(BUILD_DIR) + +prepare_build: + mkdir -p $(BUILD_DIR) \ No newline at end of file diff --git a/README.md b/README.md index 4d3232a..7bd2746 100644 --- a/README.md +++ b/README.md @@ -10,12 +10,11 @@ A basic Options parser and command-line arguments handling a library for PHP. * [Installation](#installation) * [Compiling from source](#compiling-from-source) * [Usage](#usage) - * [parseArgument()](#parseargument--) - * [getArguments()](#getarguments--) + * [parseArgument()](#parseargument) + * [getArguments()](#getarguments) * [Additional functionality](#additional-functionality) - * [getRegex()](#getregex--) - * [setRegex()](#setregex--) - * [getArgsCache()](#getargscache--) + * [getRegex()](#getregex) + * [setRegex()](#setregex) * [Changelog](#changelog) * [License](#license) * [Logo](#logo) @@ -37,7 +36,6 @@ the `build.dependencies` section: { "name": "net.nosial.optslib", "version": "latest", - "source_type": "remote", "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: ```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 @@ -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 For a list of changes, see the [CHANGELOG.md](CHANGELOG.md) file. diff --git a/project.json b/project.json index 67e9b0f..a7393af 100644 --- a/project.json +++ b/project.json @@ -13,8 +13,7 @@ "host": "git.n64.cc", "ssl": true } - }, - "options": [] + } }, "assembly": { "name": "OptsLib", @@ -31,10 +30,7 @@ { "name": "release", "build_type": "ncc", - "options": { - "compression": "high" - }, - "output_path": "build/release" + "output_path": "build/release/%ASSEMBLY.PACKAGE%.ncc" } ] }