Skip to content
Merged

V5 #131

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 17 additions & 13 deletions .github/workflows/pest-tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
name: Pest Tests

on: [ 'push', 'pull_request' ]
on:
push:
paths:
- "**.php"
- "composer.lock"
pull_request:
paths:
- "**.php"
- "composer.lock"

jobs:
test:
Expand All @@ -24,16 +32,12 @@ jobs:
key: composer-${{ hashFiles('composer.lock') }}

- name: Install
run: composer install --no-interaction --prefer-dist --optimize-autoloader

- name: PEST
run: composer coverage

# - name: Test & publish code coverage
# uses: paambaati/[email protected]
# with:
# coverageCommand: composer coverage
# coverageLocations: ${{github.workspace}}/tests/clover.xml:clover
# env:
# CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: composer kirby

- name: Test & publish code coverage
uses: paambaati/[email protected]
with:
coverageCommand: vendor/bin/pest --ci
coverageLocations: ${{github.workspace}}/tests/clover.xml:clover
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
7 changes: 2 additions & 5 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ jobs:
key: composer-${{ hashFiles('composer.lock') }}

- name: Install
run: |
composer install --no-interaction --prefer-dist --optimize-autoloader
run: composer kirby

- name: Run PHPStan
run: |
php tests/patch.php
./vendor/bin/phpstan --error-format=github
run: vendor/bin/phpstan --error-format=github
36 changes: 30 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# Kirby Janitor

![Release](https://flat.badgen.net/packagist/v/bnomei/kirby3-janitor?color=ae81ff)
![Downloads](https://flat.badgen.net/packagist/dt/bnomei/kirby3-janitor?color=272822)
[![Coverage](https://flat.badgen.net/codeclimate/coverage/bnomei/kirby3-janitor)](https://flat.badgen.net/codeclimate/coverage/bnomei/kirby3-janitor)
[![Maintainability](https://flat.badgen.net/codeclimate/maintainability/bnomei/kirby3-janitor)](https://codeclimate.com/github/bnomei/kirby3-janitor)
[![Discord](https://flat.badgen.net/badge/discord/bnomei?color=7289da)](https://discordapp.com/users/bnomei)
[![Kirby 5](https://flat.badgen.net/badge/Kirby/5?color=ECC748)](https://getkirby.com)
![PHP 8.2](https://flat.badgen.net/badge/PHP/8.2?color=4E5B93&icon=php&label)
![Release](https://flat.badgen.net/packagist/v/bnomei/kirby3-janitor?color=ae81ff&icon=github&label)
![Downloads](https://flat.badgen.net/packagist/dt/bnomei/kirby3-janitor?color=272822&icon=github&label)
[![Coverage](https://flat.badgen.net/codeclimate/coverage/bnomei/kirby3-janitor?icon=codeclimate&label)](https://codeclimate.com/github/bnomei/kirby3-janitor)
[![Maintainability](https://flat.badgen.net/codeclimate/maintainability/bnomei/kirby3-janitor?icon=codeclimate&label)](https://codeclimate.com/github/bnomei/kirby3-janitor/issues)
[![Discord](https://flat.badgen.net/badge/discord/bnomei?color=7289da&icon=discord&label)](https://discordapp.com/users/bnomei)
[![Buymecoffee](https://flat.badgen.net/badge/icon/donate?icon=buymeacoffee&color=FF813F&label)](https://www.buymeacoffee.com/bnomei)

Kirby Plugin for running commands.

Janitor is a Kirby CMS Plugin for running commands.

- It is a Panel Button!
- It has commands built-in for cleaning the cache, sessions, create zip-backup, pre-generate thumbs, open URLs, refresh the current Panel page and more.
Expand Down Expand Up @@ -78,6 +82,21 @@ return [

```

### View Buttons

You can also use Janitor to create up to 10 custom [view buttons](https://getkirby.com/releases/5/view-buttons#custom-vue-component).

**site/blueprints/page/default.yml**
```yml
buttons:
janitor: # or janitor_1, janitor_2, ... janitor_9
command: whistle
label: Whistle
icon: audio
preview: true
settings: true
```

### Callback

Instead of using a command you can also create a callback in a custom plugin options or any config file.
Expand Down Expand Up @@ -169,6 +188,7 @@ In either the command or the callback you will be setting/returning data to the
- `icon`, see `icon`-field option
- `label`, see `label`-field option
- `message`, see `message`-field option
- `notification`, array of method and message, like `['success', 'Deployed!']`
- `open`, URL to open, use with `intab`-field option to open in a new tab
- `reload`, if `true` will reload panel view once api call is received
- `success`, see `success`-field option
Expand Down Expand Up @@ -401,6 +421,10 @@ return [

You can also overwrite the maintenance snippet if you create your own and store it as `site/snippets/maintenance.php`.

## Tinker(well), REPL and Debugging

You can use the `kirby janitor:tinker` command to start a REPL session in the terminal. This is a great way to test code snippets, debug and explore your Kirby installation. Another alternative would be using the [Tinkerwell App](https://tinkerwell.app/) which has built-in support for Kirby as long as it can find the `./kirby/bootstrap.php` file via the matching [driver](https://github.com/beyondcode/tinkerwell/blob/58254e11a6aad428eefd63b1ae624b0568414227/src/Drivers/KirbyTinkerwellDriver.php#L14).

## Dependencies

- [Kirby CLI](https://github.com/getkirby/cli)
Expand Down
24 changes: 11 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bnomei/kirby3-janitor",
"type": "kirby-plugin",
"version": "4.4.2",
"version": "5.0.0",
"license": "MIT",
"homepage": "https://github.com/bnomei/kirby3-janitor",
"description": "Kirby Plugin for running commands like cleaning the cache from within the Panel, PHP code or a cronjob",
Expand Down Expand Up @@ -50,24 +50,20 @@
"symfony/finder": "^7.0"
},
"require-dev": {
"getkirby/cli": "dev-develop",
"getkirby/cms": "^4.3.0",
"larastan/larastan": "^2.9",
"getkirby/cli": "^1.5.0",
"getkirby/cms": "dev-v5/develop",
"larastan/larastan": "^v3.0.0",
"laravel/pint": "^1.13",
"pestphp/pest": "^2.24",
"pestphp/pest-plugin-type-coverage": "^2.4",
"pestphp/pest": "^v3.5.1",
"spatie/ray": "^1.39"
},
"scripts": {
"analyze": "./vendor/bin/phpstan",
"stan": "./vendor/bin/phpstan",
"fix": "./vendor/bin/pint",
"test": "./vendor/bin/pest",
"coverage": [
"php tests/patch.php",
"php ./vendor/bin/pest --coverage --coverage-clover=tests/clover.xml"
],
"test": "./vendor/bin/pest --profile",
"dist": [
"npm run format",
"npm run build",
"composer fix",
"composer install --no-dev --optimize-autoloader",
"git rm -rf --cached .; git add .;"
Expand All @@ -77,7 +73,9 @@
"composer install",
"composer update",
"composer install --working-dir=tests/kirby --no-dev --optimize-autoloader",
"composer update --working-dir=tests/kirby"
"composer update --working-dir=tests/kirby",
"sed -i.bak 's/function dump(/function xdump(/g' tests/kirby/config/helpers.php",
"sed -i.bak 's/function e(/function xe(/g' tests/kirby/config/helpers.php"
]
},
"extra": {
Expand Down
Loading
Loading