mirror of
https://github.com/rectorphp/rector.git
synced 2025-04-20 07:22:43 +02:00
move rector-prefixed scripts to bin/build
This commit is contained in:
parent
8ece3863ec
commit
f91a299f4c
@ -6,19 +6,14 @@ set -x
|
||||
cd build
|
||||
|
||||
# init non-existing .git or fetch existing one
|
||||
if [ ! -d .git ]; then git init; git remote add -f origin git@github.com:rectorphp/rector-prefixed.git; else git fetch origin; fi
|
||||
|
||||
# to keep only diff commits
|
||||
if [ ! -d .git ]; then
|
||||
git init
|
||||
git remote add -f origin git@github.com:rectorphp/rector-prefixed.git
|
||||
else
|
||||
git fetch origin
|
||||
fi
|
||||
|
||||
git add .
|
||||
git commit -m "rebuild prefixed Rector" # date?
|
||||
|
||||
#git pull origin master --rebase
|
||||
# https://stackoverflow.com/a/7929499/1348344
|
||||
git fetch origin # Updates origin/master
|
||||
#git rebase origin/master # Rebases current branch onto origin/master
|
||||
|
||||
# https://demisx.github.io/git/rebase/2015/07/02/git-rebase-keep-my-branch-changes.html
|
||||
git rebase -Xtheirs origin/master # Rebases current branch onto origin/master, prefers our "master" in conflicts
|
||||
|
||||
git push origin master
|
||||
git commit -m "rebuild prefixed Rector"
|
||||
# needs to be force pushed to delete old files
|
||||
git push origin master -f
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
use Nette\Utils\Json;
|
||||
|
||||
require_once __DIR__ . '/bootstrap.php';
|
||||
require_once __DIR__ . '/../bootstrap.php';
|
||||
|
||||
// load
|
||||
$composerJsonPath = __DIR__ . '/../build/composer.json';
|
@ -10,9 +10,10 @@ mkdir build
|
||||
# prefix current code to /build directory (see "scoper.inc.php" for settings)
|
||||
vendor/bin/php-scoper add-prefix --no-interaction
|
||||
|
||||
# prefix namespace in *.yml files
|
||||
# but not in /config, since there is only Rector\ services and "class names"
|
||||
(find build/ -path build/config -prune -o -type f -name '*.yml' | xargs perl -pi -e 's/((?:\\{1,2}\w+|\w+\\{1,2})(?:\w+\\{0,2})+)/RectorPrefixed\\\1/g')
|
||||
# prefix namespace in *.yml, *.yaml and *.neon files
|
||||
# but not in /config, since there is only Rector\ services and "class names" that are not prefixed
|
||||
# ref https://unix.stackexchange.com/a/15309/74260
|
||||
(find build/ -path build/config -prune -o -type f \( -name \*.yml -o -name \*.yaml -o -name \*.neon \) | xargs perl -pi -e 's/((?:\\{1,2}\w+|\w+\\{1,2})(?:\w+\\{0,2})+)/RectorPrefixed\\\1/g')
|
||||
|
||||
# un-prefix Rector files, so it's public API, in configs etc.
|
||||
# e.g.
|
||||
@ -42,9 +43,10 @@ sed -i 's#\\App\\\\Kernel#App\\Kernel#g' build/src/Bridge/Symfony/DefaultAnalyze
|
||||
# RectorPrefixed\Symfony\Component\HttpKernel\Kernel => Symfony\Component\HttpKernel\Kernel
|
||||
(find build/src/Bridge/Symfony/ -type f | xargs sed -i 's#RectorPrefixed\\Symfony\\Component#Symfony\\Component#g')
|
||||
|
||||
# copy template files
|
||||
cp composer.json build/composer.json
|
||||
cp bin/template/README.md build/README.md
|
||||
cp bin/template/.travis.yml build/.travis.yml
|
||||
cp bin/rector-prefixed/template/README.md build/README.md
|
||||
cp bin/rector-prefixed/template/.travis.yml build/.travis.yml
|
||||
|
||||
# rebuild composer dump so the new prefixed namespaces are autoloaded
|
||||
# the new "RectorPrefixed\" is taken into account thanks to /vendor/composer/installed.json file,
|
Loading…
x
Reference in New Issue
Block a user