coveralls 0.5.7 → 0.5.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/coveralls.rb +1 -1
- data/lib/coveralls/api.rb +21 -2
- data/lib/coveralls/version.rb +1 -1
- metadata +2 -2
data/lib/coveralls.rb
CHANGED
data/lib/coveralls/api.rb
CHANGED
@@ -4,10 +4,13 @@ module Coveralls
|
|
4
4
|
require 'json'
|
5
5
|
require 'rest_client'
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
API_HOST = ENV['COVERALLS_DEVELOPMENT'] ? "localhost:3000" : "coveralls.io"
|
8
|
+
API_PROTOCOL = ENV['COVERALLS_DEVELOPMENT'] ? "http" : "https"
|
9
|
+
API_DOMAIN = "#{API_PROTOCOL}://#{API_HOST}"
|
10
|
+
API_BASE = "#{API_DOMAIN}/api/v1"
|
9
11
|
|
10
12
|
def self.post_json(endpoint, hash)
|
13
|
+
disable_net_blockers!
|
11
14
|
url = endpoint_to_url(endpoint)
|
12
15
|
puts JSON.pretty_generate(hash).green if ENV['COVERALLS_DEBUG']
|
13
16
|
hash = apified_hash hash
|
@@ -20,10 +23,26 @@ module Coveralls
|
|
20
23
|
end
|
21
24
|
rescue RestClient::ServiceUnavailable
|
22
25
|
puts ("[Coveralls] API timeout occured, but data should still be processed").red
|
26
|
+
rescue RestClient::InternalServerError
|
27
|
+
puts ("[Coveralls] API internal error occured, we're on it!").red
|
23
28
|
end
|
24
29
|
|
25
30
|
private
|
26
31
|
|
32
|
+
def self.disable_net_blockers!
|
33
|
+
if defined?(WebMock)
|
34
|
+
(WebMock::Config.instance.allow ||= []).push API_HOST
|
35
|
+
end
|
36
|
+
|
37
|
+
if defined?(VCR)
|
38
|
+
VCR.configure do |c|
|
39
|
+
c.ignore_request do |request|
|
40
|
+
URI(request.uri).host == API_HOST
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
27
46
|
def self.endpoint_to_url(endpoint)
|
28
47
|
"#{API_BASE}/#{endpoint}"
|
29
48
|
end
|
data/lib/coveralls/version.rb
CHANGED
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.5.
|
4
|
+
version: 0.5.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-02-
|
13
|
+
date: 2013-02-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rest-client
|