Skip to content

Instantly share code, notes, and snippets.

@iafonov
Created June 23, 2012 16:14
Show Gist options
  • Save iafonov/2978869 to your computer and use it in GitHub Desktop.
Save iafonov/2978869 to your computer and use it in GitHub Desktop.
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