diff --git a/.gitignore b/.gitignore index 5c2b6b3..ff45f90 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,4 @@ /.idea public/system -analyzer/* +analyzer diff --git a/Rakefile b/Rakefile index 28b980a..502ec1b 100644 --- a/Rakefile +++ b/Rakefile @@ -8,4 +8,4 @@ Ocelots::Application.load_tasks Rake::Task[:default].prerequisites.clear # task :default => %w(db:drop db:migrate analyzer:flay analyzer:rails_best_practices spec stats) -task :default => %w(db:migrate db:test:prepare analyzer:flay spec stats) \ No newline at end of file +task :default => %w(db:migrate db:test:prepare analyzer:flay analyzer:rails_best_practices spec stats) \ No newline at end of file diff --git a/lib/tasks/analysis.rake b/lib/tasks/analysis.rake index 630ef8b..7f1509d 100644 --- a/lib/tasks/analysis.rake +++ b/lib/tasks/analysis.rake @@ -2,8 +2,10 @@ namespace :analyzer do desc "run rails_best_practices" task :rails_best_practices do require 'rails_best_practices' - app_root = Rake.application.original_dir - output_file = File.join(app_root, 'analyzer', 'rails_best_practices.html') + app_root = Rails.root + output_dir = File.join(app_root, 'analyzer') + mkdir_p output_dir + output_file = File.join(output_dir, 'rails_best_practices.html') analyzer = RailsBestPractices::Analyzer.new(app_root, { 'format' => 'html', 'with-textmate' => true, @@ -11,7 +13,7 @@ namespace :analyzer do }) analyzer.analyze analyzer.output - fail "found bad practices, see details in " + output_file if analyzer.runner.errors.size >0 + fail "found bad practices, see details in " + output_file if analyzer.runner.errors.size > 37 end desc "run flay and analyze code for structural similarities"