# # File 'spec_helper.rb' created on 12 gen 2008 at 20:25:09. # See 'dokkit.rb' or +LICENSE+ for licence information. # # (c)2006, 2007 Andrea Fazzi (and contributors). # module SpecPathHelper DATA_TEST_DIR = 'data/test_build' DATA_DEST_DIR = 'data' CACHE_PATH = '.cache' DOCUMENT_PATH = 'doc/pages' DATA_PATH = 'doc/data' CONFIG_PATH = 'doc/configs' LAYOUT_PATH = 'doc/layouts' TEMPLATE_PATH = 'templates' OUTPUT_PATH = 'output' def base_path(fn = '') File.join('.', fn) end def cache_path(fn = '') File.join(base_path, CACHE_PATH, fn).sub(/^\.\//, '').sub(/\/$/, '') end def document_path(fn = '') File.join(base_path, DOCUMENT_PATH, fn).sub(/^\.\//, '').sub(/\/$/, '') end def config_path(fn = '') File.join(base_path, CONFIG_PATH, fn).sub(/^\.\//, '').sub(/\/$/, '') end def layout_path(fn = '') File.join(base_path, LAYOUT_PATH, fn).sub(/^\.\//, '').sub(/\/$/, '') end def data_path(fn = '') File.join(base_path, DATA_PATH, fn).sub(/^\.\//, '').sub(/\/$/, '') end def output_path(fn = '') File.join(base_path, OUTPUT_PATH, fn).sub(/^\.\//, '').sub(/\/$/, '') end end module CaptureStdout def capture_stdout s = StringIO.new oldstdout = $stdout $stdout = s yield s.string ensure $stdout = oldstdout end def capture_stderr s = StringIO.new oldstdout = $stderr $stderr = s yield s.string ensure $stderr = oldstdout end end