From eb6491a1fb2bbc182d65056b2ecb5f6d514d3f38 Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Fri, 19 May 2023 16:50:28 +0200 Subject: [PATCH] fix buildfile version replacement for clojure --- build.py | 2 +- src/main/python/ddadevops/domain/build_file.py | 1 + src/test/python/domain/test_build_file.py | 11 +++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/build.py b/build.py index 5be177e..eaca534 100644 --- a/build.py +++ b/build.py @@ -28,7 +28,7 @@ use_plugin("python.distutils") default_task = "publish" name = "ddadevops" -version = "4.0.0-dev35" +version = "4.0.0-dev38" summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud" description = __doc__ authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")] diff --git a/src/main/python/ddadevops/domain/build_file.py b/src/main/python/ddadevops/domain/build_file.py index 7fc941d..c69a737 100644 --- a/src/main/python/ddadevops/domain/build_file.py +++ b/src/main/python/ddadevops/domain/build_file.py @@ -121,6 +121,7 @@ class BuildFile(Validateable): '"[0-9]*\\.[0-9]*\\.[0-9]*(-SNAPSHOT)?"', f'"{new_version.to_string()}"', self.content, + 1 ) self.content = substitute except: diff --git a/src/test/python/domain/test_build_file.py b/src/test/python/domain/test_build_file.py index cfc0c74..061427b 100644 --- a/src/test/python/domain/test_build_file.py +++ b/src/test/python/domain/test_build_file.py @@ -138,3 +138,14 @@ def test_sould_parse_and_set_version_for_clj(): ) sut.set_version(Version.from_str("1.1.5-SNAPSHOT").create_major()) assert '\n(defproject org.domaindrivenarchitecture/c4k-jira "2.0.0"\n :description "jira c4k-installation package"\n)\n' == sut.content + + sut = BuildFile( + Path("./project.clj"), + """ +(defproject org.domaindrivenarchitecture/c4k-jira "1.1.5-SNAPSHOT" +:dependencies [[org.clojure/clojure "1.11.0"]] +) + """, + ) + sut.set_version(Version.from_str("1.1.5-SNAPSHOT").create_major()) + assert '\n(defproject org.domaindrivenarchitecture/c4k-jira "2.0.0"\n:dependencies [[org.clojure/clojure "1.11.0"]]\n)\n ' == sut.content