codeclimate-test-reporter 0.0.8 → 0.0.9

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.
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # codeclimate-test-reporter
2
2
 
3
+ [![Code Climate](https://codeclimate.com/github/codeclimate/ruby-test-reporter.png)](https://codeclimate.com/github/codeclimate/ruby-test-reporter)
4
+
3
5
  Collects test coverage data from your Ruby test suite and sends it to Code
4
6
  Climate's hosted, automated code review service. Based on SimpleCov.
5
7
 
@@ -11,6 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.description = %q{Collects test coverage data from your Ruby test suite and sends it to Code Climate's hosted, automated code review service. Based on SimpleCov.}
12
12
  spec.summary = %q{Uploads Ruby test coverage data to Code Climate.}
13
13
  spec.homepage = ""
14
+ spec.license = "MIT"
14
15
 
15
16
  spec.files = `git ls-files`.split($/)
16
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
@@ -1,6 +1,6 @@
1
1
  module CodeClimate
2
2
  module TestReporter
3
- VERSION = "0.0.8"
3
+ VERSION = "0.0.9"
4
4
 
5
5
  def self.start
6
6
  if run?
@@ -49,6 +49,8 @@ STR
49
49
  Add the following to your spec or test helper to ensure codeclimate-test-reporter can post coverage results:"
50
50
  parts << "\n" + message.instructions + "\n"
51
51
  parts << "======"
52
+ parts << "If this doesn't work, please consult https://codeclimate.com/docs#test-coverage-troubleshooting"
53
+ parts << "======"
52
54
  else
53
55
  parts << @exception.message
54
56
  @exception.backtrace.each do |line|
@@ -18,7 +18,8 @@ module CodeClimate
18
18
  File.open(file_path, "w") { |file| file.write(payload.to_json) }
19
19
  else
20
20
  client = Client.new
21
- print "Sending report to #{client.host}... "
21
+ computed_branch = compute_branch(payload)
22
+ print "Sending report to #{client.host} for branch #{computed_branch}... "
22
23
  client.post_results(payload)
23
24
  end
24
25
 
@@ -144,6 +145,19 @@ module CodeClimate
144
145
  def tddium?
145
146
  ci_service_data && ci_service_data[:name] == "tddium"
146
147
  end
148
+
149
+ def compute_branch(payload)
150
+ git_branch = payload[:git][:branch]
151
+ ci_branch = payload[:ci_service][:branch]
152
+
153
+ if ci_branch.to_s.strip.size > 0
154
+ ci_branch.sub(/^origin\//, "")
155
+ elsif git_branch.to_s.strip.size > 0 && !git_branch.to_s.strip.start_with?("(")
156
+ git_branch.sub(/^origin\//, "")
157
+ else
158
+ "master"
159
+ end
160
+ end
147
161
  end
148
162
  end
149
163
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codeclimate-test-reporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-15 00:00:00.000000000 Z
12
+ date: 2013-09-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: simplecov
@@ -89,7 +89,8 @@ files:
89
89
  - lib/codeclimate-test-reporter.rb
90
90
  - spec/spec_helper.rb
91
91
  homepage: ''
92
- licenses: []
92
+ licenses:
93
+ - MIT
93
94
  post_install_message:
94
95
  rdoc_options: []
95
96
  require_paths:
@@ -100,18 +101,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
100
101
  - - ! '>='
101
102
  - !ruby/object:Gem::Version
102
103
  version: '0'
103
- segments:
104
- - 0
105
- hash: -1626756073592550820
106
104
  required_rubygems_version: !ruby/object:Gem::Requirement
107
105
  none: false
108
106
  requirements:
109
107
  - - ! '>='
110
108
  - !ruby/object:Gem::Version
111
109
  version: '0'
112
- segments:
113
- - 0
114
- hash: -1626756073592550820
115
110
  requirements: []
116
111
  rubyforge_project:
117
112
  rubygems_version: 1.8.23