Sha256: 0ab747ed8d3a06e43d2f0957b49939fffeb5b4fd9394accf4698f85b813426a4

Contents?: true

Size: 645 Bytes

Versions: 16

Compression:

Stored size: 645 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*/*'] .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

16 entries across 16 versions & 3 rubygems

Version Path
attributes1-5.0.3 gen_readme.rb
attributes1-5.0.2 gen_readme.rb
attributes-5.0.1 gen_readme.rb
attributes-3.5.0 gen_readme.rb
attributes-3.0.1 gen_readme.rb
attributes-3.6.0 gen_readme.rb
attributes-4.1.0 gen_readme.rb
attributes-3.7.0 gen_readme.rb
attributes-3.2.0 gen_readme.rb
attributes-3.3.0 gen_readme.rb
attributes-4.0.0 gen_readme.rb
attributes-5.0.0 gen_readme.rb
attributes-3.0.0 gen_readme.rb
fattr-1.0.1 gen_readme.rb
fattr-1.0.3 gen_readme.rb
fattr-1.0.2 gen_readme.rb