summaryrefslogtreecommitdiff
path: root/lib/chef/util/file_edit.rb
diff options
context:
space:
mode:
authorBryan McLellan <btm@getchef.com>2014-03-19 14:53:04 -0700
committerBryan McLellan <btm@getchef.com>2014-03-19 14:53:04 -0700
commit0fef07d7f50758f067913ee81f9feed5c0b3fb70 (patch)
treea1eb35c356e77364f26f6c060c58f0f86bfba29b /lib/chef/util/file_edit.rb
parent7efca14a59de55c241efb7b0a353c2bcd575347b (diff)
downloadchef-0fef07d7f50758f067913ee81f9feed5c0b3fb70.tar.gz
CHEF-3714: Update file_edited? for FileEdit refactor
Diffstat (limited to 'lib/chef/util/file_edit.rb')
-rw-r--r--lib/chef/util/file_edit.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/chef/util/file_edit.rb b/lib/chef/util/file_edit.rb
index 654a5c5514..92cefb4bb4 100644
--- a/lib/chef/util/file_edit.rb
+++ b/lib/chef/util/file_edit.rb
@@ -32,11 +32,12 @@ class Chef
raise ArgumentError, "File '#{filepath}' does not exist" unless File.exist?(filepath)
@editor = Editor.new(File.open(filepath, &:readlines))
@original_pathname = filepath
+ @file_edited = false
end
# return if file has been edited
def file_edited?
- file_edited
+ @file_edited
end
#search the file line by line and match each line with the given regex
@@ -90,6 +91,7 @@ class Chef
end
newfile.flush
end
+ @file_edited = true
end
@changes = false
end