Skip to content

Commit

Permalink
Fix: Version Pattern for Java Version Command (#857)
Browse files Browse the repository at this point in the history
* Fix: Version Pattern for Java Version Command

* Update _java.py

* Update _java.py
  • Loading branch information
y0urself authored Aug 22, 2023
1 parent 6083b37 commit 83d1115
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions pontos/version/commands/_java.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
__version__ = "{}"\n"""

VERSION_PATTERN = (
r"([0-9]+\.[0-9]+\.[0-9]+(-?([ab]|rc|alpha|beta)[0-9]+(.dev[0-9]+)?)?)"
)


def find_file(
filename: Path, search_path: str, search_glob: str
Expand Down Expand Up @@ -124,10 +128,7 @@ def _update_properties_file(
if not self._properties_file_path.exists():
# skip if not existing
return
pattern = (
r"sentry\.release=([0-9]+\.[0-9]+\.[0-9]+"
r"(-?([ab]|dev|rc|alpha|beta)[0-9]+)?)"
)
pattern = rf"sentry\.release={VERSION_PATTERN}"
replace_string_in_file(
self._properties_file_path,
pattern=pattern,
Expand All @@ -147,10 +148,7 @@ def _update_swagger_config(
if not swagger_config_file:
# skip if not existing
return
pattern = (
r'\.version\("([0-9]+\.[0-9]+\.[0-9]+'
r'(-?([ab]|dev|rc|alpha|beta)[0-9]+)?)"\)'
)
pattern = rf'\.version\("{VERSION_PATTERN}"\)'
replace_string_in_file(
swagger_config_file, pattern=pattern, replacement=str(new_version)
)
Expand Down

0 comments on commit 83d1115

Please sign in to comment.