Sha256: 65c7f76f44d2e6fb85d1b27a529fdd2c13f4150ab17a5b38a188f997bdf8bc87

Contents?: true

Size: 653 Bytes

Versions: 8

Compression:

Stored size: 653 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 -W0 -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

8 entries across 8 versions & 3 rubygems

Version Path
openvz-1.5 lib/openvz/vendor/systemu/gen_readme.rb
openvz-1.4 lib/openvz/vendor/systemu/gen_readme.rb
openvz-1.2 lib/openvz/vendor/systemu/gen_readme.rb
openvz-1.1 lib/openvz/vendor/systemu/gen_readme.rb
systemu_j-1.2.1 gen_readme.rb
systemu-1.2.0 gen_readme.rb
systemu-1.1.0 gen_readme.rb
systemu-1.0.0 gen_readme.rb