#!/usr/bin/env php 'vcs', 'url' => GITHUB_URL, ]; } // Define the "require" $array['require']['codeigniter4/codeigniter4'] = 'dev-develop'; unset($array['require']['codeigniter4/framework']); } // Release else { // Clear 'minimum-stability' unset($array['minimum-stability']); // If the repo is configured then clear it if (isset($array['repositories'])) { // Check for the CodeIgniter repo foreach ($array['repositories'] as $i => $repository) { if ($repository['url'] == GITHUB_URL) { unset($array['repositories'][$i]); break; } } if (empty($array['repositories'])) { unset($array['repositories']); } } // Define the "require" $array['require']['codeigniter4/framework'] = LATEST_RELEASE; unset($array['require']['codeigniter4/codeigniter4']); } // Write out a new composer.json file_put_contents( $file, json_encode( $array, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ) . PHP_EOL ); $modified[] = $file; } else { echo 'Warning: Unable to decode composer.json! Skipping...' . PHP_EOL; } } else { echo 'Warning: Unable to read composer.json! Skipping...' . PHP_EOL; } } // Paths config and PHPUnit XMLs $files = [ __DIR__ . DIRECTORY_SEPARATOR . 'app/Config/Paths.php', __DIR__ . DIRECTORY_SEPARATOR . 'phpunit.xml.dist', __DIR__ . DIRECTORY_SEPARATOR . 'phpunit.xml', ]; foreach ($files as $file) { if (is_file($file)) { $contents = file_get_contents($file); // Development if ($dev) { $contents = str_replace( 'vendor/codeigniter4/framework', 'vendor/codeigniter4/codeigniter4', $contents ); } // Release else { $contents = str_replace( 'vendor/codeigniter4/codeigniter4', 'vendor/codeigniter4/framework', $contents ); } file_put_contents($file, $contents); $modified[] = $file; } } if (empty($modified)) { echo 'No files modified' . PHP_EOL; } else { echo 'The following files were modified:' . PHP_EOL; foreach ($modified as $file) { echo " * {$file}" . PHP_EOL; } echo 'Run `composer update` to sync changes with your vendor folder' . PHP_EOL; }