Support Java deployment to dev and test environments

main
Yax 2 years ago
parent 7ec351011d
commit a0f9a12661

@ -61,7 +61,9 @@ function mbump
mvn versions:set -DgenerateBackupPoms=false -DnewVersion=$argv[1]-$kind mvn versions:set -DgenerateBackupPoms=false -DnewVersion=$argv[1]-$kind
end end
end end
abbr -a d python3 ~/.local/bin/deploy.py alias d "python3 ~/.local/bin/deploy.py {{ .deploydir }}"
alias deploy_dev "python3 ~/.local/bin/deploy.py {{ .deploydir_dev }}"
alias deploy_test "python3 ~/.local/bin/deploy.py {{ .deploydir_test }}"
# sdkman # sdkman
if test -f "$__fish_sdkman_init" if test -f "$__fish_sdkman_init"

@ -2,11 +2,9 @@
# -*- coding: UTF-8 -*- # -*- coding: UTF-8 -*-
import os import os
import argparse
from shutil import copy2 from shutil import copy2
DEPLOY_DIRECTORY = "{{ .deploydir }}"
def get_file_weight(filename): def get_file_weight(filename):
if filename.endswith(".ear"): if filename.endswith(".ear"):
return 4 return 4
@ -43,15 +41,18 @@ def find_recursive_targets(path):
return targets return targets
def process(path): def process(path, deploydir):
candidates = sorted(find_recursive_targets(path), key=lambda target: target[1], reverse=True) candidates = sorted(find_recursive_targets(path), key=lambda target: target[1], reverse=True)
if candidates: if candidates:
filename, _ = candidates[0] filename, _ = candidates[0]
print("copie " + filename) # + ' vers ' + DEPLOY_DIRECTORY) print("copie " + filename + ' vers ' + deploydir)
copy2(filename, DEPLOY_DIRECTORY) copy2(filename, deploydir)
else: else:
print("impossible de déterminer l'archive à copier") print("impossible de déterminer l'archive à copier")
if __name__ == "__main__": if __name__ == "__main__":
process(".") parser = argparse.ArgumentParser()
parser.add_argument("dir", help="deployment directory")
args = parser.parse_args()
process(".", args.dir)

Loading…
Cancel
Save