simplecov-markdown 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile.lock +8 -1
- data/lib/simplecov-markdown/version.rb +1 -1
- data/lib/simplecov-markdown.rb +70 -9
- data/simplecov-markdown.gemspec +1 -0
- data/spec/fixtures/report.md.erb +1 -1
- data/spec/spec_helper.rb +6 -0
- metadata +37 -43
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 77fb685487952f563a34ebdda156bbddbe51bc2f
|
4
|
+
data.tar.gz: 537dbf2962b297c5c94b03f1d4911e4787781304
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c4e012ceada38b895f8213488e83828181bf631bc5a0f196115b3a27d8c734bfd7adbb551bcbb94dd88339d672bce45edbb70d79b37c1de1f6717a14cff4dd55
|
7
|
+
data.tar.gz: f32508b3981c3668209ce95ccae55f9f65275583cdd30208e09dffe74195f56821712a755539ece176db8ca9922f8c61dd0a9bd7dc98a76531111fb8fab5dc08
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
simplecov-markdown (0.1.
|
4
|
+
simplecov-markdown (0.1.1)
|
5
5
|
simplecov
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
+
colorize (0.7.5)
|
10
11
|
coveralls (0.7.2)
|
11
12
|
multi_json (~> 1.3)
|
12
13
|
rest-client (= 1.6.7)
|
@@ -15,6 +16,7 @@ GEM
|
|
15
16
|
thor (= 0.18.1)
|
16
17
|
diff-lcs (1.2.5)
|
17
18
|
docile (1.1.5)
|
19
|
+
hirb (0.7.2)
|
18
20
|
mime-types (2.4.3)
|
19
21
|
multi_json (1.10.1)
|
20
22
|
rake (10.4.2)
|
@@ -38,6 +40,10 @@ GEM
|
|
38
40
|
docile (~> 1.1.0)
|
39
41
|
multi_json (~> 1.0)
|
40
42
|
simplecov-html (~> 0.8.0)
|
43
|
+
simplecov-console (0.2.0)
|
44
|
+
colorize
|
45
|
+
hirb
|
46
|
+
simplecov
|
41
47
|
simplecov-html (0.8.0)
|
42
48
|
term-ansicolor (1.2.2)
|
43
49
|
tins (~> 0.8)
|
@@ -53,4 +59,5 @@ DEPENDENCIES
|
|
53
59
|
rake (~> 10.0)
|
54
60
|
rspec
|
55
61
|
rspec-temp_dir (~> 0.0.3)
|
62
|
+
simplecov-console
|
56
63
|
simplecov-markdown!
|
data/lib/simplecov-markdown.rb
CHANGED
@@ -2,17 +2,78 @@ require "simplecov-markdown/version"
|
|
2
2
|
|
3
3
|
class SimpleCov::Formatter::MarkdownFormatter
|
4
4
|
def format(result)
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
@report.puts "|:--|--:|"
|
10
|
-
result.files.each do |file|
|
11
|
-
@report.puts "|#{file.filename}|#{file.covered_percent}%|"
|
12
|
-
end
|
13
|
-
@report.close
|
5
|
+
report_writer = ReportWriter.new(SimpleCov::Formatter::MarkdownFormatter.output_path)
|
6
|
+
report_writer.write_header "Code Coverage Report"
|
7
|
+
report_writer.write_result(result)
|
8
|
+
report_writer.destroy!
|
14
9
|
end
|
15
10
|
def self.output_path
|
16
11
|
File.join(SimpleCov.coverage_path, 'report.md')
|
17
12
|
end
|
13
|
+
|
14
|
+
class ReportWriter
|
15
|
+
attr_reader :report
|
16
|
+
|
17
|
+
def initialize(report_path)
|
18
|
+
@report = File.open(report_path, 'w')
|
19
|
+
@table_writer = TableWriter.new(report)
|
20
|
+
end
|
21
|
+
|
22
|
+
def write_header(title)
|
23
|
+
@report.puts title
|
24
|
+
@report.puts "=" * 20 + "\n\n"
|
25
|
+
end
|
26
|
+
|
27
|
+
def write_result(result)
|
28
|
+
@table_writer.write_header
|
29
|
+
result.files.each do |file|
|
30
|
+
@table_writer.write_record(file.filename, file.covered_percent.to_s + "%")
|
31
|
+
end
|
32
|
+
@table_writer.destroy!
|
33
|
+
end
|
34
|
+
|
35
|
+
def destroy!
|
36
|
+
@report.close
|
37
|
+
@report = nil
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
class TableWriter
|
42
|
+
attr_reader :report, :columns_headers, :columns_header_aligns
|
43
|
+
|
44
|
+
def initialize(report)
|
45
|
+
@report = report
|
46
|
+
@columns_headers = ["File", "Coverage"]
|
47
|
+
@columns_header_aligns = [:left, :right]
|
48
|
+
end
|
49
|
+
|
50
|
+
def write_header
|
51
|
+
write_values @columns_headers
|
52
|
+
headers = @columns_header_aligns.map do |align|
|
53
|
+
case align
|
54
|
+
when :left
|
55
|
+
":--"
|
56
|
+
when :right
|
57
|
+
"--:"
|
58
|
+
else
|
59
|
+
"--"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
write_values headers
|
63
|
+
end
|
64
|
+
|
65
|
+
def write_record(*args)
|
66
|
+
write_values args
|
67
|
+
end
|
68
|
+
|
69
|
+
def destroy!
|
70
|
+
@report = nil
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
def write_values(*args)
|
76
|
+
@report.puts "|" + args.join("|") + "|"
|
77
|
+
end
|
78
|
+
end
|
18
79
|
end
|
data/simplecov-markdown.gemspec
CHANGED
data/spec/fixtures/report.md.erb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,15 @@
|
|
1
1
|
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
2
|
require 'simplecov'
|
3
|
+
require 'simplecov-console'
|
3
4
|
|
4
5
|
if ENV["COVERALLS_REPO_TOKEN"]
|
5
6
|
require 'coveralls'
|
6
7
|
Coveralls.wear!
|
8
|
+
else
|
9
|
+
SimpleCov.formatters = [
|
10
|
+
SimpleCov::Formatter::Console,
|
11
|
+
SimpleCov::Formatter::MarkdownFormatter
|
12
|
+
]
|
7
13
|
end
|
8
14
|
|
9
15
|
SimpleCov.start do
|
metadata
CHANGED
@@ -1,110 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplecov-markdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Noritaka Horio
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-09 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: simplecov
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rspec-temp_dir
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- - ~>
|
31
|
+
- - "~>"
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 0.0.3
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- - ~>
|
38
|
+
- - "~>"
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 0.0.3
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: bundler
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- - ~>
|
45
|
+
- - "~>"
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '1.0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- - ~>
|
52
|
+
- - "~>"
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '1.0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rake
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- - ~>
|
59
|
+
- - "~>"
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '10.0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- - ~>
|
66
|
+
- - "~>"
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '10.0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: rspec
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - ">="
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - ">="
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: coveralls
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - ">="
|
100
88
|
- !ruby/object:Gem::Version
|
101
89
|
version: '0'
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- -
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov-console
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
108
109
|
- !ruby/object:Gem::Version
|
109
110
|
version: '0'
|
110
111
|
description: Markdown formatter for simplecov
|
@@ -114,10 +115,10 @@ executables: []
|
|
114
115
|
extensions: []
|
115
116
|
extra_rdoc_files: []
|
116
117
|
files:
|
117
|
-
- .coveralls.yml
|
118
|
-
- .gitignore
|
119
|
-
- .rspec
|
120
|
-
- .travis.yml
|
118
|
+
- ".coveralls.yml"
|
119
|
+
- ".gitignore"
|
120
|
+
- ".rspec"
|
121
|
+
- ".travis.yml"
|
121
122
|
- Gemfile
|
122
123
|
- Gemfile.lock
|
123
124
|
- LICENSE
|
@@ -134,33 +135,26 @@ files:
|
|
134
135
|
homepage: ''
|
135
136
|
licenses:
|
136
137
|
- MIT
|
138
|
+
metadata: {}
|
137
139
|
post_install_message:
|
138
140
|
rdoc_options: []
|
139
141
|
require_paths:
|
140
142
|
- lib
|
141
143
|
required_ruby_version: !ruby/object:Gem::Requirement
|
142
|
-
none: false
|
143
144
|
requirements:
|
144
|
-
- -
|
145
|
+
- - ">="
|
145
146
|
- !ruby/object:Gem::Version
|
146
147
|
version: '0'
|
147
|
-
segments:
|
148
|
-
- 0
|
149
|
-
hash: -4304802998839078227
|
150
148
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
|
-
none: false
|
152
149
|
requirements:
|
153
|
-
- -
|
150
|
+
- - ">="
|
154
151
|
- !ruby/object:Gem::Version
|
155
152
|
version: '0'
|
156
|
-
segments:
|
157
|
-
- 0
|
158
|
-
hash: -4304802998839078227
|
159
153
|
requirements: []
|
160
154
|
rubyforge_project:
|
161
|
-
rubygems_version:
|
155
|
+
rubygems_version: 2.4.2
|
162
156
|
signing_key:
|
163
|
-
specification_version:
|
157
|
+
specification_version: 4
|
164
158
|
summary: Markdown formatter for simplecov
|
165
159
|
test_files:
|
166
160
|
- spec/fixtures/report.md.erb
|