Sha256: 2003c5953ed2681627b74cc7b416732d2b47818299c93d346905a529c6b4e9c9
Contents?: true
Size: 1.22 KB
Versions: 9
Compression:
Stored size: 1.22 KB
Contents
require 'rubygems' require 'rake' require 'rspec/core/rake_task' include Rake::DSL module Taza module Rake class Tasks attr_accessor :spec_opts def initialize yield self if block_given? define end def define_spec_task(name,glob_path) RSpec::Core::RakeTask.new name do |t| t.pattern = Dir.glob(glob_path) t.rspec_opts = spec_opts end end def define namespace :spec do 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) 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 end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems