revolutionhealth-metricks 0.4 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.4.1 / 2008-06-13
2
+
3
+ * Rcov tests now extend beyond one level depth directory by using RcovTask instead of the shell
4
+
1
5
  === 0.4.0 / 2008-06-13
2
6
 
3
7
  * Implementing functionality for use as a gem
data/README CHANGED
@@ -1,4 +1,4 @@
1
- Version 0.4.0
1
+ Version 0.4.1
2
2
  http://github.com/revolutionhealth/metricks
3
3
 
4
4
  Metricks is a fork of the metric_fu project and is a set of rake tasks that make it easy to generate metrics reports. It uses Saikuro, Flog, Rcov, and Rails' built-in stats task to create a series of reports. It's designed to integrate easily with CruiseControl.rb by placing files in the Custom Build Artifacts folder.
@@ -1,36 +1,38 @@
1
1
  require 'fileutils'
2
2
 
3
- namespace :metricks do
4
-
5
- COVERAGE_DIR = File.join(Metricks::BASE_DIRECTORY, 'coverage')
6
- COVERAGE_DATA_FILE = File.join(COVERAGE_DIR, "coverage.data")
7
-
8
- desc "A coverage report using rcov"
9
- task :coverage do
10
- FileUtils.rm_rf(COVERAGE_DATA_FILE, :verbose => false) if File.exist?(COVERAGE_DATA_FILE)
11
- FileUtils.mkdir_p(COVERAGE_DIR) unless File.directory?(COVERAGE_DIR)
12
- paths = defined?(TEST_PATHS_FOR_RCOV) ? TEST_PATHS_FOR_RCOV : ['test/**/*_test.rb']
13
- paths.each { |path| execute_rcov(path) }
14
- end
3
+ begin
4
+ require 'rcov'
5
+ require 'rcov/rcovtask'
6
+
7
+ namespace :metricks do
8
+
9
+ COVERAGE_DIR = File.join(Metricks::BASE_DIRECTORY, 'coverage')
10
+ COVERAGE_DATA_FILE = File.join(COVERAGE_DIR, 'coverage.data')
15
11
 
16
- def execute_rcov(test_list)
17
- default_options = {"--rails" => "",
18
- "--aggregate" => "#{File.join(COVERAGE_DIR, 'coverage.data')}",
19
- "--sort" => "coverage",
20
- "--exclude" => '"gems/*,rcov*,spec/*,test/*"',
21
- "--output" => %["#{COVERAGE_DIR}"]}
22
-
23
- default_options.merge!(RCOV_OPTIONS) if defined?(RCOV_OPTIONS)
24
- options = ""
25
- default_options.each_pair { |key, value| options << "#{key} #{value} " }
26
-
27
- sh "rcov #{options} #{test_list}" do |ok, response|
28
- unless ok
29
- puts "Rcov failed with exit status: #{response.exitstatus}"
30
- exit 1
12
+ namespace :coverage do
13
+ rcov_output = COVERAGE_DIR
14
+
15
+ desc "Delete aggregate coverage data."
16
+ task(:clean) { rm_f("rcov_tmp", :verbose => false) }
17
+
18
+ desc "RCov task to generate report"
19
+ Rcov::RcovTask.new(:unit => :clean) do |t|
20
+ FileUtils.mkdir_p(COVERAGE_DIR) unless File.directory?(COVERAGE_DIR)
21
+ t.test_files = FileList['test/**/*_test.rb']
22
+ t.rcov_opts = ["--sort coverage", "--aggregate '#{COVERAGE_DATA_FILE}'", "--html", "--rails"]
23
+ t.output_dir = COVERAGE_DIR + '/unit'
31
24
  end
32
25
  end
33
26
 
34
- system("open #{COVERAGE_DIR}/index.html") if PLATFORM['darwin']
27
+ desc "Generate and open coverage report"
28
+ task :coverage => ['coverage:unit'] do
29
+ system("open #{COVERAGE_DIR}/unit/index.html") if PLATFORM['darwin']
30
+ end
31
+ end
32
+ rescue LoadError
33
+ if RUBY_PLATFORM =~ /java/
34
+ puts 'running in jruby - rcov tasks not available'
35
+ else
36
+ puts 'sudo gem install rcov # if you want the rcov tasks'
35
37
  end
36
38
  end
data/metricks.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "metricks"
3
- s.version = "0.4"
3
+ s.version = "0.4.1"
4
4
  s.date = "2008-06-13"
5
5
  s.summary = "Generates project metrics using Flog, RCov, Saikuro and more"
6
6
  s.email = "sean.soper@gmail.com"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: revolutionhealth-metricks
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.4"
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Soper