module Aruba::Reporting
Public Class Methods
reports()
click to toggle source
# File lib/aruba/reporting.rb, line 19 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 76 def again(erb, erbout, file) erbout.concat(erb.result(binding)) end
children(dir)
click to toggle source
# File lib/aruba/reporting.rb, line 80 def children(dir) Dir["#{dir}/*"].sort end
commands()
click to toggle source
# File lib/aruba/reporting.rb, line 51 def commands @commands || [] end
depth()
click to toggle source
# File lib/aruba/reporting.rb, line 88 def depth File.dirname(@scenario.feature.file).split('/').length end
description()
click to toggle source
# File lib/aruba/reporting.rb, line 45 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 70 def files erb = ERB.new(template('files.erb'), nil, '-') file = current_directory erb.result(binding) end
index()
click to toggle source
# File lib/aruba/reporting.rb, line 92 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 97 def index_title "Examples" end
output()
click to toggle source
# File lib/aruba/reporting.rb, line 55 def output aruba.config.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}'/, %{class="xterm_#{name}"}) end html end
pygmentize(file)
click to toggle source
# File lib/aruba/reporting.rb, line 26 def pygmentize(file) pygmentize = Processes::SpawnProcess.new(%{pygmentize -f html -O encoding=utf-8 "#{file}"}, 3, 0.5, Dir.getwd) 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 65 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 84 def template(path) IO.read(File.join(ENV['ARUBA_REPORT_TEMPLATES'], path)) end
title()
click to toggle source
# File lib/aruba/reporting.rb, line 41 def title @scenario.title end