Skip to content

Commit

Permalink
chore: Bumped
Browse files Browse the repository at this point in the history
  • Loading branch information
roadiz-ci committed Oct 11, 2024
1 parent c2723a9 commit 2e52029
Show file tree
Hide file tree
Showing 14 changed files with 323 additions and 219 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['8.1', '8.2', '8.3']
php-version: ['8.0', '8.1']
steps:
- uses: shivammathur/setup-php@v2
with:
Expand Down
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
language: php
sudo: required
php:
- 7.4
- 8.0
- 8.1
- nightly
install:
- curl -s http://getcomposer.org/installer | php
- php composer.phar install --dev --no-interaction
script:
- vendor/bin/phpcs --report=full --report-file=./report.txt -p ./src
- vendor/bin/phpstan analyse -c phpstan.neon
jobs:
allow_failures:
- php: nightly
27 changes: 13 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,26 @@
}
],
"type": "symfony-bundle",
"prefer-stable": true,
"require": {
"php": ">=8.1",
"php": ">=8.0",
"pimple/pimple": "^3.3.1",
"roadiz/core-bundle": "2.2.*",
"roadiz/openid": "2.2.*",
"roadiz/core-bundle": "2.1.*",
"roadiz/openid": "2.1.*",
"symfony/framework-bundle": "5.4.*"
},
"require-dev": {
"php-coveralls/php-coveralls": "^2.4",
"phpstan/phpstan": "^1.5.3",
"phpstan/phpstan-doctrine": "^1.3",
"phpstan/phpstan-symfony": "^1.1.8",
"roadiz/doc-generator": "2.2.*",
"roadiz/documents": "2.2.*",
"roadiz/dts-generator": "2.2.*",
"roadiz/entity-generator": "2.2.*",
"roadiz/jwt": "2.2.*",
"roadiz/markdown": "2.2.*",
"roadiz/models": "2.2.*",
"roadiz/random": "2.2.*",
"roadiz/doc-generator": "2.1.*",
"roadiz/documents": "2.1.*",
"roadiz/dts-generator": "2.1.*",
"roadiz/entity-generator": "2.1.*",
"roadiz/jwt": "2.1.*",
"roadiz/markdown": "2.1.*",
"roadiz/models": "2.1.*",
"roadiz/random": "2.1.*",
"squizlabs/php_codesniffer": "^3.5"
},
"config": {
Expand All @@ -60,8 +59,8 @@
},
"extra": {
"branch-alias": {
"dev-main": "2.2.x-dev",
"dev-develop": "2.3.x-dev"
"dev-main": "2.1.x-dev",
"dev-develop": "2.2.x-dev"
}
}
}
5 changes: 5 additions & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ services:
rolesBag:
alias: RZ\Roadiz\CoreBundle\Bag\Roles
public: true
assetPackages:
alias: RZ\Roadiz\Documents\Packages
deprecated: ~
public: true
Symfony\Contracts\Translation\TranslatorInterface:
alias: 'translator.default'
public: true
Expand Down Expand Up @@ -116,4 +120,5 @@ services:
RZ\Roadiz\CompatBundle\EventSubscriber\ExceptionSubscriber:
arguments:
- '@RZ\Roadiz\CompatBundle\Theme\ThemeResolverInterface'
- '@RZ\Roadiz\CoreBundle\Exception\ExceptionViewer'
- '@service_container'
2 changes: 0 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ parameters:
- '#Doctrine\\ORM\\Mapping\\GeneratedValue constructor expects#'
- '#type mapping mismatch: property can contain Doctrine\\Common\\Collections\\Collection<int, [^\>]+> but database expects Doctrine\\Common\\Collections\\Collection&iterable<[^\>]+>#'
- '#should return Doctrine\\Common\\Collections\\Collection<int, [^\>]+Interface> but returns Doctrine\\Common\\Collections\\Collection<int, [^\>]+>#'
- '#but returns Doctrine\\Common\\Collections\\ReadableCollection<int, [^\>]+>#'
- '#does not accept Doctrine\\Common\\Collections\\ReadableCollection<int, [^\>]+>#'

