def validate_metadata(cookbook, version)
      # check metadata.rb for requested version
      metadata = @loader.cookbooks_by_name[cookbook].metadata
      Spiceweasel::Log.debug("validate_metadata: #{cookbook} #{metadata.name} #{metadata.version}")
      # Should the cookbook directory match the name in the metadata?
      if metadata.name.empty?
        Spiceweasel::Log.warn("No cookbook name in the #{cookbook} metadata.rb.")
      elsif cookbook != metadata.name
        STDERR.puts "ERROR: Cookbook '#{cookbook}' does not match the name '#{metadata.name}' in #{cookbook}/metadata.rb."
        exit(-1)
      end
      if version && metadata.version != version
        STDERR.puts "ERROR: Invalid version '#{version}' of '#{cookbook}' requested, '#{metadata.version}' is already in the cookbooks directory."
        exit(-1)
      end
      metadata.dependencies.each do |dependency|
        Spiceweasel::Log.debug("cookbook #{cookbook} metadata dependency: #{dependency}")
        @dependencies.push(dependency[0])
      end
    end
def validate_metadata(cookbook, version)
      # check metadata.rb for requested version
      metadata = @loader.cookbooks_by_name[cookbook].metadata
      Spiceweasel::Log.debug("validate_metadata: #{cookbook} #{metadata.name} #{metadata.version}")
      # Should the cookbook directory match the name in the metadata?
      if metadata.name.empty?
        Spiceweasel::Log.warn("No cookbook name in the #{cookbook} metadata.rb.")
      elsif cookbook != metadata.name
        STDERR.puts "ERROR: Cookbook '#{cookbook}' does not match the name '#{metadata.name}' in #{cookbook}/metadata.rb."
        exit(-1)
      end
      if version && metadata.version != version
        STDERR.puts "ERROR: Invalid version '#{version}' of '#{cookbook}' requested, '#{metadata.version}' is already in the cookbooks directory."
        exit(-1)
      end
      metadata.dependencies.each do |dependency|
        Spiceweasel::Log.debug("cookbook #{cookbook} metadata dependency: #{dependency}")
        @dependencies.push(dependency[0])
      end
    end
check the metadata for versions and gather deps