From 0dc83a72aa7e3e3430f8709d2acc720f18bd2d8e Mon Sep 17 00:00:00 2001 From: Patrick Mahoney Date: Sat, 24 Mar 2012 13:27:42 -0500 Subject: [PATCH] Add rake task to generate flog report. --- Rakefile | 24 ++++++++++++++++++++++-- process_shared.gemspec | 1 + 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 7d8d49d..87ece38 100644 --- a/Rakefile +++ b/Rakefile @@ -1,10 +1,12 @@ +require 'ci/reporter/rake/minitest' require 'ffi' +require 'fileutils' +require 'flog' require 'rake/extensiontask' require 'rake/testtask' require 'rake/version_task' -require 'rubygems/package_task' require 'rubygems/gem_runner' -require 'ci/reporter/rake/minitest' +require 'rubygems/package_task' def gemspec @gemspec ||= Gem::Specification.load('process_shared.gemspec') @@ -51,3 +53,21 @@ if Version.current.prerelease? sh %{rake push version:bump:pre} end end + +desc 'Generate flog reports for all ruby code' +task :flog do + opts = { + :all => true, + :blame => true, + :details => true, + :group => true + } + flog = Flog.new(opts) + flog.flog('lib') + out = 'target/reports/flog.txt' + FileUtils.mkdir_p(File.dirname(out)) + File.open('target/reports/flog.txt', 'wb') {|io| flog.report io } +end + +desc 'Run test for CI environment with xunit reports and flog' +task :ci_test => ['ci:setup:minitest', :test, :flog] diff --git a/process_shared.gemspec b/process_shared.gemspec index bbbed4c..a5872ee 100644 --- a/process_shared.gemspec +++ b/process_shared.gemspec @@ -15,6 +15,7 @@ Gem::Specification.new do |s| s.add_dependency('ffi', '~> 1.0') s.add_development_dependency('ci_reporter') + s.add_development_dependency('flog') s.add_development_dependency('minitest') s.add_development_dependency('minitest-matchers') s.add_development_dependency('rake')