Skip to content

Commit 0288ef9

Browse files
authored
Merge pull request #504 from integer32llc/ci-badge
Add support for showing Travis and Appveyor current build status badges
2 parents 6df510b + 9e297fb commit 0288ef9

File tree

24 files changed

+646
-20
lines changed

24 files changed

+646
-20
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ git2 = "0.6"
2424
flate2 = "0.2"
2525
semver = "0.5"
2626
url = "1.2.1"
27-
postgres = { version = "0.13", features = ["with-time", "with-openssl"] }
27+
postgres = { version = "0.13", features = ["with-time", "with-openssl", "with-rustc-serialize"] }
2828
r2d2 = "0.7.0"
2929
r2d2_postgres = "0.11"
3030
openssl = "0.9"

app/components/badge-appveyor.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
service: Ember.computed('badge.attributes.service', function() {
11+
return this.get('badge.attributes.service') || 'github';
12+
}),
13+
text: Ember.computed('badge', function() {
14+
return `Appveyor build status for the ${ this.get('branch') } branch`;
15+
})
16+
});

app/components/badge-travis-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 `Travis CI build status for the ${ this.get('branch') } branch`;
12+
})
13+
});

app/controllers/crate/version.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export default Ember.Controller.extend({
2020
requestedVersion: null,
2121
keywords: computed.alias('crate.keywords'),
2222
categories: computed.alias('crate.categories'),
23+
badges: computed.alias('crate.badges'),
2324

2425
sortedVersions: computed.readOnly('crate.versions'),
2526

app/mirage/fixtures/search.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,21 @@ export default {
1919
"name": "rust_mixin",
2020
"repository": "https://github.com/huonw/external_mixin",
2121
"updated_at": "2015-02-27T11:52:13Z",
22+
"badges": [
23+
{
24+
"attributes": {
25+
"repository": "huonw/external_mixin"
26+
},
27+
"badge_type": "appveyor"
28+
},
29+
{
30+
"attributes": {
31+
"branch": "master",
32+
"repository": "huonw/external_mixin"
33+
},
34+
"badge_type": "travis-ci"
35+
}
36+
],
2237
"versions": null
2338
}, {
2439
"created_at": "2015-02-27T11:51:58Z",

app/models/crate.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import DS from 'ember-data';
2+
import Ember from 'ember';
23

34
export default DS.Model.extend({
45
name: DS.attr('string'),
@@ -17,6 +18,16 @@ export default DS.Model.extend({
1718
license: DS.attr('string'),
1819

1920
versions: DS.hasMany('versions', { async: true }),
21+
badges: DS.attr(),
22+
enhanced_badges: Ember.computed.map('badges', badge => ({
23+
// jshint ignore:start
24+
// needed until https://github.com/jshint/jshint/issues/2991 is fixed
25+
...badge,
26+
// jshint ignore:end
27+
component_name: `badge-${badge.badge_type}`
28+
})),
29+
badge_sort: ['badge_type'],
30+
annotated_badges: Ember.computed.sort('enhanced_badges', 'badge_sort'),
2031
owners: DS.hasMany('users', { async: true }),
2132
version_downloads: DS.hasMany('version-download', { async: true }),
2233
keywords: DS.hasMany('keywords', { async: true }),

app/styles/crate.scss

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,6 @@
119119
}
120120
.vers {
121121
margin-left: 10px;
122-
img {
123-
margin-bottom: -4px;
124-
}
125122
}
126123

127124
.stats {
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<a href="https://ci.appveyor.com/project/{{ repository }}">
2+
<img
3+
src="https://ci.appveyor.com/api/projects/status/{{ service }}/{{ repository }}?svg=true&branch={{ branch }}"
4+
alt="{{ text }}"
5+
title="{{ text }}" />
6+
</a>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<a href="https://travis-ci.org/{{ repository }}">
2+
<img
3+
src="https://travis-ci.org/{{ repository }}.svg?branch={{ branch }}"
4+
alt="{{ text }}"
5+
title="{{ text }}" />
6+
</a>

0 commit comments

Comments
 (0)