someara/line-cookbook — pull request #5 by jblaine (2013-06-05 22:26:02+00:00)
Title: Makes replace_or_add function properly

When the regex matches a line in the target file, we now properly
compare it against a *newline-terminated* version of
new_resource.line to determine if the line is correct or needs
to be updated.

When the regex is not matched, and so the file is not modified,
we are in "add" mode and spit out new_resource.line to the
open temp file. This was mistakenly spitting out to the original
file (and silently failing as it was only open for r+ ... but it
was the wrong place to write anyway - remnant from previous code)