codeclimate-test-reporter 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/codeclimate-test-reporter.rb +10 -1
- metadata +2 -2
@@ -1,10 +1,11 @@
|
|
1
1
|
require "json"
|
2
|
+
require "digest/sha1"
|
2
3
|
require "net/https"
|
3
4
|
require "uri"
|
4
5
|
|
5
6
|
module CodeClimate
|
6
7
|
class TestReporter
|
7
|
-
VERSION = "0.0.
|
8
|
+
VERSION = "0.0.2"
|
8
9
|
|
9
10
|
class API
|
10
11
|
def self.host
|
@@ -49,6 +50,7 @@ module CodeClimate
|
|
49
50
|
|
50
51
|
{
|
51
52
|
name: short_filename(file.filename),
|
53
|
+
blob_id: calculate_blob_id(file.filename),
|
52
54
|
coverage: file.coverage.to_json,
|
53
55
|
covered_percent: file.covered_percent.round(2),
|
54
56
|
covered_strength: file.covered_strength.round(2),
|
@@ -127,6 +129,13 @@ module CodeClimate
|
|
127
129
|
end
|
128
130
|
end
|
129
131
|
|
132
|
+
def calculate_blob_id(path)
|
133
|
+
content = File.open(path, "rb").read
|
134
|
+
header = "blob #{content.length}\0"
|
135
|
+
store = header + content
|
136
|
+
Digest::SHA1.hexdigest(store)
|
137
|
+
end
|
138
|
+
|
130
139
|
def short_filename(filename)
|
131
140
|
return filename unless ::SimpleCov.root
|
132
141
|
filename.gsub(::SimpleCov.root, '.').gsub(/^\.\//, '')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codeclimate-test-reporter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: simplecov
|