Created
October 16, 2015 17:53
-
-
Save jkeiser/e5aed3fde5aa20294bed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# resources/super_file | |
property :path, String, name_property: true, coerce: proc { }, default: lazy { } | |
property :mode, Integer, default: '755', coerce: proc { |v| v.to_i(8) } | |
property :content, String | |
load_current_value do | |
current_value_does_not_exist! if !File.exist?(path) | |
mode File.stat(path).mode | |
content IO.read(path) | |
end | |
action :create do | |
converge_if_changed do | |
File.open(path, "w") { |f| f.write(content) } | |
File.chmod(path, mode) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment