chore: se limpia cache de trytond
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

fixes #18
This commit is contained in:
Jovany Leandro G.C bit4bit@riseup.net 2023-08-01 18:47:43 -05:00
parent 2531747b64
commit 22b5d6cb7f
2 changed files with 21 additions and 0 deletions

2
.gitignore vendored
View File

@ -217,3 +217,5 @@ tags
pyvenv.cfg
.venv
pip-selfcheck.json
.tdd_cache

View File

@ -1,4 +1,5 @@
require 'yaml'
require 'digest'
WOODPECKER_YML='.woodpecker.yml'
DOCKER_COMPOSE='compose.test.yml'
@ -24,6 +25,24 @@ end
desc 'iterar'
task :tdd do
# cuando se realizan cambios sobre los modelos
# que afectan las tablas es necesario limpiar el cache
# de trytond
if `which git`.then { $? }.success?
changes = %x{git diff}.split("\n").grep(/^[-+]/)
num = changes.grep(/fields/).length
hash = Digest::MD5.hexdigest(changes.flatten.join(''))
File.open('.tdd_cache', 'r+') do |cache|
tdd_cache = cache.read()
if num > 0 && (tdd_cache != hash)
compose('exec', 'app.dev', 'rm -f /tmp/*.dump')
cache.seek(0); cache.write(hash)
end
end
end
compose('exec', 'app.dev', 'python3 -m unittest')
end