Runner.html is now generated (ensures all source & specs get tested); beginnings of refactoring of Rake tasks.

This commit is contained in:
Davis W. Frank
2011-06-09 19:24:51 -07:00
parent 9d5470ff55
commit f83cb7f766
12 changed files with 270 additions and 168 deletions

32
tasks/build_specs.rb Normal file
View File

@@ -0,0 +1,32 @@
require 'ostruct'
desc "build the browser spec runner.html based on current tree"
task :build_runner_html do
template = Tilt.new('spec/templates/runner.html.erb')
File.open('spec/runner.html', 'w+') do |f|
scope = OpenStruct.new(:source_tags => other_source_file_tags,
:spec_file_tags => spec_file_tags)
f << template.render(scope)
end
end
def other_source_file_tags
other_files = html_sources + console_sources
script_tags_for other_files.collect { |f| "../#{f}" }
end
def spec_file_tags
spec_files = core_specfiles + html_specfiles + console_specfiles
script_tags_for spec_files.collect { |f| "../#{f}" }
end
def script_tags_for(files)
script_tag = Tilt::new('spec/templates/script_tag.html.erb')
files.inject([]) do |tags, f|
scope = OpenStruct.new :file => f
tags << script_tag.render(scope)
tags
end.join("\n ")
end