Skip to content

Commit c1c7efb

Browse files
Merge pull request #803 from baileyn/licenses
Licenses
2 parents ccadd33 + 7cc9f11 commit c1c7efb

File tree

11 files changed

+28
-27
lines changed

11 files changed

+28
-27
lines changed

app/models/crate.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export default DS.Model.extend({
1515
issues: DS.attr('string'),
1616
documentation: DS.attr('string'),
1717
repository: DS.attr('string'),
18-
license: DS.attr('string'),
1918
exact_match: DS.attr('boolean'),
2019

2120
versions: DS.hasMany('versions', { async: true }),

app/models/version.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export default DS.Model.extend({
88
updated_at: DS.attr('date'),
99
downloads: DS.attr('number'),
1010
yanked: DS.attr('boolean'),
11+
license: DS.attr('string'),
1112

1213
crate: DS.belongsTo('crate', {
1314
async: false

app/templates/crate/version.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@
124124
</div>
125125

126126
<div class='bottom'>
127-
{{#if crate.license}}
127+
{{#if currentVersion.license}}
128128
<div>
129129
<h3>License</h3>
130-
<p>{{ crate.license }}</p>
130+
<p class="license">{{ currentVersion.license }}</p>
131131
</div>
132132
{{/if}}
133133

mirage/factories/crate.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export default Factory.extend({
1414
documentation: () => faker.internet.url(),
1515
homepage: () => faker.internet.url(),
1616
repository: () => faker.internet.url(),
17-
license: () => faker.hacker.abbreviation(),
1817
max_version: () => faker.system.semver(),
1918

2019
created_at: () => faker.date.past(),

mirage/factories/version.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export default Factory.extend({
1313
},
1414

1515
yanked: false,
16+
license: () => faker.hacker.abbreviation(),
1617

1718
dl_path() {
1819
return `/api/v1/crates/${this.crate}/${this.num}/download`;

mirage/fixtures/crates.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export default [{
1111
"keywords": [
1212
"network",
1313
],
14-
"license": "MIT",
1514
"max_version": "0.7.0-alpha",
1615
"name": "nanomsg",
1716
"repository": "https://github.com/thehydroimpulse/nanomsg.rs",
@@ -52,7 +51,6 @@ export default [{
5251
"homepage": "https://github.com/huonw/external_mixin",
5352
"id": "rust_mixin",
5453
"keywords": ["rust", "plugin", "code-generation"],
55-
"license": "MIT/Apache-2.0",
5654
"max_version": "0.0.1",
5755
"name": "rust_mixin",
5856
"repository": "https://github.com/huonw/external_mixin",
@@ -114,7 +112,6 @@ export default [{
114112
"homepage": "https://github.com/huonw/external_mixin",
115113
"id": "external_mixin",
116114
"keywords": ["python", "ruby", "shell", "plugin", "code-generation"],
117-
"license": "MIT/Apache-2.0",
118115
"max_version": "0.0.1",
119116
"name": "external_mixin",
120117
"repository": "https://github.com/huonw/external_mixin",
@@ -128,7 +125,6 @@ export default [{
128125
"homepage": "https://github.com/huonw/external_mixin",
129126
"id": "external_mixin_umbrella",
130127
"keywords": ["plugin", "code-generation"],
131-
"license": "MIT/Apache-2.0",
132128
"max_version": "0.0.2",
133129
"name": "external_mixin_umbrella",
134130
"repository": "https://github.com/huonw/external_mixin",
@@ -142,7 +138,6 @@ export default [{
142138
"homepage": "https://github.com/whatisinternet/inflector",
143139
"id": "Inflector",
144140
"keywords": ["string", "case", "camel", "snake", "inflection"],
145-
"license": "BSD-2-Clause",
146141
"max_version": "0.1.6",
147142
"name": "Inflector",
148143
"repository": "https://github.com/whatisinternet/inflector",
@@ -156,7 +151,6 @@ export default [{
156151
"homepage": null,
157152
"id": "rs-es",
158153
"keywords": ["elasticsearch", "elastic"],
159-
"license": "Apache-2.0",
160154
"max_version": "0.1.17",
161155
"name": "rs-es",
162156
"repository": "https://github.com/benashford/rs-es",
@@ -170,7 +164,6 @@ export default [{
170164
"homepage": "https://github.com/DaGenix/rust-crypto/",
171165
"id": "rust-crypto",
172166
"keywords": ["Crypto", "MD5", "Sha1", "Sha2", "AES"],
173-
"license": "MIT/Apache-2.0",
174167
"max_version": "0.2.34",
175168
"name": "rust-crypto",
176169
"repository": "https://github.com/DaGenix/rust-crypto/",
@@ -184,7 +177,6 @@ export default [{
184177
"homepage": null,
185178
"id": "rust-htslib",
186179
"keywords": ["htslib", "bam", "bioinformatics", "pileup", "sequencing"],
187-
"license": "MIT",
188180
"max_version": "0.5.2",
189181
"name": "rust-htslib",
190182
"repository": "https://github.com/rust-bio/rust-htslib.git",
@@ -198,7 +190,6 @@ export default [{
198190
"homepage": "https://icorderi.github.io/icorderi/kinetic-rust",
199191
"id": "kinetic-rust",
200192
"keywords": ["Protocol", "Kinetic", "Storage"],
201-
"license": "MIT",
202193
"max_version": "0.0.16",
203194
"name": "kinetic-rust",
204195
"repository": "https://github.com/icorderi/kinetic-rust/",
@@ -212,7 +203,6 @@ export default [{
212203
"homepage": "https://github.com/rustless/rustless",
213204
"id": "rustless",
214205
"keywords": ["api", "web", "hyper", "iron", "rest"],
215-
"license": "MIT",
216206
"max_version": "0.8.0",
217207
"name": "rustless",
218208
"repository": "https://crates.io/crates/rustless",
@@ -226,7 +216,6 @@ export default [{
226216
"homepage": null,
227217
"id": "serde",
228218
"keywords": ["serde", "serialization"],
229-
"license": "MIT/Apache-2.0",
230219
"max_version": "0.6.1",
231220
"name": "serde",
232221
"repository": "https://github.com/serde-rs/serde",
@@ -240,7 +229,6 @@ export default [{
240229
"homepage": "https://github.com/livioribeiro/rusted-cypher",
241230
"id": "rusted_cypher",
242231
"keywords": ["neo4j", "database", "query", "cypher", "graph"],
243-
"license": "MIT",
244232
"max_version": "0.7.1",
245233
"name": "rusted_cypher",
246234
"repository": "https://github.com/livioribeiro/rusted-cypher",
@@ -254,7 +242,6 @@ export default [{
254242
"homepage": null,
255243
"id": "zlib",
256244
"keywords": [],
257-
"license": "MIT",
258245
"max_version": "0.0.1",
259246
"name": "zlib",
260247
"repository": null,
@@ -268,7 +255,6 @@ export default [{
268255
"homepage": null,
269256
"id": "rustful",
270257
"keywords": ["web", "rest", "framework", "http", "routing"],
271-
"license": "MIT",
272258
"max_version": "0.5.0",
273259
"name": "rustful",
274260
"repository": "https://github.com/Ogeon/rustful",
@@ -282,7 +268,6 @@ export default [{
282268
"homepage": null,
283269
"id": "postgres",
284270
"keywords": ["database", "sql"],
285-
"license": "MIT",
286271
"max_version": "0.10.1",
287272
"name": "postgres",
288273
"repository": "https://github.com/sfackler/rust-postgres",
@@ -296,7 +281,6 @@ export default [{
296281
"homepage": "https://github.com/BurntSushi/quickcheck",
297282
"id": "quickcheck",
298283
"keywords": ["testing", "quickcheck", "property", "shrinking", "fuzz"],
299-
"license": "Unlicense/MIT",
300284
"max_version": "0.2.24",
301285
"name": "quickcheck",
302286
"repository": "https://github.com/BurntSushi/quickcheck",
@@ -310,7 +294,6 @@ export default [{
310294
"homepage": "https://github.com/BurntSushi/quickcheck",
311295
"id": "quickcheck_macros",
312296
"keywords": ["testing", "quickcheck", "property", "shrinking", "fuzz"],
313-
"license": "Unlicense/MIT",
314297
"max_version": "0.2.24",
315298
"name": "quickcheck_macros",
316299
"repository": "https://github.com/BurntSushi/quickcheck",
@@ -324,7 +307,6 @@ export default [{
324307
"homepage": "https://github.com/nicolas-cherel/rustlex",
325308
"id": "nc_rustlex",
326309
"keywords": ["lexer", "lexical", "analyser", "generator"],
327-
"license": "MIT",
328310
"max_version": "0.3.1",
329311
"name": "nc_rustlex",
330312
"repository": "https://github.com/nicolas-cherel/rustlex",
@@ -338,7 +320,6 @@ export default [{
338320
"homepage": null,
339321
"id": "nom",
340322
"keywords": ["parser", "parser-combinators", "parsing", "streaming", "bit"],
341-
"license": "MIT",
342323
"max_version": "1.0.1",
343324
"name": "nom",
344325
"repository": "https://github.com/Geal/nom",

mirage/fixtures/versions.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export default [{
1313
"num": "0.7.0-alpha.1",
1414
"updated_at": "2016-12-27T08:40:00Z",
1515
"yanked": false,
16+
"license": "MIT",
1617
"_authors": [
1718
"Daniel Fagnan <[email protected]>",
1819
"Jason E. Aten",
@@ -37,6 +38,7 @@ export default [{
3738
"num": "0.6.1",
3839
"updated_at": "2016-12-27T08:40:00Z",
3940
"yanked": false,
41+
"license": "Apache-2.0",
4042
"_authors": [
4143
"Daniel Fagnan <[email protected]>",
4244
"Jason E. Aten",
@@ -58,6 +60,7 @@ export default [{
5860
"num": "0.6.0",
5961
"updated_at": "2016-06-10T20:03:55Z",
6062
"yanked": false,
63+
"license": "Apache-2.0",
6164
"_authors": [
6265
"Daniel Fagnan <[email protected]>",
6366
"Jason E. Aten",
@@ -79,6 +82,7 @@ export default [{
7982
"num": "0.5.0",
8083
"updated_at": "2016-01-24T22:07:58Z",
8184
"yanked": false,
85+
"license": "MIT/Apache-2.0",
8286
"_authors": [
8387
"Daniel Fagnan <[email protected]>",
8488
"Jason E. Aten",
@@ -100,6 +104,7 @@ export default [{
100104
"num": "0.4.2",
101105
"updated_at": "2015-12-16T00:01:56Z",
102106
"yanked": false,
107+
"license": "MIT",
103108
"_authors": [
104109
"Daniel Fagnan <[email protected]>",
105110
"Jason E. Aten",
@@ -121,6 +126,7 @@ export default [{
121126
"num": "0.4.1",
122127
"updated_at": "2015-12-11T23:54:29Z",
123128
"yanked": false,
129+
"license": "MIT",
124130
"_authors": [
125131
"Daniel Fagnan <[email protected]>",
126132
"Jason E. Aten",
@@ -142,6 +148,7 @@ export default [{
142148
"num": "0.4.0",
143149
"updated_at": "2015-12-11T23:54:29Z",
144150
"yanked": false,
151+
"license": "MIT",
145152
"_authors": [
146153
"Daniel Fagnan <[email protected]>",
147154
"Jason E. Aten",
@@ -163,6 +170,7 @@ export default [{
163170
"num": "0.3.4",
164171
"updated_at": "2015-12-15T00:03:39Z",
165172
"yanked": false,
173+
"license": "MIT",
166174
"_authors": [
167175
"Daniel Fagnan <[email protected]>",
168176
"Jason E. Aten",
@@ -184,6 +192,7 @@ export default [{
184192
"num": "0.3.3",
185193
"updated_at": "2015-12-11T23:54:29Z",
186194
"yanked": false,
195+
"license": "MIT",
187196
"_authors": [
188197
"Daniel Fagnan <[email protected]>",
189198
"Jason E. Aten",
@@ -205,6 +214,7 @@ export default [{
205214
"num": "0.3.2",
206215
"updated_at": "2015-12-11T23:54:29Z",
207216
"yanked": false,
217+
"license": "Apache-2.0",
208218
"_authors": [
209219
"Daniel Fagnan <[email protected]>",
210220
"Jason E. Aten",
@@ -226,6 +236,7 @@ export default [{
226236
"num": "0.3.1",
227237
"updated_at": "2015-12-11T23:54:29Z",
228238
"yanked": false,
239+
"license": "MIT/Apache-2.0",
229240
"_authors": [
230241
"Daniel Fagnan <[email protected]>",
231242
"Jason E. Aten",
@@ -247,6 +258,7 @@ export default [{
247258
"num": "0.3.0",
248259
"updated_at": "2015-12-11T23:54:29Z",
249260
"yanked": false,
261+
"license": "MIT",
250262
"_authors": [
251263
"Daniel Fagnan <[email protected]>",
252264
"Jason E. Aten",
@@ -268,6 +280,7 @@ export default [{
268280
"num": "0.2.0",
269281
"updated_at": "2015-12-11T23:54:29Z",
270282
"yanked": false,
283+
"license": "MIT",
271284
"_authors": [
272285
"Daniel Fagnan <[email protected]>",
273286
"Jason E. Aten",
@@ -289,6 +302,7 @@ export default [{
289302
"num": "0.2.0",
290303
"updated_at": "2015-12-11T23:54:29Z",
291304
"yanked": false,
305+
"license": "MIT",
292306
"_authors": [
293307
"David C. Bishop",
294308
]

mirage/serializers/crate.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export default BaseSerializer.extend({
1111
'homepage',
1212
'id',
1313
'keywords',
14-
'license',
1514
'links',
1615
'max_version',
1716
'name',

mirage/serializers/version.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export default BaseSerializer.extend({
1212
'num',
1313
'updated_at',
1414
'yanked',
15+
'license',
1516
],
1617

1718
links(version) {

src/krate.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ pub struct EncodableCrate {
104104
pub description: Option<String>,
105105
pub homepage: Option<String>,
106106
pub documentation: Option<String>,
107-
pub license: Option<String>,
108107
pub repository: Option<String>,
109108
pub links: CrateLinks,
110109
pub exact_match: bool,
@@ -507,7 +506,6 @@ impl Crate {
507506
homepage,
508507
documentation,
509508
repository,
510-
license,
511509
..
512510
} = self;
513511
let versions_link = match versions {
@@ -533,7 +531,6 @@ impl Crate {
533531
exact_match: exact_match,
534532
description: description,
535533
repository: repository,
536-
license: license,
537534
links: CrateLinks {
538535
version_downloads: format!("/api/v1/crates/{}/downloads", name),
539536
versions: versions_link,

tests/acceptance/crate-test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,12 @@ test('crates having team-owners', async function(assert) {
119119
findWithAssert('ul.owners li:first a[href="/teams/github:org:thehydroimpulse"]');
120120
assert.equal(find('ul.owners li').length, 4);
121121
});
122+
123+
test('crates license is supplied by version', async function(assert) {
124+
server.loadFixtures();
125+
126+
await visit('/crates/nanomsg');
127+
hasText(assert, '.license', 'Apache-2.0');
128+
await click('#crate-versions a:contains("0.5.0")');
129+
hasText(assert, '.license', 'MIT/Apache-2.0');
130+
});

0 commit comments

Comments
 (0)