coveralls 0.5.7 → 0.5.8

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.
@@ -56,7 +56,7 @@ module Coveralls
56
56
  return false
57
57
  end
58
58
 
59
- if ENV["COVERALLS_RUN_LOCALLY"] == "true"
59
+ if ENV["COVERALLS_RUN_LOCALLY"]
60
60
  puts "[Coveralls] Creating a new job on Coveralls from local coverage results.".cyan
61
61
  end
62
62
 
@@ -4,10 +4,13 @@ module Coveralls
4
4
  require 'json'
5
5
  require 'rest_client'
6
6
 
7
- # API_BASE = "http://coveralls.dev/api/v1"
8
- API_BASE = "https://coveralls.io/api/v1"
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
@@ -1,3 +1,3 @@
1
1
  module Coveralls
2
- VERSION = "0.5.7"
2
+ VERSION = "0.5.8"
3
3
  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.5.7
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-27 00:00:00.000000000 Z
13
+ date: 2013-02-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rest-client