Sha256: 2c06df5637790997f741a6339ade07b3c2031541566eeb1584cf8592280df672

Contents?: true

Size: 649 Bytes

Versions: 38

Compression:

Stored size: 649 Bytes

Contents

require 'pathname'

$VERBOSE=nil

def indent s, n = 2
  ws = ' ' * n
  s.gsub %r/^/, ws 
end

template = IO::read 'README.tmpl'

samples = ''
prompt = '~ > '

Dir['sample*/*'].sort.each do |sample|
  samples << "\n" << "  <========< #{ sample } >========>" << "\n\n"

  cmd = "cat #{ sample }" 
  samples << indent(prompt + cmd, 2) << "\n\n" 
  samples << indent(`#{ cmd }`, 4) << "\n" 

  cmd = "ruby #{ sample }" 
  samples << indent(prompt + cmd, 2) << "\n\n" 

  cmd = "ruby -Ilib #{ sample }" 
  samples << indent(`#{ cmd } 2>&1`, 4) << "\n" 
end

#samples.gsub! %r/^/, '  '

readme  = template.gsub %r/^\s*@samples\s*$/, samples
print readme 

Version data entries

38 entries across 38 versions & 7 rubygems

Version Path
prototype-2.0.0 gen_readme.rb
prototype-0.2.0 gen_readme.rb
prototype-1.0.0 gen_readme.rb
slave-1.0.0 gen_readme.rb
slave-1.2.0 gen_readme.rb
slave-1.1.0 gen_readme.rb
slave-1.2.1 gen_readme.rb
tagz-4.5.0 gen_readme.rb
tagz-4.6.0 gen_readme.rb
tagz-4.4.0 gen_readme.rb
tagz-0.0.2 gen_readme.rb
tagz-4.3.0 gen_readme.rb
tagz-1.0.0 gen_readme.rb
tagz-0.0.1 gen_readme.rb
tagz-4.2.0 gen_readme.rb
tagz-0.0.4 gen_readme.rb
threadify-0.0.2 gen_readme.rb
threadify-0.0.3 gen_readme.rb