fix buildfile version replacement for clojure

This commit is contained in:
Michael Jerger 2023-05-19 16:50:28 +02:00
parent 93fef828f6
commit eb6491a1fb
3 changed files with 13 additions and 1 deletions

View file

@ -28,7 +28,7 @@ use_plugin("python.distutils")
default_task = "publish" default_task = "publish"
name = "ddadevops" 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" summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud"
description = __doc__ description = __doc__
authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")] authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")]

View file

@ -121,6 +121,7 @@ class BuildFile(Validateable):
'"[0-9]*\\.[0-9]*\\.[0-9]*(-SNAPSHOT)?"', '"[0-9]*\\.[0-9]*\\.[0-9]*(-SNAPSHOT)?"',
f'"{new_version.to_string()}"', f'"{new_version.to_string()}"',
self.content, self.content,
1
) )
self.content = substitute self.content = substitute
except: except:

View file

@ -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()) 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 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