Hey I have created a Groovy script that will extract the version numbers of some folder. I would then like to compare the version numbers and select the highest.
I got my script to run through the dir folder and I then get the versions in this format: 02.2.02.01
So I could get something like this:
- 02.2.02.01
- 02.2.02.02
- 02.2.03.01
I don’t have them as a list but like this:
baseDir.listFiles().each { file ->
def string = file.getName().substring(5, 15)
// do stuff
}
Also I have tested that Groovy could compare them with the > operator and it can! But now I need to select the one with the highest version
This appears to work
Here is an inadequate set of tests. You should add some more.
Run this code and the tests in the Groovy console to verify that it works