File and contents match


#1

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…


#2

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…