Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix to generate metadata.json only in the vendored cookbook #1768

Merged
merged 1 commit into from Apr 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions features/commands/vendor.feature
Expand Up @@ -150,3 +150,5 @@ Feature: Vendoring cookbooks to a directory
Then the directory "vendor/bacon" should contain version "1.0.0" of the "bacon" cookbook
And a file named "vendor/bacon/metadata.json" should exist
And a file named "vendor/bacon/metadata.rb" should exist
And a file named "bacon/metadata.rb" should exist
And a file named "bacon/metadata.json" should not exist
6 changes: 2 additions & 4 deletions lib/berkshelf/berksfile.rb
Expand Up @@ -636,10 +636,6 @@ def vendor(destination)
cached_cookbooks.each do |cookbook|
Berkshelf.formatter.vendor(cookbook, destination)

# compile the metadata early before we do the file list
cookbook.compile_metadata
cookbook.reload

cookbook_destination = File.join(scratch, cookbook.cookbook_name)
FileUtils.mkdir_p(cookbook_destination)

Expand All @@ -666,6 +662,8 @@ def vendor(destination)
FileUtils.mkdir_p( File.join(cookbook_destination, File.dirname(rpath)) )
FileUtils.cp( File.join(cookbook.path.to_s, rpath), File.join(cookbook_destination, rpath) )
end

cookbook.compile_metadata(cookbook_destination)
end

# Don't vendor the raw metadata (metadata.rb). The raw metadata is
Expand Down
2 changes: 1 addition & 1 deletion lib/berkshelf/cached_cookbook.rb
Expand Up @@ -162,7 +162,7 @@ def validate
true
end

def compile_metadata
def compile_metadata(path = self.path)
json_file = "#{path}/metadata.json"
rb_file = "#{path}/metadata.rb"
return nil if File.exist?(json_file)
Expand Down