more cleanups for things i found that are broken

This commit is contained in:
John Bintz 2011-11-22 12:14:00 -05:00
parent 2316041580
commit 38327e6a95
6 changed files with 24 additions and 7 deletions

View File

@ -16,6 +16,7 @@ module Jasmine::Headless
autoload :CoffeeTemplate, 'jasmine/headless/coffee_template' autoload :CoffeeTemplate, 'jasmine/headless/coffee_template'
autoload :JSTemplate, 'jasmine/headless/js_template' autoload :JSTemplate, 'jasmine/headless/js_template'
autoload :JSTTemplate, 'jasmine/headless/jst_template'
autoload :CSSTemplate, 'jasmine/headless/css_template' autoload :CSSTemplate, 'jasmine/headless/css_template'
autoload :Report, 'jasmine/headless/report' autoload :Report, 'jasmine/headless/report'

View File

@ -11,12 +11,10 @@ module Jasmine::Headless
cache = Jasmine::Headless::CoffeeScriptCache.new(file) cache = Jasmine::Headless::CoffeeScriptCache.new(file)
source = cache.handle source = cache.handle
if cache.cached? if cache.cached?
%{<script type="text/javascript" src="#{cache.cache_file}"></script> %{<script from="jhw" type="text/javascript" src="#{cache.cache_file}"></script>
<script type="text/javascript"> <script type="text/javascript">window.CSTF['#{File.split(cache.cache_file).last}'] = '#{file}';</script>}
window.CSTF['#{File.split(cache.cache_file).last}'] = '#{file}';
</script>}
else else
%{<script type="text/javascript">#{source}</script>} %{<script from="jhw" type="text/javascript">#{source}</script>}
end end
rescue CoffeeScript::CompilationError => ne rescue CoffeeScript::CompilationError => ne
puts "[%s] %s: %s" % [ 'coffeescript'.color(:red), file.color(:yellow), "#{ne.message}".color(:white) ] puts "[%s] %s: %s" % [ 'coffeescript'.color(:red), file.color(:yellow), "#{ne.message}".color(:white) ]

View File

@ -10,6 +10,8 @@ module Jasmine::Headless
runner = Runner.new(options) runner = Runner.new(options)
if options[:do_list] if options[:do_list]
FilesList.reset!
files_list = FilesList.new(:config => runner.jasmine_config) files_list = FilesList.new(:config => runner.jasmine_config)
files_list.files.each { |file| puts file } files_list.files.each { |file| puts file }
else else

View File

@ -44,6 +44,7 @@ module Jasmine::Headless
register_engine '.coffee', Jasmine::Headless::CoffeeTemplate register_engine '.coffee', Jasmine::Headless::CoffeeTemplate
register_engine '.js', Jasmine::Headless::JSTemplate register_engine '.js', Jasmine::Headless::JSTemplate
register_engine '.css', Jasmine::Headless::CSSTemplate register_engine '.css', Jasmine::Headless::CSSTemplate
register_engine '.jst', Jasmine::Headless::JSTTemplate
end end
end end
@ -102,6 +103,7 @@ module Jasmine::Headless
@sprockets_environment.append_path(path) @sprockets_environment.append_path(path)
end end
@sprockets_environment.unregister_postprocessor('application/javascript', Sprockets::SafetyColons)
@sprockets_environment @sprockets_environment
end end
@ -157,7 +159,7 @@ module Jasmine::Headless
alert_time = nil alert_time = nil
end end
sprockets_environment.find_asset(file, :bundle => false).to_s sprockets_environment.find_asset(file, :bundle => false).body
end.flatten.compact.reject(&:empty?) end.flatten.compact.reject(&:empty?)
end end

View File

@ -7,7 +7,11 @@ module Jasmine::Headless
def prepare ; end def prepare ; end
def evaluate(scope, locals, &block) def evaluate(scope, locals, &block)
file ? %{<script type="text/javascript" src="#{file}"></script>} : data if data['from="jhw"']
data
else
file ? %{<script type="text/javascript" src="#{file}"></script>} : data
end
end end
end end
end end

View File

@ -0,0 +1,10 @@
require 'sprockets/jst_processor'
module Jasmine::Headless
class JSTTemplate < Sprockets::JstProcessor
def evaluate(*args)
%{<script type="text/javascript">#{super}</script>}
end
end
end