diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6e78619 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +/doctum.php export-ignore diff --git a/.github/workflows/apigen.yml b/.github/workflows/apigen.yml deleted file mode 100644 index 77f2872..0000000 --- a/.github/workflows/apigen.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: ApiGen - -on: - workflow_run: - workflows: ["Unit Tests"] - branches: [master] - types: - - completed - -jobs: - Document_Generator: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: 📝 ApiGen PHP Document Generator - uses: varunsridharan/action-apigen@2.1 - with: - cached_apigen: 'no' - source_folder: 'src' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..4f83da6 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,49 @@ +name: API Docs + +on: + push: + branches: [master] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v7 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + + - name: Generate API docs + run: composer docs + + - name: Setup Pages + uses: actions/configure-pages@v6 + + - name: Upload docs + uses: actions/upload-pages-artifact@v5 + with: + path: docs + + deploy: + needs: build + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v5 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 669b0c7..ca2422e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,13 +10,13 @@ jobs: strategy: matrix: - php-versions: ['7.2', '7.3', '7.4', '8.0'] + php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5', '8.6'] os: ['ubuntu-latest', 'windows-latest'] fail-fast: false steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v7 - name: Setup PHP uses: shivammathur/setup-php@v2 diff --git a/.gitignore b/.gitignore index be66c59..8ce2a67 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ composer.phar vendor/ composer.lock -apigen.phar docs/ nbproject/ .phpunit.result.cache +doctum.phar diff --git a/apigen.neon b/apigen.neon deleted file mode 100644 index 4a7d196..0000000 --- a/apigen.neon +++ /dev/null @@ -1,4 +0,0 @@ -tree: Yes -deprecated: Yes -accessLevels: [public] -todo: Yes diff --git a/composer.json b/composer.json index 62a41f6..772763f 100644 --- a/composer.json +++ b/composer.json @@ -40,6 +40,13 @@ } }, + "scripts": { + "docs": [ + "@php -r \"is_file('doctum.phar') || passthru('curl -fsSL -o doctum.phar https://doctum.long-term.support/releases/5/doctum.phar');\"", + "@php doctum.phar update doctum.php --no-progress" + ] + }, + "funding": [ { "url": "https://github.com/sponsors/splitbrain", diff --git a/doctum.php b/doctum.php new file mode 100644 index 0000000..09f3800 --- /dev/null +++ b/doctum.php @@ -0,0 +1,25 @@ +files() + ->name('*.php') + ->in(__DIR__ . '/src'); + +$doctum = new Doctum($iterator, [ + 'title' => 'PHPArchive', + 'build_dir' => __DIR__ . '/docs', + 'cache_dir' => sys_get_temp_dir() . '/php-archive-doctum', +]); +$doctum['filter'] = function () { + return new PublicFilter(); +}; + +return $doctum; diff --git a/generate-api.sh b/generate-api.sh deleted file mode 100755 index 9449610..0000000 --- a/generate-api.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh - -# where's the source files? -SRC='src' - -# for what branch to trigger -BRANCH='master' - -# github repo -REPO='splitbrain/php-archive' - -# ---- About ------------------------------------------------------- -# -# This script use apigen to generate the documentation for the -# repository configured above. When run locally, the documentation -# will be placed in the 'docs' folder. -# However this script can also be run from travis. This requires -# the setup of a secret token as described at http://bit.ly/1MNbPn0 -# -# Additional configuration can be done within an apigen.neon file -# -# ---- no modifications below --------------------------------------- - -# when on travis, build outside of repository, otherwise locally -if [ -z "$TRAVIS" ]; then - DST='docs' -else - DST='../gh-pages' - if [ "$TRAVIS_PHP_VERSION" != '7.2' ]; then exit; fi - if [ "$TRAVIS_BRANCH" != "$BRANCH" ]; then exit; fi - if [ "$TRAVIS_PULL_REQUEST" != 'false' ]; then exit; fi - if [ -z "$GH_TOKEN" ]; then - echo "GH_TOKEN not set! See: http://bit.ly/1MNbPn0" - exit - fi -fi - -# Get ApiGen.phar -wget http://www.apigen.org/apigen.phar -O apigen.phar - -# Generate SDK Docs -php apigen.phar generate --template-theme="bootstrap" -s $SRC -d $DST - - -### if we're not on travis, we're done -if [ -z "$TRAVIS" ]; then exit; fi - -# go to the generated docs -cd $DST || exit - -# Set identity -git config --global user.email "travis@travis-ci.org" -git config --global user.name "Travis" - -# Add branch -git init -git remote add origin https://${GH_TOKEN}@github.com/${REPO}.git > /dev/null -git checkout -B gh-pages - -# Push generated files -git add . -git commit -m "Docs updated by Travis" -git push origin gh-pages -fq > /dev/null diff --git a/src/FileInfo.php b/src/FileInfo.php index 29db695..2cc1d73 100644 --- a/src/FileInfo.php +++ b/src/FileInfo.php @@ -8,7 +8,6 @@ * stores meta data about a file in an Archive * * @author Andreas Gohr - * @package splitbrain\PHPArchive * @license MIT */ class FileInfo diff --git a/src/Tar.php b/src/Tar.php index 192b37d..580f620 100644 --- a/src/Tar.php +++ b/src/Tar.php @@ -16,7 +16,6 @@ * encoding and can not be recognized as such. * * @author Andreas Gohr - * @package splitbrain\PHPArchive * @license MIT */ class Tar extends Archive diff --git a/src/Zip.php b/src/Zip.php index 641544c..3a84222 100644 --- a/src/Zip.php +++ b/src/Zip.php @@ -15,7 +15,6 @@ * converted from CP437 otherwise, which is the encoding the format prescribes for unflagged names. * * @author Andreas Gohr - * @package splitbrain\PHPArchive * @license MIT */ class Zip extends Archive