simplecov-html 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 38349194b1717a602b41d13d892a8497a77b9017
4
- data.tar.gz: e8fe1b9d0a4bb1f1d3599618313e505972d73b1e
3
+ metadata.gz: 97ee8b0f8840c051d83cfb9c263f4b22a0ebea9b
4
+ data.tar.gz: 2aab0a9c6da763c01b697077e8017536a0d96d78
5
5
  SHA512:
6
- metadata.gz: dac6283ba8d58ca4224d548597bf0e480d7610038d3a8ee05a58aef7b83f255c444f294df3e6053e3a5df19c2aadbc5eb43ace6d381e2461c84b676fac56e4d9
7
- data.tar.gz: cfd27221c619e31ccac5213f51556cc173c857140dd49e80c89f1ae72733f98ef6be731ec6d4afbee467c749d01de3ccdd03b2750fa711121dd488507c49d653
6
+ metadata.gz: 1c0f4fc7a256225c1ccf6b6b232b2a1798d8e332255e8bbaf43090709194290a0444956d6dd584535d1d7baf82b3d37959ef1a68ef8d41303214fc73a44095ec
7
+ data.tar.gz: 1b6010282ebc38d127d9ccfd077f946886834e964fc8a2fca42d0e7cf5b906f82058996cdafb34dabdb286324df6043727153b658a037013554b4b91fabd2a2a
@@ -0,0 +1,50 @@
1
+ Metrics/BlockNesting:
2
+ Max: 2
3
+
4
+ Metrics/LineLength:
5
+ AllowURI: true
6
+ Enabled: false
7
+
8
+ Metrics/MethodLength:
9
+ CountComments: false
10
+ Max: 10
11
+
12
+ Metrics/ParameterLists:
13
+ Max: 4
14
+ CountKeywordArgs: true
15
+
16
+ Style/AccessModifierIndentation:
17
+ EnforcedStyle: outdent
18
+
19
+ Style/CollectionMethods:
20
+ PreferredMethods:
21
+ map: 'collect'
22
+ reduce: 'inject'
23
+ find: 'detect'
24
+ find_all: 'select'
25
+
26
+ Style/Documentation:
27
+ Enabled: false
28
+
29
+ Style/DoubleNegation:
30
+ Enabled: false
31
+
32
+ Style/FileName:
33
+ Exclude:
34
+ - 'lib/simplecov-html.rb'
35
+ - 'test/test_simple_cov-html.rb'
36
+
37
+ Style/HashSyntax:
38
+ EnforcedStyle: hash_rockets
39
+
40
+ Style/RegexpLiteral:
41
+ Enabled: false
42
+
43
+ Style/SpaceInsideHashLiteralBraces:
44
+ EnforcedStyle: no_space
45
+
46
+ Style/StringLiterals:
47
+ EnforcedStyle: double_quotes
48
+
49
+ Style/TrailingComma:
50
+ EnforcedStyleForMultiline: 'comma'
@@ -0,0 +1,27 @@
1
+ language: ruby
2
+
3
+ before_install:
4
+ - gem install bundler
5
+
6
+ bundler_args: --without development --jobs=3 --retry=3
7
+
8
+ cache: bundler
9
+
10
+ sudo: false
11
+
12
+ rvm:
13
+ - 1.8.7
14
+ - 1.9.3
15
+ - 2.0.0
16
+ - 2.1
17
+ - 2.2
18
+ - ruby-head
19
+ - jruby
20
+ - rbx-2
21
+
22
+ matrix:
23
+ allow_failures:
24
+ - rvm: ruby-head
25
+ - rvm: jruby
26
+ - rvm: rbx-2
27
+ fast_finish: true
data/Gemfile CHANGED
@@ -1,15 +1,22 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
+ gem "rake"
6
+
7
+ # Use local copy of simplecov in development when checked out, fetch from git otherwise
8
+ if File.directory?(File.dirname(__FILE__) + "/../simplecov")
9
+ gem "simplecov", :path => File.dirname(__FILE__) + "/../simplecov"
10
+ else
11
+ gem "simplecov", :git => "https://github.com/colszowka/simplecov"
12
+ end
13
+
14
+ group :test do
15
+ gem "test-unit"
16
+ end
17
+
5
18
  group :development do