reportUnmatchedIgnoredErrors: false
checkGenericClassInNonGenericObjectType: false
Expand Down
5 changes: 4 additions & 1 deletion src/Aliases.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public static function getAliases(): array
\RZ\Roadiz\CoreBundle\Entity\Folder::class => \RZ\Roadiz\Core\Entities\Folder::class,
\RZ\Roadiz\CoreBundle\Entity\FolderTranslation::class => \RZ\Roadiz\Core\Entities\FolderTranslation::class,
\RZ\Roadiz\CoreBundle\Entity\Group::class => \RZ\Roadiz\Core\Entities\Group::class,
\RZ\Roadiz\CoreBundle\Logger\Entity\Log::class => \RZ\Roadiz\Core\Entities\Log::class,
\RZ\Roadiz\CoreBundle\Entity\Log::class => \RZ\Roadiz\Core\Entities\Log::class,
\RZ\Roadiz\CoreBundle\Entity\LoginAttempt::class => \RZ\Roadiz\Core\Entities\LoginAttempt::class,
\RZ\Roadiz\CoreBundle\Entity\Node::class => \RZ\Roadiz\Core\Entities\Node::class,
\RZ\Roadiz\CoreBundle\Entity\NodeType::class => \RZ\Roadiz\Core\Entities\NodeType::class,
\RZ\Roadiz\CoreBundle\Entity\NodeTypeField::class => \RZ\Roadiz\Core\Entities\NodeTypeField::class,
Expand Down Expand Up @@ -168,6 +169,8 @@ public static function getAliases(): array
\RZ\Roadiz\CoreBundle\Form\Constraint\RecaptchaValidator::class => \RZ\Roadiz\CMS\Forms\Constraints\RecaptchaValidator::class,
\RZ\Roadiz\CoreBundle\Form\Constraint\SimpleLatinString::class => \RZ\Roadiz\CMS\Forms\Constraints\SimpleLatinString::class,
\RZ\Roadiz\CoreBundle\Form\Constraint\SimpleLatinStringValidator::class => \RZ\Roadiz\CMS\Forms\Constraints\SimpleLatinStringValidator::class,
\RZ\Roadiz\CoreBundle\Form\Constraint\UniqueEntity::class => \RZ\Roadiz\CMS\Forms\Constraints\UniqueEntity::class,
\RZ\Roadiz\CoreBundle\Form\Constraint\UniqueEntityValidator::class => \RZ\Roadiz\CMS\Forms\Constraints\UniqueEntityValidator::class,
\RZ\Roadiz\CoreBundle\Form\Constraint\UniqueFilename::class => \RZ\Roadiz\CMS\Forms\Constraints\UniqueFilename::class,
\RZ\Roadiz\CoreBundle\Form\Constraint\UniqueFilenameValidator::class => \RZ\Roadiz\CMS\Forms\Constraints\UniqueFilenameValidator::class,
\RZ\Roadiz\CoreBundle\Form\Constraint\UniqueNodeName::class => \RZ\Roadiz\CMS\Forms\Constraints\UniqueNodeName::class,
Expand Down
106 changes: 106 additions & 0 deletions src/Console/ThemeGenerateCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?php

declare(strict_types=1);

namespace RZ\Roadiz\CompatBundle\Console;

use RZ\Roadiz\CompatBundle\Theme\ThemeGenerator;
use RZ\Roadiz\CompatBundle\Theme\ThemeInfo;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;

