class Rspec::Core::RakeTask

def define # :nodoc:

:nodoc:
def define # :nodoc:
  actual_name = Hash === name ? name.keys.first : name
  desc("Run all 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
        cmd_parts = [rcov ? 'rcov' : RUBY]
        cmd_parts += rcov ? [rcov_opts] : [ruby_opts]
        cmd_parts << '-Ilib'
        cmd_parts << '-Ispec'
        cmd_parts << "-w" if warning
        cmd_parts += files_to_run.collect { |fn| %["#{fn}"] }
        cmd = cmd_parts.join(" ")
        puts cmd if verbose
        unless system(cmd)
          STDERR.puts failure_message if failure_message
          raise("Command #{cmd} failed") if fail_on_error
        end
      end
    end
  end
  self
end

def files_to_run # :nodoc:

:nodoc:
def files_to_run # :nodoc:
  FileList[ pattern ].to_a
end

def initialize(*args)

def initialize(*args)
  @name = args.shift || :spec
  @pattern, @rcov_opts, @ruby_opts = nil, nil, nil
  @warning, @rcov = false, false
  @fail_on_error = true
  yield self if block_given?
  @pattern ||= 'spec/**/*_spec.rb'
  define
end