6
- # Use local copy of simplecov in development when checked out, fetch from git otherwise
7
- if File.directory?(File.dirname(__FILE__) + '/../simplecov')
8
- gem 'simplecov', :path => File.dirname(__FILE__) + '/../simplecov'
9
- else
10
- gem 'simplecov', :git => 'https://github.com/colszowka/simplecov'
11
- end
12
-
13
- gem 'guard-bundler'
14
- gem 'guard-rake'
19
+ gem "rubocop"
20
+ gem "sass"
21
+ gem "sprockets"
15
22
  end
data/Guardfile CHANGED
@@ -1,12 +1,12 @@
1
1
  # A sample Guardfile
2
2
  # More info at https://github.com/guard/guard#readme
3
3
 
4
- guard 'bundler' do
5
- watch('Gemfile')
4
+ guard "bundler" do
5
+ watch("Gemfile")
6
6
  # Uncomment next line if Gemfile contain `gemspec' command
7
7
  # watch(/^.+\.gemspec/)
8
8
  end
9
9
 
10
- guard 'rake', :task => 'assets:compile' do
10
+ guard "rake", :task => "assets:compile" do
11
11
  watch(%r{^assets\/})
12
- end
12
+ end
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- require 'bundler'
1
+ require "bundler"
2
2
  Bundler::GemHelper.install_tasks
3
3
 
4
4
  # See https://github.com/colszowka/simplecov/issues/171
@@ -9,24 +9,33 @@ end
9
9
  # Enforce proper permissions on each build
10
10
  Rake::Task[:build].prerequisites.unshift :fix_permissions
11
11
 
12
- require 'rake/testtask'
12
+ require "rake/testtask"
13
13
  Rake::TestTask.new(:test) do |test|
14
- test.libs << 'lib' << 'test'
15
- test.pattern = 'test/**/test_*.rb'
14
+ test.libs << "lib" << "test"
15
+ test.pattern = "test/**/test_*.rb"
16
16
  test.verbose = true
17
17
  end
18
18
 
19
- task :default => :test
19
+ begin
20
+ require "rubocop/rake_task"
21
+ RuboCop::RakeTask.new
22
+ rescue LoadError
23
+ task :rubocop do
24
+ $stderr.puts "Rubocop is disabled"
25
+ end
26
+ end
27
+
28
+ task :default => [:test, :rubocop]
20
29
 
21
30
  namespace :assets do
22
31
  desc "Compiles all assets"
23
32
  task :compile do
24
33
  puts "Compiling assets"
25
- require 'sprockets'
34
+ require "sprockets"
26
35
  assets = Sprockets::Environment.new
27
- assets.append_path 'assets/javascripts'
28
- assets.append_path 'assets/stylesheets'
29
- assets['application.js'].write_to('public/application.js')
30
- assets['application.css'].write_to('public/application.css')
36
+ assets.append_path "assets/javascripts"
37
+ assets.append_path "assets/stylesheets"
38
+ assets["application.js"].write_to("public/application.js")
39
+ assets["application.css"].write_to("public/application.css")
31
40
  end
32
41
  end
@@ -1,103 +1,110 @@
1
- require 'erb'
2
- require 'cgi'
3
- require 'fileutils'
4
- require 'digest/sha1'
5
- require 'time'
1
+ require "erb"
2
+ require "cgi"
3
+ require "fileutils"
4
+ require "digest/sha1"
5
+ require "time"
6
6
 
7
7
  # Ensure we are using a compatible version of SimpleCov
8
- if Gem::Version.new(SimpleCov::VERSION) < Gem::Version.new("0.9.0")
9
- raise RuntimeError, "The version of SimpleCov you are using is too old. Please update with `gem install simplecov` or `bundle update simplecov`"
8
+ major, minor, patch = SimpleCov::VERSION.scan(/\d+/).first(3).map(&:to_i)
9
+ if major < 0 || minor < 9 || patch < 0
10
+ fail "The version of SimpleCov you are using is too old. "\
11
+ "Please update with `gem install simplecov` or `bundle update simplecov`"
10
12
  end
