From 1156f5c1ec88b46ff9e53a4f44360554327feec7 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Mon, 11 Apr 2011 10:31:53 -0400 Subject: [PATCH] a few fixes for the binary, handles jasmine defaults now --- bin/jasmine-headless-webkit | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/bin/jasmine-headless-webkit b/bin/jasmine-headless-webkit index 921b411..6659576 100755 --- a/bin/jasmine-headless-webkit +++ b/bin/jasmine-headless-webkit @@ -12,15 +12,24 @@ files = [ 'file://' + File.join(gem_dir, 'jasmine/lib/jasmine.css') ] +DEFAULTS = { + 'spec_files' => [ '**/*[sS]pec.js' ], + 'helpers' => [ 'helpers/**/*.js' ] +} + files += [ [ 'src_files', 'src_dir' ], [ 'stylesheets', 'src_dir' ], [ 'helpers', 'spec_dir' ], [ 'spec_files', 'spec_dir' ] ].collect do |searches, root| - data[searches].collect do |search| - path = search - path = File.join(data[root], path) if data[root] - Dir[path] + data[searches] ||= DEFAULTS[searches] + + if data[searches] + data[searches].collect do |search| + path = search + path = File.join(data[root], path) if data[root] + Dir[path] + end end end -files = files.flatten.collect { |file| +files = files.flatten.compact.collect { |file| case File.extname(file) when '.js' %{}