::Rake::TaskLib
# File lib/rspec/core/rake_task.rb, line 112 112: def initialize(*args) 113: @name = args.shift || :spec 114: @pattern, @rcov_path, @rcov_opts, @ruby_opts, @rspec_opts = nil, nil, nil, nil, nil 115: @warning, @rcov = false, false 116: @verbose, @fail_on_error = true, true 117: 118: yield self if block_given? 119: 120: @rcov_path ||= 'rcov' 121: @rspec_path ||= 'rspec' 122: @pattern ||= './spec{,/*/**}/*_spec.rb' 123: 124: desc("Run RSpec code examples") unless ::Rake.application.last_comment 125: 126: task name do 127: RakeFileUtils.send(:verbose, verbose) do 128: if files_to_run.empty? 129: puts "No examples matching #{pattern} could be found" 130: else 131: begin 132: puts spec_command if verbose 133: success = system(spec_command) 134: rescue 135: puts failure_message if failure_message 136: end 137: raise("#{spec_command} failed") if fail_on_error unless success 138: end 139: end 140: end 141: end
@deprecated Has no effect. The rake task now checks ENV[‘BUNDLE_GEMFILE’] instead.
# File lib/rspec/core/rake_task.rb, line 31 31: def gemfile=(*) 32: RSpec.deprecate("RSpec::Core::RakeTask#gemfile=", 'ENV["BUNDLE_GEMFILE"]') 33: end
@deprecated Has no effect. The rake task now checks ENV[‘BUNDLE_GEMFILE’] instead.
# File lib/rspec/core/rake_task.rb, line 25 25: def skip_bundler=(*) 26: RSpec.deprecate("RSpec::Core::RakeTask#skip_bundler=") 27: end
@deprecated Use rspec_opts instead.
Command line options to pass to rspec.
default:
nil
# File lib/rspec/core/rake_task.rb, line 107 107: def spec_opts=(opts) 108: RSpec.deprecate('RSpec::Core::RakeTask#spec_opts=', 'rspec_opts=') 109: @rspec_opts = opts 110: end
@deprecated Use ruby_opts=”-w” instead.
When true, requests that the specs be run with the warning flag set. e.g. “ruby -w“
default:
false
# File lib/rspec/core/rake_task.rb, line 43 43: def warning=(true_or_false) 44: RSpec.deprecate("RSpec::Core::RakeTask#warning=", 'ruby_opts="-w"') 45: @warning = true_or_false 46: end
# File lib/rspec/core/rake_task.rb, line 174 174: def blank 175: lambda {|s| s.nil? || s == ""} 176: end
# File lib/rspec/core/rake_task.rb, line 145 145: def files_to_run 146: if ENV['SPEC'] 147: FileList[ ENV['SPEC'] ] 148: else 149: FileList[ pattern ].map { |f| f.gsub(/"/, '\"').gsub(/'/, "\\\\'") } 150: end 151: end
# File lib/rspec/core/rake_task.rb, line 170 170: def runner 171: rcov ? rcov_path : rspec_path 172: end
# File lib/rspec/core/rake_task.rb, line 153 153: def spec_command 154: @spec_command ||= begin 155: cmd_parts = [] 156: cmd_parts << RUBY 157: cmd_parts << ruby_opts 158: cmd_parts << "-w" if @warning 159: cmd_parts << "-S" << runner 160: cmd_parts << "-Ispec:lib" << rcov_opts if rcov 161: cmd_parts << files_to_run 162: cmd_parts << "--" if rcov && rspec_opts 163: cmd_parts << rspec_opts 164: cmd_parts.flatten.reject(&blank).join(" ") 165: end 166: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.