coveralls 0.8.10 → 0.8.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/coveralls-ruby.gemspec +0 -1
- data/lib/coveralls/api.rb +61 -13
- data/lib/coveralls/version.rb +1 -1
- data/spec/coveralls/simplecov_spec.rb +2 -1
- metadata +3 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e61500aefc96d02600f5c1f9e46bafeaca0ab065
|
4
|
+
data.tar.gz: ade2d0bd97e80983b542d4d58f181f6095cbcb3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b376f04bbc679fdaf14a4a833eb318a9f8932635e5afc29e410df27ea3405490284ca3f051ffab45e083c62f7f417fab51d034e99d15dfd9b525261d2a63734b
|
7
|
+
data.tar.gz: 5a6edc4eae4b92be861c557c939eafc8f8705b3155772af764380629bc83f1689dfe9dd7d7d72c89a6825e5657ca29f32f2127a56fab57d95dc07db15fd8c0aa
|
data/Gemfile
CHANGED
data/coveralls-ruby.gemspec
CHANGED
@@ -20,7 +20,6 @@ Gem::Specification.new do |gem|
|
|
20
20
|
gem.required_ruby_version = '>= 1.8.7'
|
21
21
|
|
22
22
|
gem.add_dependency 'json', '~> 1.8'
|
23
|
-
gem.add_dependency 'rest-client', '>= 1.6.8', '< 2'
|
24
23
|
gem.add_dependency 'simplecov', '~> 0.11.0'
|
25
24
|
gem.add_dependency 'tins', '~> 1.6.0'
|
26
25
|
gem.add_dependency 'term-ansicolor', '~> 1.3'
|
data/lib/coveralls/api.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'json'
|
2
|
-
require '
|
2
|
+
require 'net/https'
|
3
3
|
|
4
4
|
module Coveralls
|
5
5
|
class API
|
@@ -16,20 +16,33 @@ module Coveralls
|
|
16
16
|
|
17
17
|
def self.post_json(endpoint, hash)
|
18
18
|
disable_net_blockers!
|
19
|
-
|
19
|
+
|
20
|
+
uri = endpoint_to_uri(endpoint)
|
21
|
+
|
20
22
|
Coveralls::Output.puts("#{ JSON.pretty_generate(hash) }", :color => "green") if ENV['COVERALLS_DEBUG']
|
21
|
-
hash = apified_hash hash
|
22
23
|
Coveralls::Output.puts("[Coveralls] Submitting to #{API_BASE}", :color => "cyan")
|
23
|
-
|
24
|
-
|
25
|
-
|
24
|
+
|
25
|
+
client = build_client(uri)
|
26
|
+
request = build_request(uri.path, hash)
|
27
|
+
|
28
|
+
response = client.request(request)
|
29
|
+
|
30
|
+
response_hash = JSON.load(response.body.to_str)
|
31
|
+
|
26
32
|
if response_hash['message']
|
33
|
+
Coveralls::Output.puts("[Coveralls] #{ response_hash['message'] }", :color => "cyan")
|
34
|
+
end
|
35
|
+
|
36
|
+
if response_hash['url']
|
27
37
|
Coveralls::Output.puts("[Coveralls] #{ Coveralls::Output.format(response_hash['url'], :color => "underline") }", :color => "cyan")
|
28
38
|
end
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
39
|
+
|
40
|
+
case response
|
41
|
+
when Net::HTTPServiceUnavailable
|
42
|
+
Coveralls::Output.puts("[Coveralls] API timeout occured, but data should still be processed", :color => "red")
|
43
|
+
when Net::HTTPInternalServerError
|
44
|
+
Coveralls::Output.puts("[Coveralls] API internal error occured, we're on it!", :color => "red")
|
45
|
+
end
|
33
46
|
end
|
34
47
|
|
35
48
|
private
|
@@ -47,8 +60,43 @@ module Coveralls
|
|
47
60
|
end
|
48
61
|
end
|
49
62
|
|
50
|
-
def self.
|
51
|
-
"#{API_BASE}/#{endpoint}"
|
63
|
+
def self.endpoint_to_uri(endpoint)
|
64
|
+
URI.parse("#{API_BASE}/#{endpoint}")
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.build_client(uri)
|
68
|
+
client = Net::HTTP.new(uri.host, uri.port)
|
69
|
+
client.use_ssl = true if uri.port == 443
|
70
|
+
client.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
71
|
+
|
72
|
+
unless client.respond_to?(:ssl_version=)
|
73
|
+
Net::HTTP.ssl_context_accessor("ssl_version")
|
74
|
+
end
|
75
|
+
|
76
|
+
client.ssl_version = 'TLSv1'
|
77
|
+
|
78
|
+
client
|
79
|
+
end
|
80
|
+
|
81
|
+
def self.build_request(path, hash)
|
82
|
+
request = Net::HTTP::Post.new(path)
|
83
|
+
boundary = rand(1_000_000).to_s
|
84
|
+
|
85
|
+
request.body = build_request_body(hash, boundary)
|
86
|
+
request.content_type = "multipart/form-data, boundary=#{boundary}"
|
87
|
+
|
88
|
+
request
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.build_request_body(hash, boundary)
|
92
|
+
hash = apified_hash(hash)
|
93
|
+
file = hash_to_file(hash)
|
94
|
+
|
95
|
+
"--#{boundary}\r\n" \
|
96
|
+
"Content-Disposition: form-data; name=\"json_file\"; filename=\"#{File.basename(file.path)}\"\r\n" \
|
97
|
+
"Content-Type: text/plain\r\n\r\n" +
|
98
|
+
File.read(file.path) +
|
99
|
+
"\r\n--#{boundary}--\r\n"
|
52
100
|
end
|
53
101
|
|
54
102
|
def self.hash_to_file(hash)
|
@@ -62,7 +110,7 @@ module Coveralls
|
|
62
110
|
|
63
111
|
def self.apified_hash hash
|
64
112
|
config = Coveralls::Configuration.configuration
|
65
|
-
if ENV['
|
113
|
+
if ENV['COVERALLS_DEBUG'] || Coveralls.testing
|
66
114
|
Coveralls::Output.puts "[Coveralls] Submitting with config:", :color => "yellow"
|
67
115
|
output = JSON.pretty_generate(config).gsub(/"repo_token": ?"(.*?)"/,'"repo_token": "[secure]"')
|
68
116
|
Coveralls::Output.puts output, :color => "yellow"
|
data/lib/coveralls/version.rb
CHANGED
@@ -62,7 +62,8 @@ describe Coveralls::SimpleCov::Formatter do
|
|
62
62
|
|
63
63
|
context "with api error" do
|
64
64
|
it "rescues" do
|
65
|
-
e =
|
65
|
+
e = SocketError.new
|
66
|
+
|
66
67
|
silence do
|
67
68
|
Coveralls::SimpleCov::Formatter.new.display_error(e).should be_falsy
|
68
69
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coveralls
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Merwin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-02-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
@@ -25,26 +25,6 @@ dependencies:
|
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '1.8'
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: rest-client
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: 1.6.8
|
35
|
-
- - "<"
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: '2'
|
38
|
-
type: :runtime
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
requirements:
|
42
|
-
- - ">="
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
version: 1.6.8
|
45
|
-
- - "<"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '2'
|
48
28
|
- !ruby/object:Gem::Dependency
|
49
29
|
name: simplecov
|
50
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -175,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
155
|
version: '0'
|
176
156
|
requirements: []
|
177
157
|
rubyforge_project:
|
178
|
-
rubygems_version: 2.
|
158
|
+
rubygems_version: 2.4.5
|
179
159
|
signing_key:
|
180
160
|
specification_version: 4
|
181
161
|
summary: A Ruby implementation of the Coveralls API.
|