# vi:ft=ruby:site:opscode# Extension method to import secondary dependencies in a referenced site-cookbook# using the constraints in the site-cookbook's Berkshelf file, rather than just# the name of the dependencies in the site-cookbook's metadata.rb file## credit: https://sethvargo.com/berksfile-magic/# https://coderwall.com/p/j72egwdefsite_cookbook(path)berksfile="../#{path}/Berksfile"ifFile.exists?(berksfile)contents=File.read(berksfile)# comment out lines like `site :opscode`, which cannot be imported multiple timescontents=contents.gsub(/(^\s*site\s)/,'#\1')# comment out lines like `metadata`, which cannot be imported multiple timescontents=contents.gsub(/(^\s*metadata\s)/,'#\1')instance_eval(contents)endendcookbook'nginx','~> 2.4.4'site_cookbook'my-site-cookbook'