Skip to content

Commit

Permalink
Merge pull request #803 from baileyn/licenses
Browse files Browse the repository at this point in the history
Licenses
  • Loading branch information
carols10cents authored Jul 22, 2017
2 parents ccadd33 + 7cc9f11 commit c1c7efb
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 27 deletions.
1 change: 0 additions & 1 deletion app/models/crate.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export default DS.Model.extend({
issues: DS.attr('string'),
documentation: DS.attr('string'),
repository: DS.attr('string'),
license: DS.attr('string'),
exact_match: DS.attr('boolean'),

versions: DS.hasMany('versions', { async: true }),
Expand Down
1 change: 1 addition & 0 deletions app/models/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default DS.Model.extend({
updated_at: DS.attr('date'),
downloads: DS.attr('number'),
yanked: DS.attr('boolean'),
license: DS.attr('string'),

crate: DS.belongsTo('crate', {
async: false
Expand Down
4 changes: 2 additions & 2 deletions app/templates/crate/version.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@
</div>

<div class='bottom'>
{{#if crate.license}}
{{#if currentVersion.license}}
<div>
<h3>License</h3>
<p>{{ crate.license }}</p>
<p class="license">{{ currentVersion.license }}</p>
</div>
{{/if}}

Expand Down
1 change: 0 additions & 1 deletion mirage/factories/crate.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export default Factory.extend({
documentation: () => faker.internet.url(),
homepage: () => faker.internet.url(),
repository: () => faker.internet.url(),
license: () => faker.hacker.abbreviation(),
max_version: () => faker.system.semver(),

created_at: () => faker.date.past(),
Expand Down
1 change: 1 addition & 0 deletions mirage/factories/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default Factory.extend({
},

yanked: false,
license: () => faker.hacker.abbreviation(),

dl_path() {
return `/api/v1/crates/${this.crate}/${this.num}/download`;
Expand Down
19 changes: 0 additions & 19 deletions mirage/fixtures/crates.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export default [{
"keywords": [
"network",
],
"license": "MIT",
"max_version": "0.7.0-alpha",
"name": "nanomsg",
"repository": "https://github.com/thehydroimpulse/nanomsg.rs",
Expand Down Expand Up @@ -52,7 +51,6 @@ export default [{
"homepage": "https://github.com/huonw/external_mixin",
"id": "rust_mixin",
"keywords": ["rust", "plugin", "code-generation"],
"license": "MIT/Apache-2.0",
"max_version": "0.0.1",
"name": "rust_mixin",
"repository": "https://github.com/huonw/external_mixin",
Expand Down Expand Up @@ -114,7 +112,6 @@ export default [{
"homepage": "https://github.com/huonw/external_mixin",
"id": "external_mixin",
"keywords": ["python", "ruby", "shell", "plugin", "code-generation"],
"license": "MIT/Apache-2.0",
"max_version": "0.0.1",
"name": "external_mixin",
"repository": "https://github.com/huonw/external_mixin",
Expand All @@ -128,7 +125,6 @@ export default [{
"homepage": "https://github.com/huonw/external_mixin",
"id": "external_mixin_umbrella",
"keywords": ["plugin", "code-generation"],
"license": "MIT/Apache-2.0",
"max_version": "0.0.2",
"name": "external_mixin_umbrella",
"repository": "https://github.com/huonw/external_mixin",
Expand All @@ -142,7 +138,6 @@ export default [{
"homepage": "https://github.com/whatisinternet/inflector",
"id": "Inflector",
"keywords": ["string", "case", "camel", "snake", "inflection"],
"license": "BSD-2-Clause",
"max_version": "0.1.6",
"name": "Inflector",
"repository": "https://github.com/whatisinternet/inflector",
Expand All @@ -156,7 +151,6 @@ export default [{
"homepage": null,
"id": "rs-es",
"keywords": ["elasticsearch", "elastic"],
"license": "Apache-2.0",
"max_version": "0.1.17",
"name": "rs-es",
"repository": "https://github.com/benashford/rs-es",
Expand All @@ -170,7 +164,6 @@ export default [{
"homepage": "https://github.com/DaGenix/rust-crypto/",
"id": "rust-crypto",
"keywords": ["Crypto", "MD5", "Sha1", "Sha2", "AES"],
"license": "MIT/Apache-2.0",
"max_version": "0.2.34",
"name": "rust-crypto",
"repository": "https://github.com/DaGenix/rust-crypto/",
Expand All @@ -184,7 +177,6 @@ export default [{
"homepage": null,
"id": "rust-htslib",
"keywords": ["htslib", "bam", "bioinformatics", "pileup", "sequencing"],
"license": "MIT",
"max_version": "0.5.2",
"name": "rust-htslib",
"repository": "https://github.com/rust-bio/rust-htslib.git",
Expand All @@ -198,7 +190,6 @@ export default [{
"homepage": "https://icorderi.github.io/icorderi/kinetic-rust",
"id": "kinetic-rust",
"keywords": ["Protocol", "Kinetic", "Storage"],
"license": "MIT",
"max_version": "0.0.16",
"name": "kinetic-rust",
"repository": "https://github.com/icorderi/kinetic-rust/",
Expand All @@ -212,7 +203,6 @@ export default [{
"homepage": "https://github.com/rustless/rustless",
"id": "rustless",
"keywords": ["api", "web", "hyper", "iron", "rest"],
"license": "MIT",
"max_version": "0.8.0",
"name": "rustless",
"repository": "https://crates.io/crates/rustless",
Expand All @@ -226,7 +216,6 @@ export default [{
"homepage": null,
"id": "serde",
"keywords": ["serde", "serialization"],
"license": "MIT/Apache-2.0",
"max_version": "0.6.1",
"name": "serde",
"repository": "https://github.com/serde-rs/serde",
Expand All @@ -240,7 +229,6 @@ export default [{
"homepage": "https://github.com/livioribeiro/rusted-cypher",
"id": "rusted_cypher",
"keywords": ["neo4j", "database", "query", "cypher", "graph"],
"license": "MIT",
"max_version": "0.7.1",
"name": "rusted_cypher",
"repository": "https://github.com/livioribeiro/rusted-cypher",
Expand All @@ -254,7 +242,6 @@ export default [{
"homepage": null,
"id": "zlib",
"keywords": [],
"license": "MIT",
"max_version": "0.0.1",
"name": "zlib",
"repository": null,
Expand All @@ -268,7 +255,6 @@ export default [{
"homepage": null,
"id": "rustful",
"keywords": ["web", "rest", "framework", "http", "routing"],
"license": "MIT",
"max_version": "0.5.0",
"name": "rustful",
"repository": "https://github.com/Ogeon/rustful",
Expand All @@ -282,7 +268,6 @@ export default [{
"homepage": null,
"id": "postgres",
"keywords": ["database", "sql"],
"license": "MIT",
"max_version": "0.10.1",
"name": "postgres",
"repository": "https://github.com/sfackler/rust-postgres",
Expand All @@ -296,7 +281,6 @@ export default [{
"homepage": "https://github.com/BurntSushi/quickcheck",
"id": "quickcheck",
"keywords": ["testing", "quickcheck", "property", "shrinking", "fuzz"],
"license": "Unlicense/MIT",
"max_version": "0.2.24",
"name": "quickcheck",
"repository": "https://github.com/BurntSushi/quickcheck",
Expand All @@ -310,7 +294,6 @@ export default [{
"homepage": "https://github.com/BurntSushi/quickcheck",
"id": "quickcheck_macros",
"keywords": ["testing", "quickcheck", "property", "shrinking", "fuzz"],
"license": "Unlicense/MIT",
"max_version": "0.2.24",
"name": "quickcheck_macros",
"repository": "https://github.com/BurntSushi/quickcheck",
Expand All @@ -324,7 +307,6 @@ export default [{
"homepage": "https://github.com/nicolas-cherel/rustlex",
"id": "nc_rustlex",
"keywords": ["lexer", "lexical", "analyser", "generator"],
"license": "MIT",
"max_version": "0.3.1",
"name": "nc_rustlex",
"repository": "https://github.com/nicolas-cherel/rustlex",
Expand All @@ -338,7 +320,6 @@ export default [{
"homepage": null,
"id": "nom",
"keywords": ["parser", "parser-combinators", "parsing", "streaming", "bit"],
"license": "MIT",
"max_version": "1.0.1",
"name": "nom",
"repository": "https://github.com/Geal/nom",
Expand Down
14 changes: 14 additions & 0 deletions mirage/fixtures/versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default [{
"num": "0.7.0-alpha.1",
"updated_at": "2016-12-27T08:40:00Z",
"yanked": false,
"license": "MIT",
"_authors": [
"Daniel Fagnan <[email protected]>",
"Jason E. Aten",
Expand All @@ -37,6 +38,7 @@ export default [{
"num": "0.6.1",
"updated_at": "2016-12-27T08:40:00Z",
"yanked": false,
"license": "Apache-2.0",
"_authors": [
"Daniel Fagnan <[email protected]>",
"Jason E. Aten",
Expand All @@ -58,6 +60,7 @@ export default [{
"num": "0.6.0",
"updated_at": "2016-06-10T20:03:55Z",
"yanked": false,
"license": "Apache-2.0",
"_authors": [
"Daniel Fagnan <[email protected]>",
"Jason E. Aten",
Expand All @@ -79,6 +82,7 @@ export default [{
"num": "0.5.0",
"updated_at": "2016-01-24T22:07:58Z",
"yanked": false,
"license": "MIT/Apache-2.0",
"_authors": [
"Daniel Fagnan <[email protected]>",
"Jason E. Aten",
Expand All @@ -100,6 +104,7 @@ export default [{
"num": "0.4.2",
"updated_at": "2015-12-16T00:01:56Z",
"yanked": false,
"license": "MIT",
"_authors": [
"Daniel Fagnan <[email protected]>",
"Jason E. Aten",
Expand All @@ -121,6 +126,7 @@ export default [{
"num": "0.4.1",
"updated_at": "2015-12-11T23:54:29Z",
"yanked": false,
"license": "MIT",
"_authors": [
"Daniel Fagnan <[email protected]>",
"Jason E. Aten",
Expand All @@ -142,6 +148,7 @@ export default [{
"num": "0.4.0",
"updated_at": "2015-12-11T23:54:29Z",
"yanked": false,
"license": "MIT",
"_authors": [
"Daniel Fagnan <[email protected]>",
"Jason E. Aten",
Expand All @@ -163,6 +170,7 @@ export default [{
"num": "0.3.4",
"updated_at": "2015-12-15T00:03:39Z",
"yanked": false,
"license": "MIT",
"_authors": [
"Daniel Fagnan <[email protected]>",
"Jason E. Aten",
Expand All @@ -184,6 +192,7 @@ export default [{
"num": "0.3.3",
"updated_at": "2015-12-11T23:54:29Z",
"yanked": false,
"license": "MIT",
"_authors": [
"Daniel Fagnan <[email protected]>",
"Jason E. Aten",
Expand All @@ -205,6 +214,7 @@ export default [{
"num": "0.3.2",
"updated_at": "2015-12-11T23:54:29Z",
"yanked": false,
"license": "Apache-2.0",
"_authors": [
"Daniel Fagnan <[email protected]>",
"Jason E. Aten",
Expand All @@ -226,6 +236,7 @@ export default [{
"num": "0.3.1",
"updated_at": "2015-12-11T23:54:29Z",
"yanked": false,
"license": "MIT/Apache-2.0",
"_authors": [
"Daniel Fagnan <[email protected]>",
"Jason E. Aten",
Expand All @@ -247,6 +258,7 @@ export default [{
"num": "0.3.0",
"updated_at": "2015-12-11T23:54:29Z",
"yanked": false,
"license": "MIT",
"_authors": [
"Daniel Fagnan <[email protected]>",
"Jason E. Aten",
Expand All @@ -268,6 +280,7 @@ export default [{
"num": "0.2.0",
"updated_at": "2015-12-11T23:54:29Z",
"yanked": false,
"license": "MIT",
"_authors": [
"Daniel Fagnan <[email protected]>",
"Jason E. Aten",
Expand All @@ -289,6 +302,7 @@ export default [{
"num": "0.2.0",
"updated_at": "2015-12-11T23:54:29Z",
"yanked": false,
"license": "MIT",
"_authors": [
"David C. Bishop",
]
Expand Down
1 change: 0 additions & 1 deletion mirage/serializers/crate.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export default BaseSerializer.extend({
'homepage',
'id',
'keywords',
'license',
'links',
'max_version',
'name',
Expand Down
1 change: 1 addition & 0 deletions mirage/serializers/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default BaseSerializer.extend({
'num',
'updated_at',
'yanked',
'license',
],

links(version) {
Expand Down
3 changes: 0 additions & 3 deletions src/krate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ pub struct EncodableCrate {
pub description: Option<String>,
pub homepage: Option<String>,
pub documentation: Option<String>,
pub license: Option<String>,
pub repository: Option<String>,
pub links: CrateLinks,
pub exact_match: bool,
Expand Down Expand Up @@ -507,7 +506,6 @@ impl Crate {
homepage,
documentation,
repository,
license,
..
} = self;
let versions_link = match versions {
Expand All @@ -533,7 +531,6 @@ impl Crate {
exact_match: exact_match,
description: description,
repository: repository,
license: license,
links: CrateLinks {
version_downloads: format!("/api/v1/crates/{}/downloads", name),
versions: versions_link,
Expand Down
9 changes: 9 additions & 0 deletions tests/acceptance/crate-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,12 @@ test('crates having team-owners', async function(assert) {
findWithAssert('ul.owners li:first a[href="/teams/github:org:thehydroimpulse"]');
assert.equal(find('ul.owners li').length, 4);
});

test('crates license is supplied by version', async function(assert) {
server.loadFixtures();

await visit('/crates/nanomsg');
hasText(assert, '.license', 'Apache-2.0');
await click('#crate-versions a:contains("0.5.0")');
hasText(assert, '.license', 'MIT/Apache-2.0');
});

0 comments on commit c1c7efb

Please sign in to comment.