class RSpec::Core::RakeTask

def blank

def blank
  lambda {|s| s.nil? || s == ""}
end

def files_to_run

def files_to_run
  if ENV['SPEC']
    FileList[ ENV['SPEC'] ]
  else
    FileList[ pattern ].map { |f| f.gsub(/"/, '\"').gsub(/'/, "\\\\'") }
  end
end

def gemfile=(*)

Deprecated:
def gemfile=(*)
  RSpec.deprecate("RSpec::Core::RakeTask#gemfile=", 'ENV["BUNDLE_GEMFILE"]')
end

def initialize(*args)

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

def runner

def runner
  rcov ? rcov_path : rspec_path
end

def skip_bundler=(*)

Deprecated:
def skip_bundler=(*)
  RSpec.deprecate("RSpec::Core::RakeTask#skip_bundler=")
end

def spec_command

def spec_command
  @spec_command ||= begin
                      cmd_parts = []
                      cmd_parts << RUBY
                      cmd_parts << ruby_opts
                      cmd_parts << "-w" if @warning
                      cmd_parts << "-S" << runner
                      cmd_parts << "-Ispec:lib" << rcov_opts if rcov
                      cmd_parts << files_to_run
                      cmd_parts << "--" if rcov && rspec_opts
                      cmd_parts << rspec_opts
                      cmd_parts.flatten.reject(&blank).join(" ")
                    end
end

def spec_opts=(opts)

Deprecated:
def spec_opts=(opts)
  RSpec.deprecate('RSpec::Core::RakeTask#spec_opts=', 'rspec_opts=')
  @rspec_opts = opts
end

def warning=(true_or_false)

Deprecated:
def warning=(true_or_false)
  RSpec.deprecate("RSpec::Core::RakeTask#warning=", 'ruby_opts="-w"')
  @warning = true_or_false
end