From b21573b1dc535006dc3480b1ef0105837daca4b3 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Fri, 2 Sep 2011 11:31:58 -0400 Subject: [PATCH] fix a bug and give a message when the cache is building --- lib/jasmine/files_list.rb | 12 +++++++++++- spec/lib/jasmine/files_list_spec.rb | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/jasmine/files_list.rb b/lib/jasmine/files_list.rb index 0201cd8..fc482c8 100644 --- a/lib/jasmine/files_list.rb +++ b/lib/jasmine/files_list.rb @@ -1,5 +1,6 @@ require 'jasmine-core' require 'iconv' +require 'time' module Jasmine class FilesList @@ -11,6 +12,8 @@ module Jasmine File.expand_path('../../../jasmine/jasmine.headless-reporter.js', __FILE__) ] + PLEASE_WAIT_IM_WORKING_TIME = 2 + def initialize(options = {}) @options = options @files = DEFAULT_FILES.dup @@ -50,7 +53,14 @@ module Jasmine private def to_html(files) + alert_time = Time.now + PLEASE_WAIT_IM_WORKING_TIME + files.collect { |file| + if alert_time && alert_time < Time.now + puts "Rebuilding cache, please wait..." + alert_time = nil + end + case File.extname(file) when '.coffee' begin @@ -67,7 +77,7 @@ module Jasmine when '.css' %{} end - }.flatten.reject(&:empty?) + }.flatten.compact.reject(&:empty?) end def spec_filter diff --git a/spec/lib/jasmine/files_list_spec.rb b/spec/lib/jasmine/files_list_spec.rb index 39bc53a..324ee62 100644 --- a/spec/lib/jasmine/files_list_spec.rb +++ b/spec/lib/jasmine/files_list_spec.rb @@ -151,6 +151,7 @@ describe Jasmine::FilesList do files_list.instance_variable_set(:@files, [ 'test.js', 'test.coffee', + 'test.whatever', 'test.css' ])