views:

92

answers:

2

Please, some help to newbie in QuickBuild.

I have a lot of versions stored in text files. To start build process I need to retrieve it and run some scripts in shell. My answer is, how to read from the file using QuickBuild environment? I know that it supports Groovy, MVEL and OGNL languages but I'm not familiar with no one of them.

Thanks in advance.

+1  A: 

I found the solution :)

${groovy: str = new java.io.File("[PATH_TO]/file.txt").text}

or

${groovy: str = new java.io.File("[PATH_TO]/file.txt").text
str.split("[\\r\\n]")[0] }

to read the first line only.

Thanks to me :)

Cyril
A: 

A slightly shorter version for reading only the first line (which doesn't make any assumption about the EOL character):

${groovy: str = new File("[PATH_TO]/file.txt").readLines()[0] }
Don