p8-metric_fu 0.8.2 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,6 +18,7 @@ module MetricFu
18
18
  end
19
19
 
20
20
  def self.generate_report(base_dir, options={})
21
+ FileUtils.mkdir_p(base_dir, :verbose => false) unless File.directory?(base_dir)
21
22
  self.new(base_dir, options).generate_report
22
23
  end
23
24
 
@@ -1,40 +1,52 @@
1
1
  require 'fileutils'
2
- require 'spec/rake/spectask'
3
- require 'spec/rake/verify_rcov'
4
-
5
- namespace :metrics do
6
-
7
- COVERAGE_DIR = File.join(MetricFu::BASE_DIRECTORY, 'coverage')
8
- COVERAGE_DATA_FILE = File.join(MetricFu::BASE_DIRECTORY, 'coverage.data')
9
- SPEC_HTML_FILE = File.join(MetricFu::BASE_DIRECTORY, 'specs.html')
10
-
11
- namespace :coverage do
12
- rcov_output = COVERAGE_DIR
13
-
14
- desc "Delete aggregate coverage data."
15
- task(:clean) { rm_f("rcov_tmp", :verbose => false) }
16
-
17
- desc "RCov task to generate report"
18
- Spec::Rake::SpecTask.new(:do => :clean) do |t|
19
- FileUtils.mkdir_p(MetricFu::BASE_DIRECTORY) unless File.directory?(MetricFu::BASE_DIRECTORY)
20
- t.ruby_opts = ['-rtest/unit']
21
- t.spec_files = FileList['test/**/*_test.rb', 'spec/**/*spec.rb']
22
- t.spec_opts = ["--format", "html:#{SPEC_HTML_FILE}", "--diff"]
23
- t.rcov = true
24
- t.rcov_opts = ["--sort coverage", "--html", "--rails", "--exclude /gems/,/Library/"]
25
- t.rcov_dir = COVERAGE_DIR
2
+
3
+ begin
4
+ require 'rcov'
5
+ require 'rcov/rcovtask'
6
+ require 'spec/rake/spectask'
7
+
8
+ namespace :metrics do
9
+
10
+ COVERAGE_DIR = File.join(MetricFu::BASE_DIRECTORY, 'coverage')
11
+ COVERAGE_DATA_FILE = File.join(MetricFu::BASE_DIRECTORY, 'coverage.data')
12
+ SPEC_HTML_FILE = File.join(MetricFu::BASE_DIRECTORY, 'specs.html')
13
+
14
+ namespace :coverage do
15
+ rcov_output = COVERAGE_DIR
16
+
17
+ desc "Delete aggregate coverage data."
18
+ task(:clean) { rm_f("rcov_tmp", :verbose => false) }
19
+
20
+ desc "RCov task to generate report"
21
+ Rcov::RcovTask.new(:do => :clean) do |t|
22
+ FileUtils.mkdir_p(MetricFu::BASE_DIRECTORY) unless File.directory?(MetricFu::BASE_DIRECTORY)
23
+ t.test_files = FileList['test/**/*_test.rb', 'spec/**/*_spec.rb']
24
+ t.rcov_opts = ["--sort coverage", "--html", "--rails", "--exclude /gems/,/Library/"]
25
+ t.output_dir = COVERAGE_DIR
26
+ end
27
+ # TODO not sure what this improves but it requires the diff-lcs gem
28
+ # http://github.com/indirect/metric_fu/commit/b9c1cf75f09d5b531b388cd01661eb16b5126968#diff-1
29
+ # Spec::Rake::SpecTask.new(:do => :clean) do |t|
30
+ # FileUtils.mkdir_p(MetricFu::BASE_DIRECTORY) unless File.directory?(MetricFu::BASE_DIRECTORY)
31
+ # t.ruby_opts = ['-rtest/unit']
32
+ # t.spec_files = FileList['test/**/*_test.rb', 'spec/**/*spec.rb']
33
+ # t.spec_opts = ["--format", "html:#{SPEC_HTML_FILE}", "--diff"]
34
+ # t.rcov = true
35
+ # t.rcov_opts = ["--sort coverage", "--html", "--rails", "--exclude /gems/,/Library/"]
36
+ # t.rcov_dir = COVERAGE_DIR
37
+ # end
26
38
  end
27
-
28
- RCov::VerifyTask.new(:verify => :do) do |t|
29
- t.threshold = ( ENV['THRESHOLD'] ? ENV['THRESHOLD'].to_f : 100.0 )
30
- t.index_html = File.join(COVERAGE_DIR, 'index.html')
39
+
40
+ desc "Generate and open coverage report"
41
+ task :coverage => ['coverage:do'] do
42
+ system("open #{COVERAGE_DIR}/index.html") if PLATFORM['darwin']
31
43
  end
32
44
  end
33
-
45
+ rescue LoadError
46
+ if RUBY_PLATFORM =~ /java/
47
+ puts 'running in jruby - rcov tasks not available'
48
+ else
49
+ puts 'sudo gem install rcov # if you want the rcov tasks'
50
+
34
51
  end
35
-
36
- desc "Generate and open coverage report"
37
- task :coverage => ['coverage:do'] do
38
- system("open #{COVERAGE_DIR}/index.html") if PLATFORM['darwin']
39
- end
40
- end
52
+ end
metadata CHANGED
@@ -1,17 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: p8-metric_fu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Scruggs
8
8
  - Sean Soper
9
9
  - Andre Arko
10
+ - Petrik de Heus
10
11
  autorequire:
11
12
  bindir: bin
12
13
  cert_chain: []
13
14
 
14
- date: 2008-10-27 00:00:00 -07:00
15
+ date: 2008-12-22 00:00:00 -08:00
15
16
  default_executable:
16
17
  dependencies:
17
18
  - !ruby/object:Gem::Dependency