# vim:sw=4:ts=4 # $Id: cookbook.rb,v 1.1 2003/06/05 17:30:03 whythluckystiff Exp $ # # Cookbook Generator for YamlTestingSuite # require 'erb/erbl' require 'yaml' ytsFiles = [ [ 'YtsBasicTests.yml', { 'name' => 'Collections', 'doc' => [] } ], [ 'YtsFlowCollections.yml', { 'name' => 'Inline Collections', 'doc' => [] } ], [ 'YtsTypeTransfers.yml', { 'name' => 'Basic Types', 'doc' => [] } ], [ 'YtsFoldedScalars.yml', { 'name' => 'Blocks', 'doc' => [] } ], [ 'YtsAnchorAlias.yml', { 'name' => 'Aliases and Anchors', 'doc' => [] } ], [ 'YtsDocumentSeparator.yml', { 'name' => 'Documents', 'doc' => [] } ], [ 'YtsRubyTests.yml', { 'name' => 'YAML For Ruby', 'doc' => [] } ] # [ 'YtsSpecificationExamples.yml', { # 'name' => 'Examples from the Specification', # 'doc' => [] # } ] ] ytsFiles.each do |yt| yt[1]['doc'] = YAML::load_stream( File.open( yt[0] ) ) yt[1]['href'] = yt[1]['name'].downcase.gsub( /\s+/, '_' ) end erb = ERbLight.new( < <% ytsFiles.each do |yt| %>


<%= yt[1]['name'] %>

<% if yt[1]['doc'].documents.length > 0 yt[1]['doc'].documents.each do |ydoc| %>

<%= ydoc['test'] %>

Brief

<%= ydoc['brief'] %>

Yaml

 <%= ydoc['test'].gsub( ' ', ' ' ) if ydoc['test'] %>   
<%= ydoc['yaml'] %>

Ruby

 <%= ydoc['test'].gsub( ' ', ' ' ) if ydoc['test'] %>   
<% if ydoc.has_key?( 'ruby-setup' ) %>
<%= ydoc['ruby-setup'] %>
<% end %>
<%= ydoc['ruby'] %>
<% end end %> <% end %> TMPL ) puts erb.result