Skip to content

Commit

Permalink
Add spec_w task for running specs with warnings enabled
Browse files Browse the repository at this point in the history
This filters out warnings that should be ignored, using the same
criteria Sequel uses.
  • Loading branch information
jeremyevans committed Oct 7, 2014
1 parent 2183cc9 commit 12777b7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ begin
spec = lambda do |name, files, d|
lib_dir = File.join(File.dirname(File.expand_path(__FILE__)), 'lib')
ENV['RUBYLIB'] ? (ENV['RUBYLIB'] += ":#{lib_dir}") : (ENV['RUBYLIB'] = lib_dir)

desc "#{d} with -w, some warnings filtered"
task "#{name}_w" do
ENV['RUBYOPT'] ? (ENV['RUBYOPT'] += " -w") : (ENV['RUBYOPT'] = '-w')
rake = ENV['RAKE'] || "#{FileUtils::RUBY} -S rake"
sh "#{rake} #{name} 2>&1 | egrep -v \"(spec/.*: warning: (possibly )?useless use of == in void context|: warning: instance variable @.* not initialized|: warning: method redefined; discarding old|: warning: previous definition of)|rspec\""
end

desc d
spec_class.new(name) do |t|
t.send spec_files_meth, files
Expand Down

0 comments on commit 12777b7

Please sign in to comment.