File: ignore-simplecov-html

package info (click to toggle)
ruby-simplecov 0.7.1-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 608 kB
  • ctags: 218
  • sloc: ruby: 1,718; makefile: 7
file content (35 lines) | stat: -rw-r--r-- 1,135 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Description: Ignore simplecov-html load failured
 Break dependency cycle
Author: Christian Hofstaedtler <zeha@debian.org>
Last-updated: 2013-12-23


Index: ruby-simplecov/lib/simplecov/defaults.rb
===================================================================
--- ruby-simplecov.orig/lib/simplecov/defaults.rb	2013-12-23 23:58:40.661796884 +0100
+++ ruby-simplecov/lib/simplecov/defaults.rb	2013-12-23 23:58:40.653796910 +0100
@@ -1,5 +1,9 @@
 # Load default formatter gem
-require 'simplecov-html'
+begin
+  require 'simplecov-html'
+rescue LoadError
+  puts "Loading simplecov-html failed, install ruby-simplecov-html"
+end
 
 SimpleCov.adapters.define 'root_filter' do
   # Exclude all files outside of simplecov root
@@ -32,7 +36,12 @@ end
 
 # Default configuration
 SimpleCov.configure do
-  formatter SimpleCov::Formatter::HTMLFormatter
+  begin
+    formatter SimpleCov::Formatter::HTMLFormatter
+  rescue NameError
+    # simplecov-html not installed, fall back to SimpleFormatter
+    formatter SimpleCov::Formatter::SimpleFormatter
+  end
   # Exclude files outside of SimpleCov.root
   load_adapter 'root_filter'
 end