module Aruba::Reporting
Public Class Methods
reports()
click to toggle source
# File lib/aruba/reporting.rb, line 14 def reports @reports ||= Hash.new do |hash, feature| hash[feature] = [] end end
Public Instance Methods
again(erb, erbout, file)
click to toggle source
# File lib/aruba/reporting.rb, line 71 def again(erb, erbout, file) erbout.concat(erb.result(binding)) end
children(dir)
click to toggle source
# File lib/aruba/reporting.rb, line 75 def children(dir) Dir["#{dir}/*"].sort end
commands()
click to toggle source
# File lib/aruba/reporting.rb, line 46 def commands @commands || [] end
depth()
click to toggle source
# File lib/aruba/reporting.rb, line 83 def depth File.dirname(@scenario.feature.file).split('/').length end
description()
click to toggle source
# File lib/aruba/reporting.rb, line 40 def description unescaped_description = @scenario.description.gsub(/^(\s*)\/, '\1') markdown = RDiscount.new(unescaped_description) markdown.to_html end
files()
click to toggle source
# File lib/aruba/reporting.rb, line 65 def files erb = ERB.new(template('files.erb'), nil, '-') file = current_dir erb.result(binding) end
index()
click to toggle source
# File lib/aruba/reporting.rb, line 87 def index erb = ERB.new(template('index.erb'), nil, '-') erb.result(binding) end
index_title()
click to toggle source
# File lib/aruba/reporting.rb, line 92 def index_title "Examples" end
output()
click to toggle source
# File lib/aruba/reporting.rb, line 50 def output @aruba_keep_ansi = true # We want the output coloured! escaped_stdout = CGI.escapeHTML(all_stdout) html = Bcat::ANSI.new(escaped_stdout).to_html Bcat::ANSI::STYLES.each do |name, style| html.gsub!(/style='#{style}'/, %Q{class="xterm_#{name}"}) end html end
pygmentize(file)
click to toggle source
# File lib/aruba/reporting.rb, line 21 def pygmentize(file) pygmentize = SpawnProcess.new(%Q{pygmentize -f html -O encoding=utf-8 "#{file}"}, 3, 0.5) pygmentize.run! do |p| exit_status = p.stop(false) if(exit_status == 0) p.stdout(false) elsif(p.stderr(false) =~ /no lexer/) # Pygment's didn't recognize it IO.read(file) else STDERR.puts "\e[31m#{p.stderr} - is pygments installed?\e[0m" exit $CHILD_STATUS.exitstatus end end end
report()
click to toggle source
# File lib/aruba/reporting.rb, line 60 def report erb = ERB.new(template('main.erb'), nil, '-') erb.result(binding) end
template(path)
click to toggle source
# File lib/aruba/reporting.rb, line 79 def template(path) IO.read(File.join(ENV['ARUBA_REPORT_TEMPLATES'], path)) end
title()
click to toggle source
# File lib/aruba/reporting.rb, line 36 def title @scenario.title end