build-prefied-rector - change destination to own directory

This commit is contained in:
Tomas Votruba 2018-09-29 16:30:38 +08:00
parent 43101adc08
commit 9058c60a6e
2 changed files with 7 additions and 4 deletions

View File

@ -1,13 +1,16 @@
#!/usr/bin/env php
<?php declare(strict_types=1);
use Nette\Utils\FileSystem;
use Nette\Utils\Json;
require_once __DIR__ . '/../bootstrap.php';
$buildDestination = getenv('BUILD_DESTINATION');
// load
$composerJsonPath = __DIR__ . '/../build/composer.json';
$composerContent = Json::decode(file_get_contents($composerJsonPath), Json::FORCE_ARRAY);
$composerJsonPath = $buildDestination . '/composer.json';
$composerContent = Json::decode(FileSystem::read($composerJsonPath), Json::FORCE_ARRAY);
// remove unused sections
unset($composerContent['require-dev'], $composerContent['scripts'], $composerContent['config'], $composerContent['autoload-dev'], $composerContent['authors']);
@ -21,4 +24,4 @@ $composerContent['require'] = [
];
// save
file_put_contents($composerJsonPath, Json::encode($composerContent, Json::PRETTY));
FileSystem::write($composerJsonPath, Json::encode($composerContent, Json::PRETTY));

View File

@ -67,7 +67,7 @@ chmod +x $BUILD_DESTINATION/bin/rector
rm -rf /tmp/_prefixed_rector_cache
# build composer.json
bin/rector-prefixed/build-composer-json.php
BUILD_DESTINATION=$BUILD_DESTINATION bin/rector-prefixed/build-composer-json.php
# run it to test it
build/bin/rector