simplecov-rcov-text 0.0.2 → 0.0.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.
- data/Gemfile +3 -1
- data/Gemfile.lock +11 -3
- data/README.rdoc +10 -6
- data/Rakefile +3 -0
- data/lib/simplecov-rcov-text.rb +6 -7
- data/lib/simplecov-rcov-text/version.rb +1 -1
- data/simplecov-rcov-text.gemspec +2 -1
- data/test/fixtures/some_class.rb +5 -1
- data/test/test_simplecov-rcov-text.rb +24 -17
- metadata +25 -34
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,12 +1,20 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
docile (1.1.0)
|
5
|
+
minitest (5.0.8)
|
6
|
+
multi_json (1.8.2)
|
7
|
+
rake (10.1.0)
|
8
|
+
simplecov (0.8.2)
|
9
|
+
docile (~> 1.1.0)
|
10
|
+
multi_json
|
11
|
+
simplecov-html (~> 0.8.0)
|
12
|
+
simplecov-html (0.8.0)
|
7
13
|
|
8
14
|
PLATFORMS
|
9
15
|
ruby
|
10
16
|
|
11
17
|
DEPENDENCIES
|
18
|
+
minitest
|
19
|
+
rake
|
12
20
|
simplecov
|
data/README.rdoc
CHANGED
@@ -12,9 +12,9 @@ Add the gem to the Gemfile preferably in the group test:
|
|
12
12
|
gem 'simplecov-rcov-text', :require => false
|
13
13
|
|
14
14
|
Create a .metrics file in the root of project with the code:
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
MetricFu::Configuration.run do |config|
|
16
|
+
config.rcov[:external] = 'coverage/rcov/rcov.txt'
|
17
|
+
end
|
18
18
|
|
19
19
|
|
20
20
|
And follow the instructions of Simplecov[https://github.com/colszowka/simplecov] and metric_fu[https://github.com/jscruggs/metric_fu] or metrical[https://github.com/iain/metrical].
|
@@ -33,7 +33,7 @@ And follow the instructions of Simplecov[https://github.com/colszowka/simplecov]
|
|
33
33
|
SimpleCov::Formatter::RcovTextFormatter.new.format(result)
|
34
34
|
end
|
35
35
|
end
|
36
|
-
|
36
|
+
SimpleCov.formatter = SimpleCov::Formatter::MergedFormatter
|
37
37
|
|
38
38
|
== Running metric_fu/metrical
|
39
39
|
Be sure that you configured simplecov and simplecov-rcov-text.
|
@@ -51,8 +51,12 @@ After that you can run the metric_fu/metrical command.
|
|
51
51
|
def method_1
|
52
52
|
1+1
|
53
53
|
end
|
54
|
-
|
54
|
+
|
55
55
|
def method_2 ( value )
|
56
56
|
!! value * value
|
57
57
|
end
|
58
|
-
end
|
58
|
+
end
|
59
|
+
|
60
|
+
= Running tests
|
61
|
+
bundle
|
62
|
+
rake
|
data/Rakefile
CHANGED
data/lib/simplecov-rcov-text.rb
CHANGED
@@ -8,16 +8,15 @@ unless defined?(SimpleCov)
|
|
8
8
|
raise RuntimeError, "simplecov-rcov-text is a formatter for simplecov. Please update your test helper and gemfile to require 'simplecov'!"
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
11
|
class SimpleCov::Formatter::RcovTextFormatter
|
13
12
|
def format( result )
|
14
13
|
FileUtils.mkdir_p(SimpleCov::Formatter::RcovTextFormatter.output_path)
|
15
14
|
|
16
|
-
File.open(File.join(SimpleCov::Formatter::RcovTextFormatter.output_path, SimpleCov::Formatter::RcovTextFormatter.file_name), "
|
15
|
+
File.open(File.join(SimpleCov::Formatter::RcovTextFormatter.output_path, SimpleCov::Formatter::RcovTextFormatter.file_name), "wb+") do |rcov|
|
17
16
|
rcov << create_content(result)
|
18
17
|
end
|
19
18
|
end
|
20
|
-
|
19
|
+
|
21
20
|
def create_content(result)
|
22
21
|
content = "metric_fu shift the first line\n"
|
23
22
|
result.source_files.each do |source_file|
|
@@ -33,16 +32,16 @@ class SimpleCov::Formatter::RcovTextFormatter
|
|
33
32
|
end
|
34
33
|
content
|
35
34
|
end
|
36
|
-
|
35
|
+
|
37
36
|
def simple_file_name(source_file)
|
38
37
|
source_file.filename.gsub(SimpleCov.root, '.')
|
39
38
|
end
|
40
|
-
|
39
|
+
|
41
40
|
def self.file_name
|
42
41
|
"rcov.txt"
|
43
42
|
end
|
44
|
-
|
43
|
+
|
45
44
|
def self.output_path
|
46
45
|
File.join( SimpleCov.coverage_path, "/rcov" )
|
47
46
|
end
|
48
|
-
end
|
47
|
+
end
|
data/simplecov-rcov-text.gemspec
CHANGED
@@ -8,10 +8,11 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["William 'Kina'"]
|
10
10
|
s.email = ["thekina@gmail.com"]
|
11
|
-
s.homepage =
|
11
|
+
s.homepage = SimpleCov::Formatter::RcovTextFormatter::UPSTREAM_URL
|
12
12
|
s.summary = %q{A Simplecov Formatter}
|
13
13
|
s.description = %q{Just a Simplecov Formatter to cheat metric_fu.
|
14
14
|
Generate a rcov.txt file.}
|
15
|
+
s.license = 'MIT'
|
15
16
|
s.extra_rdoc_files = [
|
16
17
|
"README.rdoc"
|
17
18
|
]
|
data/test/fixtures/some_class.rb
CHANGED
@@ -1,37 +1,44 @@
|
|
1
|
-
require 'minitest
|
1
|
+
require 'minitest'
|
2
2
|
require 'minitest/autorun'
|
3
|
+
require 'minitest/unit'
|
3
4
|
require 'simplecov'
|
4
5
|
|
5
6
|
require 'simplecov-rcov-text'
|
6
7
|
|
7
|
-
class TestSimpleCovFormatterRcovTextFormatter < MiniTest::
|
8
|
+
class TestSimpleCovFormatterRcovTextFormatter < MiniTest::Test
|
8
9
|
def setup
|
9
10
|
@rcov_file = File.join( SimpleCov::Formatter::RcovTextFormatter.output_path, SimpleCov::Formatter::RcovTextFormatter.file_name)
|
11
|
+
File.delete( @rcov_file ) if File.exists?( @rcov_file )
|
12
|
+
|
10
13
|
@result = SimpleCov::Result.new(
|
11
|
-
{
|
12
|
-
File.expand_path( File.join( File.dirname( __FILE__ ), 'fixtures', 'some_class.rb' ) ) =>
|
13
|
-
[1,1,1,1,nil,1,0,1,1]
|
14
|
+
{
|
15
|
+
File.expand_path( File.join( File.dirname( __FILE__ ), 'fixtures', 'some_class.rb' ) ) =>
|
16
|
+
[1,1,1,1,nil,1,0,1,1,nil,0,1,1]
|
14
17
|
}
|
15
18
|
)
|
16
|
-
|
17
|
-
|
19
|
+
|
20
|
+
# Set to default encoding
|
21
|
+
Encoding.default_internal = nil if defined?(Encoding)
|
18
22
|
end
|
23
|
+
|
19
24
|
def test_format
|
20
|
-
if File.exists?( @rcov_file )
|
21
|
-
File.delete( @rcov_file )
|
22
|
-
end
|
23
|
-
|
24
25
|
SimpleCov::Formatter::RcovTextFormatter.new.format( @result )
|
25
|
-
|
26
|
+
|
26
27
|
assert File.exists?( @rcov_file )
|
27
|
-
|
28
28
|
end
|
29
|
+
|
30
|
+
def test_encoding
|
31
|
+
# This is done in many rails environments
|
32
|
+
Encoding.default_internal = 'UTF-8' if defined?(Encoding)
|
33
|
+
|
34
|
+
SimpleCov::Formatter::RcovTextFormatter.new.format( @result )
|
35
|
+
end
|
36
|
+
|
29
37
|
def test_create_content
|
30
38
|
content = SimpleCov::Formatter::RcovTextFormatter.new.create_content( @result )
|
31
39
|
test = "\="*80
|
32
|
-
assert_match /#{test}/,content
|
33
40
|
|
34
|
-
assert_match
|
35
|
-
|
41
|
+
assert_match(/#{test}/, content)
|
42
|
+
assert_match(/!! value \* value/, content)
|
36
43
|
end
|
37
|
-
end
|
44
|
+
end
|
metadata
CHANGED
@@ -1,31 +1,25 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplecov-rcov-text
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
4
5
|
prerelease:
|
5
|
-
version: 0.0.2
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- William 'Kina'
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
date: 2011-04-28 00:00:00 -03:00
|
14
|
-
default_executable:
|
12
|
+
date: 2014-02-17 00:00:00.000000000 Z
|
15
13
|
dependencies: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
Generate a rcov.txt file.
|
20
|
-
email:
|
14
|
+
description: ! "Just a Simplecov Formatter to cheat metric_fu.\n Generate a rcov.txt
|
15
|
+
file."
|
16
|
+
email:
|
21
17
|
- thekina@gmail.com
|
22
18
|
executables: []
|
23
|
-
|
24
19
|
extensions: []
|
25
|
-
|
26
|
-
extra_rdoc_files:
|
20
|
+
extra_rdoc_files:
|
27
21
|
- README.rdoc
|
28
|
-
files:
|
22
|
+
files:
|
29
23
|
- .gitignore
|
30
24
|
- Gemfile
|
31
25
|
- Gemfile.lock
|
@@ -36,34 +30,31 @@ files:
|
|
36
30
|
- simplecov-rcov-text.gemspec
|
37
31
|
- test/fixtures/some_class.rb
|
38
32
|
- test/test_simplecov-rcov-text.rb
|
39
|
-
has_rdoc: true
|
40
33
|
homepage: https://github.com/kina/simplecov-rcov-text
|
41
|
-
licenses:
|
42
|
-
|
34
|
+
licenses:
|
35
|
+
- MIT
|
43
36
|
post_install_message:
|
44
37
|
rdoc_options: []
|
45
|
-
|
46
|
-
require_paths:
|
38
|
+
require_paths:
|
47
39
|
- lib
|
48
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
41
|
none: false
|
50
|
-
requirements:
|
51
|
-
- -
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version:
|
54
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
47
|
none: false
|
56
|
-
requirements:
|
57
|
-
- -
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
version:
|
48
|
+
requirements:
|
49
|
+
- - ! '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
60
52
|
requirements: []
|
61
|
-
|
62
53
|
rubyforge_project: simplecov-rcov-text
|
63
|
-
rubygems_version: 1.
|
54
|
+
rubygems_version: 1.8.24
|
64
55
|
signing_key:
|
65
56
|
specification_version: 3
|
66
57
|
summary: A Simplecov Formatter
|
67
|
-
test_files:
|
58
|
+
test_files:
|
68
59
|
- test/fixtures/some_class.rb
|
69
60
|
- test/test_simplecov-rcov-text.rb
|