Skip to content

Commit

Permalink
convert to full Symfony framework (#35)
Browse files Browse the repository at this point in the history
* feat: switch to symfony/skeleton 7.2

* chore: move AspirePress\AspireSync -> App

* refactor: rm styled output which is redundant with monolog

* docs: update README for bin/console

* refactor: rename commands to all use sync: prefix

* chore: rm bin/aspiresync

* feat: add SyncAsset and SyncResource entities

* chore: add doctrine-migrations-bindle

* feat: add migration

* feat: new docker-compose stack

* chore: switch to postgres backend
  • Loading branch information
chuckadams authored Dec 1, 2024
1 parent b6f2db2 commit fdc1ced
Show file tree
Hide file tree
Showing 108 changed files with 5,125 additions and 2,845 deletions.
7 changes: 4 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@

# Copy these directories
!bin/
!config/
!.ATTIC/config/
!src

# Copy these files
!.env
!README.md
!composer.json
!.ATTIC/composer.json
!composer.lock
!docker/php.ini
!docker/webapp/php.ini
!docker/webapp/Caddyfile
46 changes: 46 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# In all environments, the following files are loaded if they exist,
# the latter taking precedence over the former:
#
# * .env contains default values for the environment variables needed by the app
# * .env.local uncommitted file with local overrides
# * .env.$APP_ENV committed environment-specific defaults
# * .env.$APP_ENV.local uncommitted environment-specific overrides
#
# Real environment variables win over .env files.
#
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
# https://symfony.com/doc/current/configuration/secrets.html
#
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration

########## AspireSync Config

# TODO: ditch log config in here and use symfony config
# Log level may be one of: emergency | alert | critical | error | warning | notice | info | debug
# LOG_FILE=/tmp/aspiresync.log
#LOG_FILE=/dev/null
#LOG_LEVEL=debug

DOWNLOADS_FILESYSTEM=local
#DOWNLOADS_DIR=/path/to/downloads/dir

#DOWNLOADS_FILESYSTEM=s3
#S3_BUCKET=
#S3_KEY=
#S3_SECRET=
#S3_REGION=
#S3_ENDPOINT=

###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=
###< symfony/framework-bundle ###

###> doctrine/doctrine-bundle ###
# https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
#
DATABASE_URL="postgresql://postgres:[email protected]:5432/aspiresync?serverVersion=16&charset=utf8"
# DATABASE_URL="sqlite:///%kernel.project_dir%/aspiresync.sqlite"
###< doctrine/doctrine-bundle ###
14 changes: 0 additions & 14 deletions .env.dist

This file was deleted.

6 changes: 6 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# define your env variables for the test env here
KERNEL_CLASS='App\Kernel'
APP_SECRET='$ecretf0rt3st'
SYMFONY_DEPRECATIONS_HELPER=999999
PANTHER_APP_ENV=panther
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
1 change: 0 additions & 1 deletion .github/workflows/run-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:

- name: Build Dependencies
run: |
cp .env.dist .env
composer install
# not running phpcs right now, it's going to be replaced by php-cs-fixer soon
Expand Down
19 changes: 18 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
/data/
vendor/
.env
.phpcs-cache
*.sqlite
*.sqlite-journal

###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###

###> phpunit/phpunit ###
/phpunit.xml
.phpunit.result.cache
###< phpunit/phpunit ###

###> phpstan/phpstan ###
phpstan.neon
###< phpstan/phpstan ###
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ AspireSync is designed to enumerate and download the plugins and themes stored i

```shell
make
bin/aspiresync list
bin/console list sync
```

## Configuration
Expand Down
47 changes: 0 additions & 47 deletions bin/aspiresync

This file was deleted.

21 changes: 21 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env php
<?php

use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;

if (!is_dir(dirname(__DIR__) . '/vendor')) {
throw new LogicException('Dependencies are missing. Try running "composer install".');
}

if (!is_file(dirname(__DIR__) . '/vendor/autoload_runtime.php')) {
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
}

require_once dirname(__DIR__) . '/vendor/autoload_runtime.php';

return function (array $context) {
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);

return new Application($kernel);
};
151 changes: 92 additions & 59 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,62 +1,95 @@
{
"require": {
"php": "^8.3",
"ext-pdo": "*",
"ext-simplexml": "*",
"ext-sqlite3": "*",
"doctrine/dbal": "^4.2",
"guzzlehttp/guzzle": "^7.9.2",
"laminas/laminas-coding-standard": "^2.5",
"league/flysystem": "^3.29.1",
"league/flysystem-aws-s3-v3": "^3.29",
"ramsey/uuid": "^4.7.6",
"saloonphp/rate-limit-plugin": "^2.0",
"saloonphp/saloon": "^3.10",
"symfony/config": "^7.1.7",
"symfony/console": "^7.1.7",
"symfony/dependency-injection": "^7.1.6",
"symfony/dotenv": "^7.1.6",
"symfony/expression-language": "^7.1.6",
"symfony/finder": "^7.1",
"symfony/process": "^7.1.7",
"symfony/var-dumper": "^7.1.7",
"thecodingmachine/safe": "^2.5"
},
"require-dev": {
"phpstan/phpstan": "^1.12.6",
"phpunit/phpunit": "^11.4.1",
"roave/security-advisories": "dev-latest",
"thecodingmachine/phpstan-safe-rule": "^1.2"
},
"autoload": {
"psr-4": {
"AspirePress\\AspireSync\\": "./src"
"type": "project",
"license": "proprietary",
"minimum-stability": "stable",
"prefer-stable": true,
"require": {
"php": ">=8.3",
"ext-ctype": "*",
"ext-iconv": "*",
"doctrine/doctrine-bundle": ">=2.13.1",
"doctrine/doctrine-migrations-bundle": "^3.3",
"doctrine/orm": ">=3.3",
"guzzlehttp/guzzle": ">=7.9.2",
"league/flysystem": ">=3.29.1",
"league/flysystem-aws-s3-v3": ">=3.29",
"league/flysystem-bundle": ">=3.3.5",
"ramsey/uuid": ">=4.7.6",
"saloonphp/rate-limit-plugin": ">=2",
"saloonphp/saloon": ">=3.10",
"symfony/console": "7.2.*",
"symfony/dotenv": "7.2.*",
"symfony/expression-language": "7.2.*",
"symfony/flex": "^2.4.7",
"symfony/framework-bundle": "7.2.*",
"symfony/monolog-bundle": "^3.10",
"symfony/process": "7.2.*",
"symfony/runtime": "7.2.*",
"symfony/uid": "7.2.*",
"symfony/yaml": "7.2.*",
"thecodingmachine/safe": ">=2.5"
},
"require-dev": {
"phpstan/phpstan": ">=1.12.12",
"phpunit/phpunit": ">=11.4.4",
"roave/security-advisories": "dev-latest",
"symfony/maker-bundle": "^1.61",
"thecodingmachine/phpstan-safe-rule": ">=1.2"
},
"config": {
"allow-plugins": {
"php-http/discovery": true,
"symfony/flex": true,
"symfony/runtime": true
},
"bump-after-update": true,
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php72": "*",
"symfony/polyfill-php73": "*",
"symfony/polyfill-php74": "*",
"symfony/polyfill-php80": "*",
"symfony/polyfill-php81": "*",
"symfony/polyfill-php82": "*"
},
"scripts": {
"phpstan": "phpstan --verbose --memory-limit=2G",
"phpunit": "phpunit",
"test": "@phpunit",
"test:unit": "@phpunit --testsuite=Unit",
"test:functional": "@phpunit --testsuite=functional",
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": true,
"require": "7.2.*",
"docker": true
}
}
},
"autoload-dev": {
"psr-4": {
"AspirePress\\AspireSync\\Tests\\Unit\\": "./tests/unit",
"AspirePress\\AspireSync\\Tests\\Functional\\": "./tests/functional",
"AspirePress\\AspireSync\\Tests\\Stubs\\": "./tests/stubs"
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"scripts": {
"phpstan": "phpstan --verbose --memory-limit=2G",
"phpunit": "phpunit",
"phpcs": "phpcs --parallel=4",
"phpcbf": "phpcbf --parallel=4",
"test": "@phpunit",
"test:unit": "@phpunit --testsuite=unit",
"test:functional": "@phpunit --testsuite=functional",
"style:check": "@phpcs",
"style:fix": "@phpcbf"
}
}
Loading

0 comments on commit fdc1ced

Please sign in to comment.