Created
June 23, 2012 16:14
-
-
Save iafonov/2978869 to your computer and use it in GitHub Desktop.
Dumb git cookbooks resolver
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
nginx: | |
rev: 0.101.6 | |
ohai: | |
openssl: | |
mysql: | |
git: https://github.com/cjoudrey/mysql | |
postgresql: | |
runit: | |
unicorn: | |
application: | |
application_nginx: | |
application_ruby: |
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
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