Skip to content

Commit

Permalink
List files before deletion. Add ability to delete files one by one. (#4)
Browse files Browse the repository at this point in the history
* remove composer.lock

* ignore composer.lock

* add license, author and description to composer.json

* add tests

* implement tests for existing functionality

* run tests on github actions

* ability to list files before deletingtdd

* add ability to delete files one by one
  • Loading branch information
aozisik authored Jun 4, 2022
1 parent 6332e27 commit 4eff594
Show file tree
Hide file tree
Showing 11 changed files with 353 additions and 7,804 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: run-tests

on: [push]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.0, 7.4]
dependency-version: [prefer-stable]

name: P${{ matrix.php }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none

- name: Setup Problem Matches
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install dependencies
run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction

- name: Execute tests
run: vendor/bin/phpunit
11 changes: 9 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
vendor
.php-cs-fixer.cache
# Composer
/vendor
composer.lock

# PHP CS Fixer
.php-cs-fixer.cache

# PHP Unit
.phpunit.result.cache
2 changes: 1 addition & 1 deletion .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
->notPath('vendor')
->in([
__DIR__ . '/src',
// __DIR__ . '/tests',
__DIR__ . '/tests',
])
->name('*.php')
->notName('*.blade.php')
Expand Down
38 changes: 30 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,53 @@
{
"name": "swiftmade/statamic-clear-assets",
"license": "MIT",
"type": "statamic-addon",
"description": "Deletes unused assets. Saves storage space.",
"homepage": "https://statamic.com/addons/swiftmade/clear-assets",
"authors": [
{
"name": "Ahmet Ozisik",
"email": "[email protected]",
"homepage": "https://swiftmade.co",
"role": "Founder"
}
],
"require": {
"php": "^7.4|^8.0",
"laravel/framework": "^7.30.3 || ^8.24 || ^9.0",
"statamic/cms": "^3.0.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.8",
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^4.1 || ^5.0 || ^6.0",
"orchestra/testbench": "^6.9|^7.1",
"phpunit/phpunit": "^9.5"
},
"autoload": {
"psr-4": {
"Swiftmade\\StatamicClearAssets\\": "src"
}
},
"require": {
"php": "^7.4|^8.0",
"statamic/cms": "^3.0.0"
"autoload-dev": {
"psr-4": {
"Swiftmade\\StatamicClearAssets\\Tests\\": "tests"
}
},
"extra": {
"statamic": {
"name": "Statamic Clear Assets",
"description": "Statamic Clear Assets addon"
"description": "Deletes unused assets."
},
"laravel": {
"providers": [
"Swiftmade\\StatamicClearAssets\\ServiceProvider"
]
}
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.8"
},
"config": {
"allow-plugins": {
"pixelfear/composer-dist-plugin": true
}
}
}
}
Loading

0 comments on commit 4eff594

Please sign in to comment.