Skip to content
Snippets Groups Projects

Issue #3316721: Add script to convert this module into a core merge request

Merged Issue #3316721: Add script to convert this module into a core merge request
2 unresolved threads
2 unresolved threads
1 file
+ 16
3
Compare changes
  • Side-by-side
  • Inline
+ 16
3
@@ -10,6 +10,10 @@ use Symfony\Component\Filesystem\Filesystem;
*/
class Converter {
private static function info(string $msg) {
print "\n$msg";
}
public static function doConvert(Event $event) {
$args = $event->getArguments();
if (count($args) !== 2) {
@@ -24,6 +28,7 @@ class Converter {
$new_machine_name = 'auto_updates';
static::switchToBranches($core_dir, $core_branch);
self::info('Switched branches');
$fs = new Filesystem();
@@ -31,11 +36,12 @@ class Converter {
$package_manager_core_path = $core_dir . "/core/modules/package_manager";
// Remove old module
$fs->remove($core_module_path);
self::info('Removed old core module');
$fs->remove($package_manager_core_path);
self::info("Removed package manager");
// Copy the contrib module to core.
exit();
$fs->mirror(self::getContribDir(), $core_module_path );
self::info('Mirrored into core module');
// Remove unneeded
$removals = [
@@ -54,6 +60,7 @@ class Converter {
];
$removals = array_map(function ($path) use ($core_module_path) { return "$core_module_path/$path"; }, $removals);
$fs->remove($removals);
self::info('Remove not needed');
// Replace in file names and contents.
@@ -66,21 +73,27 @@ class Converter {
static::renameFiles($search, $replace);
static::replaceContents($search, $replace);
}
self::info('Replacements done.');
static::removeLines();
self::info('Remove unneeded lines');
$fs->rename("$core_module_path/package_manager", $core_dir . "/core/modules/package_manager");
self::info('Move package manager');
static::addWordsToDictionary($core_dir, [
'syncer',
'syncers',
'unwritable',
]);
self::info("Added to dictionary");
static::runCoreChecks($core_dir);
self::info('Ran core checks');
static::makeCommit($core_dir);
self::info('Make commit');
/**
* @todo Commit with the specific commit from contrib.
*/
print "\Done. Probably good but you should check before you push.";
self::info("Done. Probably good but you should check before you push.");
}
private static function getContribDir() {
Loading