Updated Rector to commit efc969e6411704d02e004045cb8b1da5d263970c

efc969e641 Improve setup-ci command with helper links and allow override (#3438)
This commit is contained in:
Tomas Votruba 2023-03-02 15:27:05 +00:00
parent 0e8b799327
commit 867e9441ef
5 changed files with 38 additions and 25 deletions

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api * @api
* @var string * @var string
*/ */
public const PACKAGE_VERSION = 'a7d45e469a134f8671749aaf4a9a5ea797394e3a'; public const PACKAGE_VERSION = 'efc969e6411704d02e004045cb8b1da5d263970c';
/** /**
* @api * @api
* @var string * @var string
*/ */
public const RELEASE_DATE = '2023-03-02 12:21:07'; public const RELEASE_DATE = '2023-03-02 15:22:13';
/** /**
* @var int * @var int
*/ */

View File

@ -41,22 +41,35 @@ final class SetupCICommand extends Command
$this->symfonyStyle->error('No CI detected'); $this->symfonyStyle->error('No CI detected');
return self::FAILURE; return self::FAILURE;
} }
if ($ci === CiDetector::CI_GITHUB_ACTIONS) { if ($ci !== CiDetector::CI_GITHUB_ACTIONS) {
$rectorWorkflowFilePath = \getcwd() . '/.github/workflows/rector.yaml'; $noteMessage = \sprintf('Only Github Action is supported for now.%sCreate an issue to add your CI %s', \PHP_EOL, 'https://github.com/rectorphp/rector/issues/');
if (\file_exists($rectorWorkflowFilePath)) { $this->symfonyStyle->note($noteMessage);
$this->symfonyStyle->warning('The "rector.yaml" workflow already exists'); return self::SUCCESS;
}
$rectorWorkflowFilePath = \getcwd() . '/.github/workflows/rector.yaml';
if (\file_exists($rectorWorkflowFilePath)) {
$response = $this->symfonyStyle->ask('The "rector.yaml" workflow already exists. Overwrite it?', 'Yes');
if (!\in_array($response, ['y', 'yes', 'Yes'], \true)) {
$this->symfonyStyle->note('Nothing changed');
return self::SUCCESS; return self::SUCCESS;
} }
$currentRepository = $this->resolveCurrentRepositoryName(\getcwd());
if ($currentRepository === null) {
$this->symfonyStyle->error('Current repository name could not be resolved');
return self::FAILURE;
}
$workflowTemplate = FileSystem::read(__DIR__ . '/../../../templates/rector-github-action-check.yaml');
$workflowContents = \strtr($workflowTemplate, ['__CURRENT_REPOSITORY__' => $currentRepository]);
FileSystem::write($rectorWorkflowFilePath, $workflowContents);
$this->symfonyStyle->success('The "rector.yaml" workflow was added');
} }
$currentRepository = $this->resolveCurrentRepositoryName(\getcwd());
if ($currentRepository === null) {
$this->symfonyStyle->error('Current repository name could not be resolved');
return self::FAILURE;
}
$workflowTemplate = FileSystem::read(__DIR__ . '/../../../templates/rector-github-action-check.yaml');
$workflowContents = \strtr($workflowTemplate, ['__CURRENT_REPOSITORY__' => $currentRepository]);
FileSystem::write($rectorWorkflowFilePath, $workflowContents);
$this->symfonyStyle->newLine();
$this->symfonyStyle->note('The "rector.yaml" workflow was added');
$this->symfonyStyle->newLine();
$this->symfonyStyle->title('2 steps more to run you Github Action:');
$this->symfonyStyle->writeln('1) Generate new Github Token here:' . \PHP_EOL . 'https://github.com/settings/tokens/new');
$this->symfonyStyle->newLine();
$this->symfonyStyle->writeln('2) Add it to your repository secrets under "GITHUB_TOKE" name:' . \PHP_EOL . \sprintf('https://github.com/%s/settings/secrets/actions/new', $currentRepository));
$this->symfonyStyle->newLine();
return Command::SUCCESS; return Command::SUCCESS;
} }
/** /**

2
vendor/autoload.php vendored
View File

@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php'; require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInite4770c262ed48ac8d5798b18be9cb769::getLoader(); return ComposerAutoloaderInit9823ecb4d7a2d3b55a3976916fa0bfb2::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer // autoload_real.php @generated by Composer
class ComposerAutoloaderInite4770c262ed48ac8d5798b18be9cb769 class ComposerAutoloaderInit9823ecb4d7a2d3b55a3976916fa0bfb2
{ {
private static $loader; private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInite4770c262ed48ac8d5798b18be9cb769
return self::$loader; return self::$loader;
} }
spl_autoload_register(array('ComposerAutoloaderInite4770c262ed48ac8d5798b18be9cb769', 'loadClassLoader'), true, true); spl_autoload_register(array('ComposerAutoloaderInit9823ecb4d7a2d3b55a3976916fa0bfb2', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInite4770c262ed48ac8d5798b18be9cb769', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInit9823ecb4d7a2d3b55a3976916fa0bfb2', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php'; require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInite4770c262ed48ac8d5798b18be9cb769::getInitializer($loader)); call_user_func(\Composer\Autoload\ComposerStaticInit9823ecb4d7a2d3b55a3976916fa0bfb2::getInitializer($loader));
$loader->setClassMapAuthoritative(true); $loader->setClassMapAuthoritative(true);
$loader->register(true); $loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInite4770c262ed48ac8d5798b18be9cb769::$files; $filesToLoad = \Composer\Autoload\ComposerStaticInit9823ecb4d7a2d3b55a3976916fa0bfb2::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) { $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload; namespace Composer\Autoload;
class ComposerStaticInite4770c262ed48ac8d5798b18be9cb769 class ComposerStaticInit9823ecb4d7a2d3b55a3976916fa0bfb2
{ {
public static $files = array ( public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3148,9 +3148,9 @@ class ComposerStaticInite4770c262ed48ac8d5798b18be9cb769
public static function getInitializer(ClassLoader $loader) public static function getInitializer(ClassLoader $loader)
{ {
return \Closure::bind(function () use ($loader) { return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInite4770c262ed48ac8d5798b18be9cb769::$prefixLengthsPsr4; $loader->prefixLengthsPsr4 = ComposerStaticInit9823ecb4d7a2d3b55a3976916fa0bfb2::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInite4770c262ed48ac8d5798b18be9cb769::$prefixDirsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInit9823ecb4d7a2d3b55a3976916fa0bfb2::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInite4770c262ed48ac8d5798b18be9cb769::$classMap; $loader->classMap = ComposerStaticInit9823ecb4d7a2d3b55a3976916fa0bfb2::$classMap;
}, null, ClassLoader::class); }, null, ClassLoader::class);
} }