21 lines
2.6 KiB
Python
21 lines
2.6 KiB
Python
from pathlib import Path
|
|
import json,shutil,hashlib,subprocess
|
|
out=Path(__file__).resolve().parent;root=out.parents[1];private=Path('C:/Users/macbook/.config/investmoz/navegacao-QA-20261016');qa=private/'source';baseline=private/'baseline-source';assert not private.exists()
|
|
sha=lambda p:hashlib.sha256(p.read_bytes()).hexdigest()
|
|
(out/'ATIVO-ANTES.json').write_text(json.dumps({'files':{p.relative_to(root).as_posix():sha(p)for f in ['app','config','routes','database','resources','public/build']for p in(root/f).rglob('*')if p.is_file()},'protected':{n:sha(root/n)for n in ['.env','composer.lock','package-lock.json']}},indent=2),'utf-8')
|
|
# Reuse the 130000 QA base; the pending L1 candidate is not a dependency of menus.
|
|
old=root/'outputs/investmoz-parques-L1-QA-20261016/prepare.py';s=old.read_text('utf-8').replace("assert not private.exists();private.mkdir(parents=True);qa.mkdir()","private.mkdir(parents=True);qa.mkdir()")
|
|
s=s.replace('parques-L1-QA-20261016','navegacao-QA-20261016').replace('parks_l1_20261016_test','navigation_20261016_test').replace(".replace('18532','18533')",".replace('18532','18534')").replace("'http://127.0.0.1:18533'","'http://127.0.0.1:18534'").replace('parks_l1_qa','navigation_qa')
|
|
# Execute with this output directory so existing guarded boot paths remain local.
|
|
exec(compile(s,str(__file__),'exec'))
|
|
for folder in ['app','config','routes','database','resources','bootstrap','public/build']:shutil.copytree(qa/folder,baseline/folder)
|
|
for n in ['artisan','composer.json','composer.lock','package.json','package-lock.json','tsconfig.json','vite.config.ts','.env']:shutil.copy2(qa/n,baseline/n)
|
|
for f in ['storage/framework/cache/data','storage/framework/views','storage/framework/sessions','storage/logs','storage/app/private','storage/app/public']:(baseline/f).mkdir(parents=True,exist_ok=True)
|
|
for n in ['vendor','node_modules']:subprocess.run(['cmd.exe','/d','/c','mklink','/J',str(baseline/n),str(root/n)],capture_output=True,check=True)
|
|
env=(baseline/'.env').read_text('utf-8').replace('18534','18535').replace('navigation_qa','navigation_baseline_qa');(baseline/'.env').write_text(env,'utf-8')
|
|
boot=(out/'boot-QA.php').read_text('utf-8').replace('/source','/baseline-source');(out/'boot-baseline.php').write_text(boot,'utf-8')
|
|
for n in ['router-QA.php','http_common.py']:
|
|
s=(root/'outputs/investmoz-parques-QA-20261016'/n).read_text('utf-8').replace('parques-QA-20261016','navegacao-QA-20261016');(out/n).write_text(s,'utf-8')
|
|
(out/'router-baseline.php').write_text((out/'router-QA.php').read_text('utf-8').replace('boot-QA.php','boot-baseline.php'),'utf-8')
|
|
print('Navigation QA and read-only baseline prepared; pending L1 not included')
|