class ThemeGenerateCommand extends Command
{
protected string $projectDir;
protected ThemeGenerator $themeGenerator;

public function __construct(string $projectDir, ThemeGenerator $themeGenerator)
{
parent::__construct();
$this->projectDir = $projectDir;
$this->themeGenerator = $themeGenerator;
}

protected function configure(): void
{
$this->setName('themes:generate')
->setDescription('Generate a new theme based on BaseTheme boilerplate. <info>Requires "find", "sed" and "git" commands.</info>')
->addArgument(
'name',
InputArgument::REQUIRED,
'Theme name (without the "Theme" suffix)'
)
->addOption(
'develop',
'd',
InputOption::VALUE_NONE,
'Use BaseTheme develop branch instead of master.'
)
->addOption(
'branch',
'b',
InputOption::VALUE_REQUIRED,
'Choose BaseTheme branch.'
)
->addOption('symlink', null, InputOption::VALUE_NONE, 'Symlinks the theme assets instead of copying it')
->addOption('relative', null, InputOption::VALUE_NONE, 'Make relative symlinks')
;
}

/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
$branch = 'master';
if ($input->getOption('develop')) {
$branch = 'develop';
}
if ($input->getOption('branch')) {
$branch = $input->getOption('branch');
}
if ($input->getOption('relative')) {
$expectedMethod = ThemeGenerator::METHOD_RELATIVE_SYMLINK;
} elseif ($input->getOption('symlink')) {
$expectedMethod = ThemeGenerator::METHOD_ABSOLUTE_SYMLINK;
} else {
$expectedMethod = ThemeGenerator::METHOD_COPY;
}

$name = str_replace('/', '\\', $input->getArgument('name'));
$themeInfo = new ThemeInfo($name, $this->projectDir);

if (
$io->confirm(
'Are you sure you want to generate a new theme called: "' . $themeInfo->getThemeName() . '"' .
' using ' . $branch . ' branch and installing its assets with ' . $expectedMethod . ' method?',
false
)
) {
if (!$themeInfo->exists()) {
$this->themeGenerator->downloadTheme($themeInfo, $branch);
$io->success('BaseTheme cloned into ' . $themeInfo->getThemePath());
}

$this->themeGenerator->renameTheme($themeInfo);
$this->themeGenerator->installThemeAssets($themeInfo, $expectedMethod);

$io->note([
'Register your theme into your config/packages/roadiz_core.yaml configuration file',
'---',
'themes:',
' - classname: ' . $themeInfo->getClassname(),
]);
$io->success($themeInfo->getThemeName() . ' has been regenerated and is ready to be installed, have fun!');
}

return 0;
}
}
18 changes: 10 additions & 8 deletions src/Console/ThemeInstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@

/**
* Command line utils for managing themes from terminal.
*
* @deprecated Use RZ\Roadiz\CoreBundle\Console\AppInstallCommand instead.
*/
class ThemeInstallCommand extends Command
{
Expand Down Expand Up @@ -147,7 +145,7 @@ protected function importThemeData(?ThemeInfo $themeInfo, string $themeConfigPat
{
$data = $this->getThemeConfig($themeConfigPath);

if (isset($data["importFiles"])) {
if (false !== $data && isset($data["importFiles"])) {
if (isset($data["importFiles"]['groups'])) {
foreach ($data["importFiles"]['groups'] as $filename) {
$this->importFile($themeInfo, $filename, $this->groupsImporter);
Expand Down Expand Up @@ -178,6 +176,14 @@ protected function importThemeData(?ThemeInfo $themeInfo, string $themeConfigPat
$this->importFile($themeInfo, $filename, $this->attributeImporter);
}
}
if ($this->io->isVeryVerbose()) {
$this->io->note(
'You should do a `bin/console generate:nsentities`' .
' to regenerate your node-types source classes, ' .
'and a `bin/console doctrine:schema:update --dump-sql --force` ' .
'to apply your changes into database.'
);
}
} else {
$this->io->warning('Config file "' . $themeConfigPath . '" has no data to import.');
}
Expand Down Expand Up @@ -229,10 +235,6 @@ protected function getThemeConfig(string $themeConfigPath): array
if (false === $fileContent = file_get_contents($themeConfigPath)) {
throw new \RuntimeException($themeConfigPath . ' file is not readable');
}
$data = Yaml::parse($fileContent);
if (!\is_array($data)) {
throw new \RuntimeException($themeConfigPath . ' file is not a valid YAML file');
}
return $data;
return Yaml::parse($fileContent);
}
}
Loading

0 comments on commit 2e52029

Please sign in to comment.