File and contents match

Is there a way to check that not only does a file exist, but it contains
several particular strings before executing a resource?

I’m wondering if it’s just a ruby block to read in the file, test each
line, etc…

Something like this?

only_if { File.exist?("foo") && IO.read("foo") =~ /regex/ }

Cheers,
Torben

On Tue, Aug 21, 2012 at 7:06 AM, Maven User maven.2.user@gmail.com wrote:

Is there a way to check that not only does a file exist, but it contains
several particular strings before executing a resource?

I'm wondering if it's just a ruby block to read in the file, test each line,
etc....