Skip to content

Commit

Permalink
Merge pull request #55 from spinupwp/44-php-8.1
Browse files Browse the repository at this point in the history
Update PHP versions supported for SpinupWP CLI
  • Loading branch information
georgefehr authored Apr 27, 2023
2 parents 7c3a0ea + d21c5a6 commit d2ce9c9
Show file tree
Hide file tree
Showing 17 changed files with 48 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
php-cs-fixer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}

Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.4', '8.0']
php-versions: ['8.0', '8.1', '8.2']
steps:
- uses: actions/[email protected]
- uses: php-actions/composer@v6
- uses: actions/checkout@v3
with:
php_version: ${{ matrix.php-versions }}
- uses: NWBY/[email protected]
ref: ${{ github.head_ref }}

- name: Install Dependencies via Composer
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- name: Run tests
run: composer test
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ php spinupwp app:build spinupwp

Commit the changes to the main branch.

On GitHub, [create a new release](https://github.com/deliciousbrains/spinupwp-cli/releases/new). Set the tag and release title to the semantic version, but prepend the letter **v**. For example, if releasing version `1.1.1`, the tag and release title should be `v1.1.1`. Leave target set to main and add any release notes to the description field.
On GitHub, [create a new release](https://github.com/spinupwp/spinupwp-cli/releases/new). Set the tag and release title to the semantic version, but prepend the letter **v**. For example, if releasing version `1.1.1`, the tag and release title should be `v1.1.1`. Leave target set to main and add any release notes to the description field.

Hit 'Publish release' to finalize the release. This will automatically update [Packagist](https://packagist.org/packages/deliciousbrains/spinupwp-cli) with the latest version.
Hit 'Publish release' to finalize the release. This will automatically update [Packagist](https://packagist.org/packages/spinupwp/spinupwp-cli) with the latest version.
4 changes: 2 additions & 2 deletions app/Commands/BaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
use App\Commands\Concerns\InteractsWithIO;
use App\Repositories\ConfigRepository;
use App\Repositories\SpinupWpRepository;
use DeliciousBrains\SpinupWp\Exceptions\ValidationException;
use Exception;
use GuzzleHttp\Client;
use Illuminate\Support\Str;
use LaravelZero\Framework\Commands\Command;
use SpinupWp\Exceptions\ValidationException;

abstract class BaseCommand extends Command
{
Expand Down Expand Up @@ -82,7 +82,7 @@ protected function apiToken(): string
{
$apiToken = $this->config->get('api_token', $this->profile());

if (!$apiToken) {
if (!$apiToken || !is_string($apiToken)) {
throw new Exception("The API token for the profile {$this->profile()} is not yet configured");
}

Expand Down
2 changes: 1 addition & 1 deletion app/Commands/Concerns/InteractsWithIO.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public function queueResources(Collection $resources, string $endpoint, string $
if ($shouldWait) {
sleep(1);
}
$eventId = call_user_func(fn () => $resource->$endpoint());
$eventId = call_user_func(fn () => $resource->$endpoint());
$events[] = ["{$eventId}", $resource->{$resourcesId}];
} catch (\Exception $e) {
if ($resources->count() === 1) {
Expand Down
2 changes: 1 addition & 1 deletion app/Commands/Concerns/SpecifyFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace App\Commands\Concerns;

use App\Field;
use DeliciousBrains\SpinupWp\Resources\Resource;
use SpinupWp\Resources\Resource;

trait SpecifyFields
{
Expand Down
18 changes: 9 additions & 9 deletions app/Commands/Sites/Sites.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,29 @@ protected function setUp(): void
(new Field('HTTPS', 'https'))
->couldBeEnabledOrDisabled(),
(new Field('Database Table Prefix', 'database'))
->withIgnoreRule(fn ($value) => empty($value['table_prefix']))
->withIgnoreRule(fn ($value) => empty($value['table_prefix']))
->withTransformRule(fn ($value) => $value['table_prefix']),
(new Field('Git', 'git'))
->couldBeEnabledOrDisabled(),
(new Field('Repository', 'git'))
->withAliases(['git.repo'])
->withIgnoreRule(fn ($value) => !$value['enabled'])
->withIgnoreRule(fn ($value) => !$value['enabled'])
->withTransformRule(fn ($value) => $value['repo']),
(new Field('Branch', 'git'))
->withAliases(['git.branch'])
->withIgnoreRule(fn ($value) => !$value['enabled'])
->withIgnoreRule(fn ($value) => !$value['enabled'])
->withTransformRule(fn ($value) => $value['branch']),
(new Field('Deploy Script', 'git'))
->withAliases(['git.deploy_script'])
->withIgnoreRule(fn ($value) => !$value['enabled'])
->withIgnoreRule(fn ($value) => !$value['enabled'])
->withTransformRule(fn ($value) => $value['deploy_script']),
(new Field('Push-to-deploy', 'git'))
->withAliases(['git.push_enabled'])
->withIgnoreRule(fn ($value) => !$value['enabled'] || !$value['push_enabled'])
->withIgnoreRule(fn ($value) => !$value['enabled'] || !$value['push_enabled'])
->withTransformRule(fn ($value) => $value['push_enabled'] ? 'Enabled' : 'Disabled'),
(new Field('Deployment URL', 'git'))
->withAliases(['git.deployment_url'])
->withIgnoreRule(fn ($value) => !$value['enabled'] || !$value['push_enabled'])
->withIgnoreRule(fn ($value) => !$value['enabled'] || !$value['push_enabled'])
->withTransformRule(fn ($value) => $value['deployment_url']),
(new Field('WP Core Update', 'wp_core_update'))
->yesOrNo(),
Expand All @@ -65,11 +65,11 @@ protected function setUp(): void
->withTransformRule(fn ($value) => $value['database'] ? 'Enabled' : 'Disabled'),
(new Field('Backup Retention Period', 'backups'))
->withAliases(['backups.retention_period'])
->withIgnoreRule(fn ($value) => !$value['files'] && $value['database'])
->withIgnoreRule(fn ($value) => !$value['files'] && $value['database'])
->withTransformRule(fn ($value) => $value['retention_period'] . ' days'),
(new Field('Next Backup Time', 'backups'))
->withAliases(['backups.next_run_time'])
->withIgnoreRule(fn ($value) => !(bool) $value['next_run_time'])
->withIgnoreRule(fn ($value) => !(bool) $value['next_run_time'])
->withTransformRule(fn ($value) => $value['next_run_time']),
(new Field('Uploads Directory Protection', 'nginx'))
->withAliases(['nginx.uploads_directory_protected'])
Expand All @@ -84,7 +84,7 @@ protected function setUp(): void
->couldBeEnabledOrDisabled(),
(new Field('Basic Auth Username', 'basic_auth'))
->withAliases(['basic_auth.username'])
->withIgnoreRule(fn ($value) => !$value['enabled'])
->withIgnoreRule(fn ($value) => !$value['enabled'])
->withTransformRule(fn ($value) => $value['username']),
(new Field('Created At', 'created_at')),
(new Field('Status', 'status'))
Expand Down
2 changes: 1 addition & 1 deletion app/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace App;

use Closure;
use DeliciousBrains\SpinupWp\Resources\Resource;
use SpinupWp\Resources\Resource;

class Field
{
Expand Down
2 changes: 1 addition & 1 deletion app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use App\Repositories\ConfigRepository;
use App\Repositories\SpinupWpRepository;
use DeliciousBrains\SpinupWp\SpinupWp;
use Illuminate\Support\ServiceProvider;
use SpinupWp\SpinupWp;

class AppServiceProvider extends ServiceProvider
{
Expand Down
13 changes: 6 additions & 7 deletions app/Repositories/SpinupWpRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

namespace App\Repositories;

use App\Helpers\OptionsHelper;
use DeliciousBrains\SpinupWp\Endpoints\Event;
use DeliciousBrains\SpinupWp\Endpoints\Server;
use DeliciousBrains\SpinupWp\Endpoints\Site;
use DeliciousBrains\SpinupWp\Resources\Server as ServerResource;
use DeliciousBrains\SpinupWp\Resources\Site as SiteResource;
use DeliciousBrains\SpinupWp\SpinupWp;
use GuzzleHttp\Client;
use Illuminate\Support\Collection;
use SpinupWp\Endpoints\Event;
use SpinupWp\Endpoints\Server;
use SpinupWp\Endpoints\Site;
use SpinupWp\Resources\Server as ServerResource;
use SpinupWp\Resources\Site as SiteResource;
use SpinupWp\SpinupWp;

/**
* @method SpinupWp setApiKey(string $apiKey)
Expand Down
Binary file added bin/box
Binary file not shown.
Binary file modified builds/spinupwp
Binary file not shown.
13 changes: 8 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
"keywords": ["spinupwp", "cli"],
"license": "MIT",
"require": {
"php": "^7.4|^8.0",
"spinupwp/spinupwp-php-sdk": "^0.5.2"
"php": "^8.0",
"spinupwp/spinupwp-php-sdk": "^1.0.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.2",
"laravel-zero/framework": "^8.9",
"laravel-zero/framework": "<=9.2.0",
"mockery/mockery": "^1.4.3",
"pestphp/pest": "^1.3",
"phpstan/phpstan": "^0.12.99"
"phpstan/phpstan": "^1.8"
},
"autoload": {
"psr-4": {
Expand All @@ -27,7 +27,10 @@
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
"optimize-autoloader": true,
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand Down
2 changes: 1 addition & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
|
*/

'version' => '1.0.0',
'version' => '1.1.0',

/*
|--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion config/commands.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
*/

'remove' => [
// ..
\LaravelZero\Framework\Commands\TestMakeCommand::class,
],

];
6 changes: 3 additions & 3 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ parameters:
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
universalObjectCratesClasses:
- DeliciousBrains\SpinupWp\Resources\Resource
- DeliciousBrains\SpinupWp\Endpoints\Endpoint
excludes_analyse:
- SpinupWp\Resources\Resource
- SpinupWp\Endpoints\Endpoint
excludePaths:
- vendor/*
- tests/*
4 changes: 2 additions & 2 deletions tests/Feature/Commands/SitesGetCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
'wp_plugin_updates' => 3,
'git' => [
'enabled' => true,
'repo' => '[email protected]:deliciousbrains/spinupwp-composer-site.git',
'repo' => '[email protected]:spinupwp/spinupwp-composer-site.git',
'branch' => 'main',
'deploy_script' => 'composer install --optimize-autoload --no-dev',
'push_enabled' => true,
Expand Down Expand Up @@ -108,7 +108,7 @@
->expectsTable([], [
['Domain', 'hellfish.media'],
['Git', 'Enabled'],
['Repository', '[email protected]:deliciousbrains/spinupwp-composer-site.git'],
['Repository', '[email protected]:spinupwp/spinupwp-composer-site.git'],
['Branch', 'main'],
['Deploy Script', 'composer install --optimize-autoload --no-dev'],
['Push-to-deploy', 'Enabled'],
Expand Down

0 comments on commit d2ce9c9

Please sign in to comment.