caching doesn't work as nicely w/ grouped coffeescript compile, turning it off for now 'cause the speed benefit of grouped compilation is already huge

This commit is contained in:
John Bintz 2011-06-10 14:25:08 -04:00
parent 67940c5066
commit d0afb329f1
2 changed files with 14 additions and 5 deletions

View File

@ -40,8 +40,6 @@ module Jasmine
coffeescript_run = [] coffeescript_run = []
files.collect { |file| files.collect { |file|
next @code_for_file[file] if @code_for_file[file]
coffeescript_run << file if (ext = File.extname(file)) == '.coffee' coffeescript_run << file if (ext = File.extname(file)) == '.coffee'
output = [] output = []
@ -58,7 +56,7 @@ module Jasmine
end end
end end
@code_for_file[file] = output output
}.flatten.reject(&:empty?) }.flatten.reject(&:empty?)
end end

View File

@ -166,12 +166,12 @@ describe Jasmine::FilesList do
File.open('test.coffee', 'w') { |fh| fh.print "first" } File.open('test.coffee', 'w') { |fh| fh.print "first" }
File.open('test2.coffee', 'w') { |fh| fh.print "second" } File.open('test2.coffee', 'w') { |fh| fh.print "second" }
CoffeeScript.stubs(:compile).with() { |field| field.read == "firstsecond" }.returns("i compiled")
end end
context '#files_to_html' do context '#files_to_html' do
it "should create the right HTML" do it "should create the right HTML" do
CoffeeScript.stubs(:compile).with() { |field| field.read == "firstsecond" }.returns("i compiled")
files_list.files_to_html.should == [ files_list.files_to_html.should == [
%{<script type="text/javascript" src="test.js"></script>}, %{<script type="text/javascript" src="test.js"></script>},
%{<script type="text/javascript">i compiled</script>}, %{<script type="text/javascript">i compiled</script>},
@ -179,6 +179,17 @@ describe Jasmine::FilesList do
] ]
end end
end end
context '#filtered_files_to_html' do
it "should create the right HTML" do
CoffeeScript.stubs(:compile).with() { |field| field.read == "first" }.returns("i compiled")
files_list.filtered_files_to_html.should == [
%{<script type="text/javascript" src="test.js"></script>},
%{<script type="text/javascript">i compiled</script>}
]
end
end
end end
end end
end end