def initialize(*args)
@name = args.shift || :spec
@pattern, @rcov_path, @rcov_opts, @ruby_opts, @rspec_opts = nil, nil, nil, nil, nil
@warning, @rcov = false, false
@verbose, @fail_on_error = true, true
yield self if block_given?
@rcov_path ||= 'rcov'
@rspec_path ||= 'rspec'
@pattern ||= './spec{,/*/**}/*_spec.rb'
desc("Run RSpec code examples") unless ::Rake.application.last_comment
task name do
RakeFileUtils.send(:verbose, verbose) do
if files_to_run.empty?
puts "No examples matching #{pattern} could be found"
else
begin
puts spec_command if verbose
success = system(spec_command)
rescue
puts failure_message if failure_message
end
raise("#{spec_command} failed") if fail_on_error unless success
end
end
end
end