WIP: Code Climate UI integration.

This commit is contained in:
Mathias Meyer 2013-09-03 14:26:02 +02:00
parent da7cb6f4b0
commit f4acc21d06
5 changed files with 66 additions and 0 deletions

View File

@ -44,6 +44,16 @@
<a class="download-log" {{bindAttr href="view.plainTextLogUrl"}}>Download log</a>
</li>
{{/if}}
{{#if view.displayCodeClimate}}
<li>
<a href="#" name="code-climate"
{{action "codeClimatePopup" target="view"}}
{{bindAttr class=":open-popup"}}>
Code Climate
</a>
</li>
{{/if}}
</ul>
</div>
@ -74,3 +84,36 @@
You can read more about encryption keys <a href="http://about.travis-ci.org/docs/user/encryption-keys/">in Travis documentation</a>
</p>
</div>
<div id="code-climate" class="popup">
<p>
Integrating <a href="https://codeclimate.com">Code Climate</a>'s code coverage reporting with your test
suite on Travis CI allows to track changes in coverage over time. It only takes a few steps, once you've set up your project:
</p>
<ol>
<li>
Add the `code-climate-reporter` gem to your Gemfile:<br/>
<pre>
gem "codeclimate-test-reporter", group: :test, require: nil
</pre>
</li>
<li>
Load the reporter in your `test_helper` or `spec_helper`, putting it at the very top:
<pre>
require "codeclimate-test-reporter"
CodeClimate::TestReporter.start
</pre>
</li>
<li>
Add the Code Climate token to your .travis.yml:
<pre>
env:
global:
- CODECLIMATE_REPO_TOKEN=adf08323...
</pre>
</li>
</div>

View File

@ -135,6 +135,12 @@ Travis.reopen
@popup(event)
event.stopPropagation()
codeClimatePopup: ->
@set('active', true)
@closeMenu()
@popup(event)
event.stopPropagation()
requeueBuild: ->
if @get('canRequeueBuild')
@closeMenu()
@ -219,3 +225,7 @@ Travis.reopen
if permissions = @get('currentUser.permissions')
permissions.contains parseInt(@get('repo.id'))
).property('currentUser.permissions.length', 'repo.id')
displayCodeClimate: (->
Travis.config.code_climate == "true" and @get('repo.githubLanguage') == 'Ruby'
).property('repo.githubLanguage')

View File

@ -72,6 +72,7 @@ $.extend Travis,
api_endpoint: $('meta[rel="travis.api_endpoint"]').attr('href')
pusher_key: $('meta[name="travis.pusher_key"]').attr('value')
ga_code: $('meta[name="travis.ga_code"]').attr('value')
code_climate: $('meta[name="travis.code_climate"]').attr('value')
CONFIG_KEYS: ['go', 'rvm', 'gemfile', 'env', 'jdk', 'otp_release', 'php', 'node_js', 'perl', 'python', 'scala', 'compiler']

View File

@ -82,3 +82,14 @@
display: none
width: 400px
margin: -95px 0 0 -300px
#code-climate
margin: -150px 0 0 -200px
width: 500px
padding: 5px 20px
pre
padding: 5px 10px
ol
padding-left: 15px

View File

@ -5,6 +5,7 @@
<meta rel="travis.api_endpoint" href="https://api.travis-ci.org">
<meta name="travis.pusher_key" value="5df8ac576dcccf4fd076">
<meta name="travis.ga_code" value="UA-24868285-1">
<meta name="travis.code_climate" value="true">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Travis CI - Free Hosted Continuous Integration Platform for the Open Source Community</title>
<link rel="dns-prefetch" href="//api.travis-ci.org">