more cleanups for things i found that are broken
This commit is contained in:
parent
2316041580
commit
38327e6a95
@ -16,6 +16,7 @@ module Jasmine::Headless
|
||||
|
||||
autoload :CoffeeTemplate, 'jasmine/headless/coffee_template'
|
||||
autoload :JSTemplate, 'jasmine/headless/js_template'
|
||||
autoload :JSTTemplate, 'jasmine/headless/jst_template'
|
||||
autoload :CSSTemplate, 'jasmine/headless/css_template'
|
||||
|
||||
autoload :Report, 'jasmine/headless/report'
|
||||
|
@ -11,12 +11,10 @@ module Jasmine::Headless
|
||||
cache = Jasmine::Headless::CoffeeScriptCache.new(file)
|
||||
source = cache.handle
|
||||
if cache.cached?
|
||||
%{<script type="text/javascript" src="#{cache.cache_file}"></script>
|
||||
<script type="text/javascript">
|
||||
window.CSTF['#{File.split(cache.cache_file).last}'] = '#{file}';
|
||||
</script>}
|
||||
%{<script from="jhw" type="text/javascript" src="#{cache.cache_file}"></script>
|
||||
<script type="text/javascript">window.CSTF['#{File.split(cache.cache_file).last}'] = '#{file}';</script>}
|
||||
else
|
||||
%{<script type="text/javascript">#{source}</script>}
|
||||
%{<script from="jhw" type="text/javascript">#{source}</script>}
|
||||
end
|
||||
rescue CoffeeScript::CompilationError => ne
|
||||
puts "[%s] %s: %s" % [ 'coffeescript'.color(:red), file.color(:yellow), "#{ne.message}".color(:white) ]
|
||||
|
@ -10,6 +10,8 @@ module Jasmine::Headless
|
||||
runner = Runner.new(options)
|
||||
|
||||
if options[:do_list]
|
||||
FilesList.reset!
|
||||
|
||||
files_list = FilesList.new(:config => runner.jasmine_config)
|
||||
files_list.files.each { |file| puts file }
|
||||
else
|
||||
|
@ -44,6 +44,7 @@ module Jasmine::Headless
|
||||
register_engine '.coffee', Jasmine::Headless::CoffeeTemplate
|
||||
register_engine '.js', Jasmine::Headless::JSTemplate
|
||||
register_engine '.css', Jasmine::Headless::CSSTemplate
|
||||
register_engine '.jst', Jasmine::Headless::JSTTemplate
|
||||
end
|
||||
end
|
||||
|
||||
@ -102,6 +103,7 @@ module Jasmine::Headless
|
||||
@sprockets_environment.append_path(path)
|
||||
end
|
||||
|
||||
@sprockets_environment.unregister_postprocessor('application/javascript', Sprockets::SafetyColons)
|
||||
@sprockets_environment
|
||||
end
|
||||
|
||||
@ -157,7 +159,7 @@ module Jasmine::Headless
|
||||
alert_time = nil
|
||||
end
|
||||
|
||||
sprockets_environment.find_asset(file, :bundle => false).to_s
|
||||
sprockets_environment.find_asset(file, :bundle => false).body
|
||||
end.flatten.compact.reject(&:empty?)
|
||||
end
|
||||
|
||||
|
@ -7,8 +7,12 @@ module Jasmine::Headless
|
||||
def prepare ; end
|
||||
|
||||
def evaluate(scope, locals, &block)
|
||||
if data['from="jhw"']
|
||||
data
|
||||
else
|
||||
file ? %{<script type="text/javascript" src="#{file}"></script>} : data
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
10
lib/jasmine/headless/jst_template.rb
Normal file
10
lib/jasmine/headless/jst_template.rb
Normal 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
|
||||
|
Loading…
Reference in New Issue
Block a user