11
13
 
12
- class SimpleCov::Formatter::HTMLFormatter
13
- def format(result)
14
- Dir[File.join(File.dirname(__FILE__), '../public/*')].each do |path|
15
- FileUtils.cp_r(path, asset_output_path)
14
+ module SimpleCov
15
+ module Formatter
16
+ class HTMLFormatter
17
+ def format(result)
18
+ Dir[File.join(File.dirname(__FILE__), "../public/*")].each do |path|
19
+ FileUtils.cp_r(path, asset_output_path)
20
+ end
21
+
22
+ File.open(File.join(output_path, "index.html"), "wb") do |file|
23
+ file.puts template("layout").result(binding)
24
+ end
25
+ puts output_message(result)
26
+ end
27
+
28
+ def output_message(result)
29
+ "Coverage report generated for #{result.command_name} to #{output_path}. #{result.covered_lines} / #{result.total_lines} LOC (#{result.covered_percent.round(2)}%) covered."
30
+ end
31
+
32
+ private
33
+
34
+ # Returns the an erb instance for the template of given name
35
+ def template(name)
36
+ ERB.new(File.read(File.join(File.dirname(__FILE__), "../views/", "#{name}.erb")))
37
+ end
38
+
39
+ def output_path
40
+ SimpleCov.coverage_path
41
+ end
42
+
43
+ def asset_output_path
44
+ return @asset_output_path if defined?(@asset_output_path) && @asset_output_path
45
+ @asset_output_path = File.join(output_path, "assets", SimpleCov::Formatter::HTMLFormatter::VERSION)
46
+ FileUtils.mkdir_p(@asset_output_path)
47
+ @asset_output_path
48
+ end
49
+
50
+ def assets_path(name)
51
+ File.join("./assets", SimpleCov::Formatter::HTMLFormatter::VERSION, name)
52
+ end
53
+
54
+ # Returns the html for the given source_file
55
+ def formatted_source_file(source_file)
56
+ template("source_file").result(binding)
57
+ end
58
+
59
+ # Returns a table containing the given source files
60
+ def formatted_file_list(title, source_files)
61
+ title_id = title.gsub(/^[^a-zA-Z]+/, "").gsub(/[^a-zA-Z0-9\-\_]/, "")
62
+ # Silence a warning by using the following variable to assign to itself:
63
+ # "warning: possibly useless use of a variable in void context"
64
+ # The variable is used by ERB via binding.
65
+ title_id = title_id
66
+ template("file_list").result(binding)
67
+ end
68
+
69
+ def coverage_css_class(covered_percent)
70
+ if covered_percent > 90
71
+ "green"
72
+ elsif covered_percent > 80
73
+ "yellow"
74
+ else
75
+ "red"
76
+ end
77
+ end
78
+
79
+ def strength_css_class(covered_strength)
80
+ if covered_strength > 1
81
+ "green"
82
+ elsif covered_strength == 1
83
+ "yellow"
84
+ else
85
+ "red"
86
+ end
87
+ end
88
+
89
+ # Return a (kind of) unique id for the source file given. Uses SHA1 on path for the id
90
+ def id(source_file)
91
+ Digest::SHA1.hexdigest(source_file.filename)
92
+ end
93
+
94
+ def timeago(time)
95
+ "<abbr class=\"timeago\" title=\"#{time.iso8601}\">#{time.iso8601}</abbr>"
96
+ end
97
+
98
+ def shortened_filename(source_file)
99
+ source_file.filename.gsub(SimpleCov.root, ".").gsub(/^\.\//, "")
100
+ end
101
+
102
+ def link_to_source_file(source_file)
103
+ %(<a href="##{id source_file}" class="src_link" title="#{shortened_filename source_file}">#{shortened_filename source_file}</a>)
104
+ end
16
105
  end
17
-
18
- File.open(File.join(output_path, "index.html"), 'wb') do |file|
19
- file.puts template('layout').result(binding)
20
- end
21
- puts output_message(result)
22
- end
23
-
24
- def output_message(result)
25
- "Coverage report generated for #{result.command_name} to #{output_path}. #{result.covered_lines} / #{result.total_lines} LOC (#{result.covered_percent.round(2)}%) covered."
26
- end
27
-
28
- private
29
-
30
- # Returns the an erb instance for the template of given name
31
- def template(name)
32
- ERB.new(File.read(File.join(File.dirname(__FILE__), '../views/', "#{name}.erb")))
33
- end
34
-
35
- def output_path
36
- SimpleCov.coverage_path
37
- end
38
-
39
- def asset_output_path
40
- return @asset_output_path if defined? @asset_output_path and @asset_output_path
41
- @asset_output_path = File.join(output_path, 'assets', SimpleCov::Formatter::HTMLFormatter::VERSION)
42
- FileUtils.mkdir_p(@asset_output_path)
43
- @asset_output_path
44
- end
45
-
46
- def assets_path(name)
47
- File.join('./assets', SimpleCov::Formatter::HTMLFormatter::VERSION, name)
48
- end
49
-
50
- # Returns the html for the given source_file
51
- def formatted_source_file(source_file)
52
- template('source_file').result(binding)
53
- end
54
-
55
- # Returns a table containing the given source files
56
- def formatted_file_list(title, source_files)
57
- # Silence a warning by using the following variable to assign to itself:
58
- # "warning: possibly useless use of a variable in void context"
59
- # The variable is used by ERB via binding.
60
- title_id = title_id = title.gsub(/^[^a-zA-Z]+/, '').gsub(/[^a-zA-Z0-9\-\_]/, '')
61
- template('file_list').result(binding)
62
- end
63
-
64
- def coverage_css_class(covered_percent)
65
- if covered_percent > 90
66
- 'green'
67
- elsif covered_percent > 80
68
- 'yellow'
69
- else
70
- 'red'
71
- end
72
- end
73
-
74
- def strength_css_class(covered_strength)
75
- if covered_strength > 1
76
- 'green'
77
- elsif covered_strength == 1
78
- 'yellow'
79
- else
80
- 'red'
81
- end
82
- end
83
-
84
- # Return a (kind of) unique id for the source file given. Uses SHA1 on path for the id
85
- def id(source_file)
86
- Digest::SHA1.hexdigest(source_file.filename)
87
- end
88
-
89
- def timeago(time)
90
- "<abbr class=\"timeago\" title=\"#{time.iso8601}\">#{time.iso8601}</abbr>"
91
- end
92
-
93
- def shortened_filename(source_file)
94
- source_file.filename.gsub(SimpleCov.root, '.').gsub(/^\.\//, '')
95
- end
96
-
97
- def link_to_source_file(source_file)
98
- %Q(<a href="##{id source_file}" class="src_link" title="#{shortened_filename source_file}">#{shortened_filename source_file}</a>)
99
106
  end
100
107
  end
101
108
 
102
109
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__)))
103
- require 'simplecov-html/version'
110
+ require "simplecov-html/version"
@@ -1,7 +1,27 @@
1
1
  module SimpleCov
2
2
  module Formatter
3
3
  class HTMLFormatter
4
- VERSION = "0.9.0"
4
+ VERSION = "0.10.0"
5
+
6
+ def VERSION.to_a
7
+ split(".").map(&:to_i)
8
+ end
9
+
10
+ def VERSION.major
11
+ to_a[0]
12
+ end
13
+
14
+ def VERSION.minor
15
+ to_a[1]
16
+ end
17
+
18
+ def VERSION.patch
19
+ to_a[2]
20
+ end
21
+
22
+ def VERSION.pre
23
+ to_a[3]
24
+ end
5
25
  end
6
26
  end
7
27
  end
@@ -1,26 +1,22 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require 'simplecov-html/version'
1
+ $LOAD_PATH.push File.expand_path("../lib", __FILE__)
2
+ require "simplecov-html/version"
4
3
 
5
- Gem::Specification.new do |s|
6
- s.name = "simplecov-html"
7
- s.version = SimpleCov::Formatter::HTMLFormatter::VERSION
8
- s.platform = Gem::Platform::RUBY
9
- s.authors = ["Christoph Olszowka"]
10
- s.email = ["christoph at olszowka de"]
11
- s.homepage = "https://github.com/colszowka/simplecov-html"
12
- s.summary = %Q{Default HTML formatter for SimpleCov code coverage tool for ruby 1.9+}
13
- s.description = %Q{Default HTML formatter for SimpleCov code coverage tool for ruby 1.9+}
14
- s.license = "MIT"
4
+ Gem::Specification.new do |gem|
5
+ gem.name = "simplecov-html"
6
+ gem.version = SimpleCov::Formatter::HTMLFormatter::VERSION
7
+ gem.platform = Gem::Platform::RUBY
8
+ gem.authors = ["Christoph Olszowka"]
9
+ gem.email = ["christoph at olszowka de"]
10
+ gem.homepage = "https://github.com/colszowka/simplecov-html"
11
+ gem.description = %(Default HTML formatter for SimpleCov code coverage tool for ruby 1.9+)
12
+ gem.summary = gem.description
13
+ gem.license = "MIT"
15
14
 
16
- s.rubyforge_project = "simplecov-html"
15
+ gem.required_ruby_version = ">= 1.8.7"
16
+ gem.add_development_dependency "bundler", "~> 1.9"
17
17
 
18
- s.add_development_dependency 'rake'
19
- s.add_development_dependency 'sprockets'
20
- s.add_development_dependency 'sass'
21
-
22
- s.files = `git ls-files`.split("\n")
23
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
24
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
25
- s.require_paths = ["lib"]
18
+ gem.files = `git ls-files`.split("\n")
19
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
+ gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
21
+ gem.require_paths = ["lib"]
26
22
  end
@@ -1,9 +1,4 @@
1
- require 'rubygems'
2
- require 'bundler/setup'
3
- require 'simplecov'
4
- require 'simplecov-html'
5
-
6
- require 'test/unit'
7
-
8
- class Test::Unit::TestCase
9
- end
1
+ require "bundler/setup"
2
+ require "simplecov"
3
+ require "simplecov-html"
4
+ require "test/unit"
@@ -1,4 +1,4 @@
1
- require 'helper'
1
+ require "helper"
2
2
 
3
3
  class TestSimpleCovHtml < Test::Unit::TestCase
4
4
  def test_defined
metadata CHANGED
@@ -1,57 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplecov-html
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christoph Olszowka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-18 00:00:00.000000000 Z
11
+ date: 2015-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rake
14
+ name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '1.9'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: sprockets
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: sass
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
26
+ version: '1.9'
55
27
  description: Default HTML formatter for SimpleCov code coverage tool for ruby 1.9+
56
28
  email:
57
29
  - christoph at olszowka de
@@ -61,6 +33,8 @@ extra_rdoc_files: []
61
33
  files:
62
34
  - ".document"
63
35
  - ".gitignore"
36
+ - ".rubocop.yml"
37
+ - ".travis.yml"
64
38
  - Gemfile
65
39
  - Guardfile
66
40
  - LICENSE
@@ -123,17 +97,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
97
  requirements:
124
98
  - - ">="
125
99
  - !ruby/object:Gem::Version
126
- version: '0'
100
+ version: 1.8.7
127
101
  required_rubygems_version: !ruby/object:Gem::Requirement
128
102
  requirements:
129
103
  - - ">="
130
104
  - !ruby/object:Gem::Version
131
105
  version: '0'
132
106
  requirements: []
133
- rubyforge_project: simplecov-html
107
+ rubyforge_project:
134
108
  rubygems_version: 2.4.5
135
109
  signing_key:
136
110
  specification_version: 4
137
111
  summary: Default HTML formatter for SimpleCov code coverage tool for ruby 1.9+
138
- test_files: []
139
- has_rdoc:
112
+ test_files:
113
+ - test/helper.rb
114
+ - test/test_simple_cov-html.rb