simplecov-rcov-text 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,5 +1,7 @@
1
1
  source :rubygems
2
2
 
3
3
  group :test, :development do
4
+ gem 'rake'
5
+ gem 'minitest'
4
6
  gem 'simplecov'
5
- end
7
+ end
@@ -1,12 +1,20 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- simplecov (0.4.2)
5
- simplecov-html (~> 0.4.4)
6
- simplecov-html (0.4.4)
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
@@ -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
- MetricFu::Configuration.run do |config|
16
- config.rcov[:external] = 'coverage/rcov/rcov.txt'
17
- end
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
- SimpleCov.formatter = SimpleCov::Formatter::MergedFormatter
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
@@ -1,4 +1,5 @@
1
1
  require 'bundler'
2
+ require 'bundler/setup'
2
3
  Bundler::GemHelper.install_tasks
3
4
 
4
5
  require 'rake/testtask'
@@ -6,3 +7,5 @@ require 'rake/testtask'
6
7
  Rake::TestTask.new do |t|
7
8
  t.pattern = "test/test_*.rb"
8
9
  end
10
+
11
+ task :default => :test
@@ -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), "w+") do |rcov|
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
@@ -1,7 +1,7 @@
1
1
  module SimpleCov
2
2
  module Formatter
3
3
  class RcovTextFormatter
4
- VERSION = "0.0.2"
4
+ VERSION = "0.0.3"
5
5
  UPSTREAM_URL = "https://github.com/kina/simplecov-rcov-text"
6
6
  end
7
7
  end
@@ -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 = "https://github.com/kina/simplecov-rcov-text"
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
  ]
@@ -6,4 +6,8 @@ class SomeClass
6
6
  def method_2 ( value )
7
7
  value * value
8
8
  end
9
- end
9
+
10
+ def method_3
11
+ "über"
12
+ end
13
+ end
@@ -1,37 +1,44 @@
1
- require 'minitest/unit'
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::Unit::TestCase
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 /!! value \* value/,content
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
- description: |-
18
- Just a Simplecov Formatter to cheat metric_fu.
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: "0"
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: "0"
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.6.2
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