summaryrefslogtreecommitdiff
path: root/lib/chef/cookbook
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-07-16 10:19:34 -0700
committerGitHub <noreply@github.com>2018-07-16 10:19:34 -0700
commit1b8c24a83a2ba2d7d3c76ebe5c885187948b9fac (patch)
tree8a305a1e25b902e2dc281d23655e860b032bbf2d /lib/chef/cookbook
parentd30645d1b05af5c472b1e2d505603a19ed4ddf5c (diff)
parentbcf5474410be6198bd0bf04d1ea7a636962194e2 (diff)
downloadchef-1b8c24a83a2ba2d7d3c76ebe5c885187948b9fac.tar.gz
Merge pull request #6168 from oclaussen/generate_valid_gemfile
Make gem_installer generate a valid Gemfile
Diffstat (limited to 'lib/chef/cookbook')
-rw-r--r--lib/chef/cookbook/gem_installer.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/chef/cookbook/gem_installer.rb b/lib/chef/cookbook/gem_installer.rb
index deac48ff78..79b62f7a72 100644
--- a/lib/chef/cookbook/gem_installer.rb
+++ b/lib/chef/cookbook/gem_installer.rb
@@ -40,6 +40,13 @@ class Chef
cookbook_collection.each_value do |cookbook_version|
cookbook_version.metadata.gems.each do |args|
+ if cookbook_gems[args.first].last.is_a?(Hash)
+ args << {} unless args.last.is_a?(Hash)
+ args.last.merge!(cookbook_gems[args.first].pop) do |key, v1, v2|
+ raise Chef::Exceptions::GemRequirementConflict.new(args.first, key, v1, v2) if v1 != v2
+ v2
+ end
+ end
cookbook_gems[args.first] += args[1..-1]
end
end