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