    # File lib/chef/knife/cookbook_metadata.rb, line 62
          def generate_metadata(cookbook)
            Array(config[:cookbook_path]).reverse.each do |path|
              file = File.expand_path(File.join(path, cookbook, 'metadata.rb'))
              if File.exists?(file)
                generate_metadata_from_file(cookbook, file)
              else
                validate_metadata_json(path, cookbook)
              end
            end
          end