fix a bug and give a message when the cache is building
This commit is contained in:
parent
8b8fc32f80
commit
b21573b1dc
@ -1,5 +1,6 @@
|
|||||||
require 'jasmine-core'
|
require 'jasmine-core'
|
||||||
require 'iconv'
|
require 'iconv'
|
||||||
|
require 'time'
|
||||||
|
|
||||||
module Jasmine
|
module Jasmine
|
||||||
class FilesList
|
class FilesList
|
||||||
@ -11,6 +12,8 @@ module Jasmine
|
|||||||
File.expand_path('../../../jasmine/jasmine.headless-reporter.js', __FILE__)
|
File.expand_path('../../../jasmine/jasmine.headless-reporter.js', __FILE__)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
PLEASE_WAIT_IM_WORKING_TIME = 2
|
||||||
|
|
||||||
def initialize(options = {})
|
def initialize(options = {})
|
||||||
@options = options
|
@options = options
|
||||||
@files = DEFAULT_FILES.dup
|
@files = DEFAULT_FILES.dup
|
||||||
@ -50,7 +53,14 @@ module Jasmine
|
|||||||
|
|
||||||
private
|
private
|
||||||
def to_html(files)
|
def to_html(files)
|
||||||
|
alert_time = Time.now + PLEASE_WAIT_IM_WORKING_TIME
|
||||||
|
|
||||||
files.collect { |file|
|
files.collect { |file|
|
||||||
|
if alert_time && alert_time < Time.now
|
||||||
|
puts "Rebuilding cache, please wait..."
|
||||||
|
alert_time = nil
|
||||||
|
end
|
||||||
|
|
||||||
case File.extname(file)
|
case File.extname(file)
|
||||||
when '.coffee'
|
when '.coffee'
|
||||||
begin
|
begin
|
||||||
@ -67,7 +77,7 @@ module Jasmine
|
|||||||
when '.css'
|
when '.css'
|
||||||
%{<link rel="stylesheet" href="#{file}" type="text/css" />}
|
%{<link rel="stylesheet" href="#{file}" type="text/css" />}
|
||||||
end
|
end
|
||||||
}.flatten.reject(&:empty?)
|
}.flatten.compact.reject(&:empty?)
|
||||||
end
|
end
|
||||||
|
|
||||||
def spec_filter
|
def spec_filter
|
||||||
|
@ -151,6 +151,7 @@ describe Jasmine::FilesList do
|
|||||||
files_list.instance_variable_set(:@files, [
|
files_list.instance_variable_set(:@files, [
|
||||||
'test.js',
|
'test.js',
|
||||||
'test.coffee',
|
'test.coffee',
|
||||||
|
'test.whatever',
|
||||||
'test.css'
|
'test.css'
|
||||||
])
|
])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user