Last active
October 16, 2015 11:46
-
-
Save smith/60233700a88b0ec3ee4a to your computer and use it in GitHub Desktop.
Greenspun's tenth rule
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
# See https://github.com/coderanger/chef-dialects-testbed, https://github.com/chef/chef-rfc/blob/master/rfc036-dialects.md | |
require "edn" | |
require "json" | |
open("recipe.rb", "w") do |f| | |
EDN.read("(#{open('recipe.edn').read})").each do |resource| | |
type = resource.shift.to_s | |
name = resource.shift.to_s | |
properties = resource.shift || {} | |
f.write "#{type} '#{name}' do\n" | |
properties.each do |property, value| | |
f.write " #{property} #{value.to_json}\n" | |
end | |
f.write "\nend\n" | |
end | |
end |
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
(file "hello.txt" { | |
:content "hello, world!" | |
}) | |
(directory "hello") |
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
file 'hello.txt' do | |
content "hello, world!" | |
end | |
directory 'hello' do | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment