title: Chef ruby block updating value even after applying guard
body: <p>I am writing a recipe in chef, where in I am updating a file with ruby_block resource. Every time I do a convergence it adds up the same line at the end of the file. </p>
  
  <p>To make it idempotent I added a not if guard as well, but still it doesn't work.</p>
  
  <pre><code>ruby_block 'edit httpd conf' do
    block do
    rc = Chef::Util::FileEdit.new('/etc/httpd/conf/httpd.conf')
    rc.insert_line_if_no_match("IncludeOptional\ssites-enabled\/\*\.conf", 
  "IncludeOptional sites-enabled/*.conf")
    rc.write_file
  end
    not_if "grep \"IncludeOptional\ssites-enabled\/\*\.conf\" 
  /etc/httpd/conf/httpd.conf"
  end
  </code></pre>
  
  <p>There are 2 things that is not clear to me.</p>
  
  <p>First when <em>I am using insert line if no match</em> then why is it not checking the regex and updating the file.</p>
  
  <p>Second why is not_if guard not working properly.</p>
  
  <p>I may be wrong with regex here and I have read at several places not to use this kind of methods for file editing, but i wanted to append something to file here.</p>
  
  <p>Please guide me a better way of appending to a file or replacing something in the file with updated value also.</p>