Skip to content

Commit 46bb0d0

Browse files
committed
Support CircleCI badges
Closes rust-lang#800
1 parent ddcb396 commit 46bb0d0

File tree

5 files changed

+34
-0
lines changed

5 files changed

+34
-0
lines changed

app/components/badge-circle-ci.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import Ember from 'ember';
2+
3+
export default Ember.Component.extend({
4+
tagName: 'span',
5+
classNames: ['badge'],
6+
repository: Ember.computed.alias('badge.attributes.repository'),
7+
branch: Ember.computed('badge.attributes.branch', function() {
8+
return this.get('badge.attributes.branch') || 'master';
9+
}),
10+
text: Ember.computed('branch', function() {
11+
return `Circle CI build status for the ${ this.get('branch') } branch`;
12+
})
13+
});
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<a href="https://circleci.com/gh/{{ repository }}">
2+
<img
3+
src="https://circleci.com/gh/{{ repository }}/tree/{{ branch }}.svg?style=shield"
4+
alt="{{ text }}"
5+
title="{{ text }}" />
6+
</a>

mirage/fixtures/search.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ export default {
6666
"repository": "huonw/external_mixin"
6767
},
6868
"badge_type": "coveralls"
69+
},
70+
{
71+
"attributes": {
72+
"branch": "master",
73+
"repository": "huonw/external_mixin"
74+
},
75+
"badge_type": "circle-ci"
6976
}
7077
],
7178
"versions": null

src/badge.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ pub enum Badge {
2626
repository: String,
2727
branch: Option<String>,
2828
},
29+
#[serde(rename = "circle-ci")]
30+
CircleCi {
31+
repository: String,
32+
branch: Option<String>,
33+
},
2934
#[serde(rename = "is-it-maintained-issue-resolution")]
3035
IsItMaintainedIssueResolution { repository: String },
3136
#[serde(rename = "is-it-maintained-open-issues")]
@@ -69,6 +74,7 @@ impl Badge {
6974
Badge::TravisCi { .. } => "travis-ci",
7075
Badge::Appveyor { .. } => "appveyor",
7176
Badge::GitLab { .. } => "gitlab",
77+
Badge::CircleCi { .. } => "circle-ci",
7278
Badge::IsItMaintainedIssueResolution { .. } => "is-it-maintained-issue-resolution",
7379
Badge::IsItMaintainedOpenIssues { .. } => "is-it-maintained-open-issues",
7480
Badge::Codecov { .. } => "codecov",

tests/acceptance/search-test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ test('searching for "rust"', async function(assert) {
3838
findWithAssert('#crates .row:first .desc .info .badge:eq(5) a img[src="https://isitmaintained.com/badge/open/huonw/external_mixin.svg"]');
3939
findWithAssert('#crates .row:first .desc .info .badge:eq(6) a[href="https://travis-ci.org/huonw/external_mixin"]');
4040
findWithAssert('#crates .row:first .desc .info .badge:eq(6) a img[src="https://travis-ci.org/huonw/external_mixin.svg?branch=master"]');
41+
findWithAssert('#crates .row:first .desc .info .badge:eq(7) a[href="https://circleci.com/gh/huonw/external_mixin"]');
42+
findWithAssert('#crates .row:first .desc .info .badge:eq(7) a img[src="https://circleci.com/gh/huonw/external_mixin/tree/master.svg?style=shield"]');
4143

4244
hasText(assert, '#crates .row:first .desc .summary', 'Yo dawg, use Rust to generate Rust, right in your Rust. (See `external_mixin` to use scripting languages.)');
4345
hasText(assert, '#crates .row:first .downloads', '477');

0 commit comments

Comments
 (0)