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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzQyOTNkZDczMTMwY2Q1OTE4MWZmNzA4ZTQyMzIwMjdmOTk2MzkxMw==
4
+ NDMzNTcyOWY3MjI4OTc0MDJhZmJmMDYzMTdjYmQ3NDYxNDk2ZjZhMw==
5
5
  data.tar.gz: !binary |-
6
- MDZhYzY1NmYwYWVlM2U0MjA4ZTFmZDEwZDJkZDRhMGUxMjhiZmI1ZQ==
6
+ OWUwMTc1NmE3NGFlYTUxNGVhMTE3MGQ3N2E0NGM5Y2ZjZDI1ZTJhZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NmJjYWJiZDg2YWE4Y2YyZTIzN2IxYjBjMTVmMjdiNWZhZDUyNTVjNWM5N2U4
10
- ZDU5NTFhYmM2M2NhZWUzOTNjYjA5NDk4MWQ5ZjY3OGIxNmJmYWVmYWM2YWRl
11
- Y2U4NWNiNTA5NWM3ZDhjNmRlNjkzOGI0MWJhZWQ3YzEyMzkwYTM=
9
+ YzNjM2ZiOTYxM2VhN2MxNTRmOTRkMmFjOTJiOTA4ZjlmZmU4MTYxM2NmZGVh
10
+ MDI3MzE3MDEwZWM5MGZhNTVjNTlhYmFhOGQyODk4NGVlZWIyZTMwM2FmMTA1
11
+ NDc0MmFhYzcyYzMyZTE1MjUwMGE3MjE1NjkwYTNhOTI1MjFkNzM=
12
12
  data.tar.gz: !binary |-
13
- YmQwNTY4ODY0Mzg1MjM2ODRhMDM1MTY1ZDJiNWFhYmJiZWM4YmVhYzk1MjY2
14
- MmNhMmI4ODYyY2QyY2IwODAxNzllZTc2NjE5MWRhOGJhOWJmY2UyYWU2OTEy
15
- MGIzZWNlNTAxMjA3OGFkNGJlMzg0ZTQ3YzQzZDA0OTU5ZjEzZjU=
13
+ MjkxNzEyMjM3Y2QzY2ZlZjJiM2UyOWY3YzViOGIyZDI1OWZlODljZWI5YmE1
14
+ ZjM5MWZkMDlkOGMzMDEwNjdmZTQ4MzAyNDhhMDBjMzAxMDM5ZDlhOGQzY2Y3
15
+ NDZlNTc0NjQ4N2RiOWViOGM0NmY4ZWEyZjJhNzQxMTkwNGZjYWI=
data/Gemfile CHANGED
@@ -1,8 +1,8 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
-
5
- gem 'rake', '>= 10.4'
6
- gem 'rspec', '>= 3.2'
4
+ ruby "1.9.3"
5
+
6
+ gem 'rake', :platforms => 'ruby_19'
7
+ gem 'rspec', :platforms => 'ruby_19'
7
8
  gem 'simplecov', :require => false
8
- gem 'rest-client'
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
@@ -1,3 +1,7 @@
1
+ machine:
2
+ ruby:
3
+ version: 1.9.3-p0-falcon
4
+
1
5
  test:
2
6
  override:
3
7
  - bundle exec rspec
@@ -19,7 +19,6 @@ Gem::Specification.new do |gem|
19
19
  gem.required_ruby_version = '>= 1.9.2'
20
20
 
21
21
  gem.add_dependency 'simplecov', '>= 0.10.0'
22
- gem.add_dependency 'rest-client', '~> 1.8'
23
22
 
24
23
  gem.add_development_dependency 'bundler', '~> 1.7'
25
24
  end
@@ -1,5 +1,6 @@
1
1
  require 'json'
2
- require 'rest_client'
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, request, project_token, redirects = 3)
33
- RestClient.post(
34
- url,
35
- request,
36
- 'project_token' => project_token,
37
- :content_type => :json
38
- ) do |resp, req, result, &block|
39
- if [301, 302, 307].include? resp.code and redirects > 0
40
- redirected_url = resp.headers[:location]
41
- send_request(redirected_url, req, project_token, redirects - 1)
42
- else
43
- resp.return!(req, result, &block)
44
- end
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.3.1
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: 2015-12-28 00:00:00.000000000 Z
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