lib/taza/tasks.rb in scudco-taza-0.8.4 vs lib/taza/tasks.rb in scudco-taza-0.8.5

- old
+ new

@@ -29,21 +29,26 @@ Dir.glob('./spec/*/').each do |dir| recurse_to_create_rake_tasks(dir) end end end + def recurse_to_create_rake_tasks(dir) basename = File.basename(dir) - define_spec_task(basename,File.join(dir,"**","*_spec.rb")) - namespace basename do - Dir.glob(File.join(dir,"*_spec.rb")).each do |spec_file| - spec_name = File.basename(spec_file,'_spec.rb') - define_spec_task(spec_name,spec_file) + spec_pattern = File.join(dir,"**","*_spec.rb") + if (not Dir.glob(spec_pattern).empty?) + define_spec_task(basename,spec_pattern) + namespace basename do + Dir.glob(File.join(dir,"*_spec.rb")).each do |spec_file| + spec_name = File.basename(spec_file,'_spec.rb') + define_spec_task(spec_name,spec_file) + end + Dir.glob(File.join(dir,"*/")).each do |sub_dir| + recurse_to_create_rake_tasks(sub_dir) + end end - Dir.glob(File.join(dir,"*/")).each do |sub_dir| - recurse_to_create_rake_tasks(sub_dir) - end end end + end end end