codacy-coverage 0.3.1 → 1.0.0
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.
- checksums.yaml +8 -8
- data/Gemfile +4 -4
- data/README.md +2 -0
- data/circle.yml +4 -0
- data/codacy-coverage.gemspec +0 -1
- data/lib/codacy/client.rb +18 -15
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDMzNTcyOWY3MjI4OTc0MDJhZmJmMDYzMTdjYmQ3NDYxNDk2ZjZhMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OWUwMTc1NmE3NGFlYTUxNGVhMTE3MGQ3N2E0NGM5Y2ZjZDI1ZTJhZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzNjM2ZiOTYxM2VhN2MxNTRmOTRkMmFjOTJiOTA4ZjlmZmU4MTYxM2NmZGVh
|
10
|
+
MDI3MzE3MDEwZWM5MGZhNTVjNTlhYmFhOGQyODk4NGVlZWIyZTMwM2FmMTA1
|
11
|
+
NDc0MmFhYzcyYzMyZTE1MjUwMGE3MjE1NjkwYTNhOTI1MjFkNzM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MjkxNzEyMjM3Y2QzY2ZlZjJiM2UyOWY3YzViOGIyZDI1OWZlODljZWI5YmE1
|
14
|
+
ZjM5MWZkMDlkOGMzMDEwNjdmZTQ4MzAyNDhhMDBjMzAxMDM5ZDlhOGQzY2Y3
|
15
|
+
NDZlNTc0NjQ4N2RiOWViOGM0NmY4ZWEyZjJhNzQxMTkwNGZjYWI=
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -42,6 +42,8 @@ By default this plugin will not submit results if you run your tests in localhos
|
|
42
42
|
export CODACY_RUN_LOCAL=true
|
43
43
|
```
|
44
44
|
|
45
|
+
> Note: You should keep your API token well **protected**, as it grants owner permissions to your projects.
|
46
|
+
|
45
47
|
#### Running Tests
|
46
48
|
|
47
49
|
When you run your tests, the plugin will send the coverage info to Codacy.
|
data/circle.yml
CHANGED
data/codacy-coverage.gemspec
CHANGED
data/lib/codacy/client.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'json'
|
2
|
-
require
|
2
|
+
require "uri"
|
3
|
+
require "net/https"
|
3
4
|
|
4
5
|
module Codacy
|
5
6
|
module ClientAPI
|
@@ -29,19 +30,21 @@ module Codacy
|
|
29
30
|
end
|
30
31
|
end
|
31
32
|
|
32
|
-
def self.send_request(url,
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
33
|
+
def self.send_request(url, content, project_token, redirects = 3)
|
34
|
+
uri = URI.parse(url)
|
35
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
36
|
+
request = Net::HTTP::Post.new(uri.path)
|
37
|
+
http.use_ssl = true
|
38
|
+
request["project_token"] = project_token
|
39
|
+
request["Content-Type"] = "application/json"
|
40
|
+
request.body = content
|
41
|
+
response = http.request(request)
|
42
|
+
|
43
|
+
if [301, 302, 307].include? response.code.to_i and redirects > 0
|
44
|
+
redirected_url = response.headers[:location]
|
45
|
+
send_request(redirected_url, content, project_token, redirects - 1)
|
46
|
+
else
|
47
|
+
response.body
|
45
48
|
end
|
46
49
|
end
|
47
50
|
|
@@ -49,4 +52,4 @@ module Codacy
|
|
49
52
|
Codacy::Configuration.logger
|
50
53
|
end
|
51
54
|
end
|
52
|
-
end
|
55
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codacy-coverage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nuno Teixeira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simplecov
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ! '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.10.0
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rest-client
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ~>
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '1.8'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ~>
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '1.8'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: bundler
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|