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
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
if test -f "$__fish_sdkman_init"

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

Loading…
Cancel
Save