From caa9bd3aa2477c5f277f32c9f24b2e12000c71ab Mon Sep 17 00:00:00 2001 From: "Michael S. Klishin" Date: Sun, 4 May 2008 15:31:10 +0300 Subject: [PATCH] Add Rake task that detects spec groups intereference --- Rakefile | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/Rakefile b/Rakefile index dc43f47c..76bd7e03 100644 --- a/Rakefile +++ b/Rakefile @@ -6,7 +6,7 @@ require 'strokedb'; require 'core_ext' require 'task/echoe' Echoe.taskify do Dir['task/**/*.task'].each {|t| load t} - + namespace :echoe do Echoe.new('strokedb', StrokeDB::VERSION) do |g| g.author = ['Yurii Rashkovskii', 'Oleg Andreev'] @@ -19,15 +19,15 @@ Echoe.taskify do time), it scales infinitely, it even allows free versioning and integrates perfectly with Ruby applications. EOF - + g.platform = Gem::Platform::RUBY g.dependencies = ['diff-lcs >= 1.1.2', 'uuidtools >= 1.0.3', 'json >= 1.1.2'] - + g.manifest_name = 'meta/MANIFEST' g.ignore_pattern = /(^\.git|^.DS_Store$|^meta|^test\/storages|^examples\/(.*).strokedb|^bugs)/ g.executable_pattern = 'bin/strokedb' end - + desc 'tests packaged files to ensure they are all present' task :verify => :package do # An error message will be displayed if files are missing @@ -35,14 +35,14 @@ Echoe.taskify do puts "\nThe library files are present" end end - + desc 'Clean tree, update manifest, and install gem' task :magic => [:clean, :manifest, :install] end - + desc 'Check what\'s up in this mug' task :sup => [:'rcov:run', :'rcov:verify'] - + # Developers: Run this before commiting! desc 'Check everything over before commiting!' task :aok => [:'rcov:verbose', :'rcov:strict', :'rcov:open', @@ -57,4 +57,29 @@ task :cruise => [:'ditz:html', :'rdoc:html', :'rcov:bw', :'rcov:verify'] task :default => :list task :list do system 'rake -T' -end \ No newline at end of file +end + + +desc "Detects interfering spec group pairs. By Michael Klishin." +task :interfers do +file = ENV['SPECFILE'] + + all_specs = Dir.glob(File.dirname(__FILE__) + "/spec/**/*_spec.rb") - [File.expand_path(file)] + all_specs.each do |specfile| + pair = "#{specfile} #{file}" + output = `spec -c #{pair}` + + if output =~ /0\sfailures/ + print "." + STDOUT.flush + else + puts "\n\nACHTUNG! Coupled spec groups detected! Fuck! Shit! You should have this fixed ASAP! AAAAA!!!" + puts "spec -c #{pair}" + puts "Run says \n\n" + puts output + end + end + + puts + puts +end