Skip to content

Instantly share code, notes, and snippets.

@iafonov
Created June 23, 2012 16:14
Embed
What would you like to do?
Dumb git cookbooks resolver
nginx:
rev: 0.101.6
ohai:
openssl:
mysql:
git: https://github.com/cjoudrey/mysql
postgresql:
runit:
unicorn:
application:
application_nginx:
application_ruby:
require 'yaml'
desc "Install cookbooks"
task :cookbooks do
cookbooks = YAML.load(File.read("cookbooks.yml"))
cookbooks.each do |name, data|
data ||= {}
target = "cookbooks/#{name}"
if File.exist? target
puts "*** Skipping #{name} - already exists ***"
next
else
puts "*** Installing #{name} ***"
end
if data["git"]
system "git clone #{data["git"]} #{target}"
else
system "git clone https://github.com/opscode-cookbooks/#{name} #{target}"
end
system "cd #{target} && git checkout #{data["rev"]}" if data["rev"]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment