diff --git a/assets/scripts/app/templates/repos/show/tools.hbs b/assets/scripts/app/templates/repos/show/tools.hbs index a394597d..87f1ed60 100644 --- a/assets/scripts/app/templates/repos/show/tools.hbs +++ b/assets/scripts/app/templates/repos/show/tools.hbs @@ -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> diff --git a/assets/scripts/app/views/repo/show.coffee b/assets/scripts/app/views/repo/show.coffee index d49b9330..7c744347 100644 --- a/assets/scripts/app/views/repo/show.coffee +++ b/assets/scripts/app/views/repo/show.coffee @@ -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') diff --git a/assets/scripts/travis.coffee b/assets/scripts/travis.coffee index 5db8ece5..24eb109c 100644 --- a/assets/scripts/travis.coffee +++ b/assets/scripts/travis.coffee @@ -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'] diff --git a/assets/styles/app/popup.sass b/assets/styles/app/popup.sass index 119c63c2..08d13cba 100644 --- a/assets/styles/app/popup.sass +++ b/assets/styles/app/popup.sass @@ -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 diff --git a/public/index.html b/public/index.html index fb4970ef..5949c82f 100644 --- a/public/index.html +++ b/public/index.html @@ -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">