Skip to content

Instantly share code, notes, and snippets.

@kcbraunschweig
Created May 27, 2011 22:08
Show Gist options
  • Save kcbraunschweig/996286 to your computer and use it in GitHub Desktop.
Save kcbraunschweig/996286 to your computer and use it in GitHub Desktop.
resource loop example
#this is irritating:
cookbook_file "/usr/bin/foo" do
owner "me"
group "me"
mode "0644"
action :create
end
cookbook_file "/usr/bin/bar" do
owner "me"
group "me"
mode "0644"
action :create
end
cookbook_file "/usr/bin/baz" do
owner "me"
group "me"
mode "0644"
action :create
end
cookbook_file "/usr/bin/boffo" do
owner "me"
group "me"
mode "0644"
action :create
end
#how about some ruby instead!:
files = [ "/usr/bin/foo",
"/usr/bin/bar",
"/usr/bin/baz",
"/usr/bin/boffo",
]
files.each do |file|
cookbook_file file do
owner "me"
group "me"
mode "0644"
action :create
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment