Skip to content
This repository has been archived by the owner on Nov 21, 2017. It is now read-only.

Commit

Permalink
Reference: if prefixed with # use old bug tracker
Browse files Browse the repository at this point in the history
Also Fix minor spacing problem.

Fixes gh-2
  • Loading branch information
stevemao committed Apr 17, 2016
1 parent d298135 commit 7c79d7c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 21 deletions.
6 changes: 6 additions & 0 deletions index.js
Expand Up @@ -21,6 +21,12 @@ var writerOpts = {
commit.hash = commit.hash.substring(0, 7);
}

commit.references.forEach(function(reference) {
if (reference.prefix === '#') {
reference.originalIssueTracker = 'https://bugs.jquery.com/ticket/';
}
});

return commit;
},
groupBy: 'component',
Expand Down
34 changes: 18 additions & 16 deletions templates/commit.hbs
Expand Up @@ -13,20 +13,22 @@
{{~#if @root.owner}}
{{~@root.owner}}/
{{~/if}}
{{~@root.repository}}/{{@root.commit}}/{{hash}}))
{{~@root.repository}}/{{@root.commit}}/{{hash}}))
{{~else}}
{{~hash}}
{{~/if}}

{{~!-- commit references --}}
{{~#if references~}}
, closes
{{~#each references}}
{{~#if @root.linkReferences}}[
{{~#if this.owner}}
{{~this.owner}}/
{{~/if}}
{{~this.repository}}#{{this.issue}}](
{{~#each references}} {{#if @root.linkReferences}}[
{{~#if this.owner}}
{{~this.owner}}/
{{~/if}}
{{~this.repository}}{{this.prefix}}{{this.issue}}](
{{~#if this.originalIssueTracker}}
{{~this.originalIssueTracker}}
{{~else}}
{{~#if @root.host}}
{{~@root.host}}/
{{~/if}}
Expand All @@ -41,13 +43,13 @@
{{~/if}}
{{~@root.repository}}
{{~/if~}}
/{{@root.issue}}/{{this.issue}})
{{~else}}
{{~#if this.owner}}
{{~this.owner}}/
{{~/if}}
{{~this.repository}}#{{this.issue}}
{{/if}}
{{/each}}
/{{@root.issue}}/
{{~/if}}
{{~this.issue}})
{{~else}}
{{~#if this.owner}}
{{~this.owner}}/
{{~/if}}
{{~this.repository}}{{this.prefix}}{{this.issue}}
{{/if}}{{/each}}
{{/if}}

12 changes: 7 additions & 5 deletions test.js
Expand Up @@ -20,16 +20,16 @@ describe('jquery preset', function() {
writeFileSync('test2', '');
shell.exec('git add --all && git commit -m"CSS: Don\'t name the anonymous swap function"');
writeFileSync('test3', '');
shell.exec('git add --all && git commit -m"Event: Remove an internal argument to the on method"');
shell.exec('git add --all && git commit -m"Event: Remove an internal argument to the on method" -m"Fixes #2, #4, gh-200"');
writeFileSync('test4', '');
shell.exec('git add --all && git commit -m"Manipulation: Remove an internal argument to the remove method"');
shell.exec('git add --all && git commit -m"Manipulation: Remove an internal argument to the remove method" -m"Closes #22"');
writeFileSync('test5', '');
shell.exec('git add --all && git commit -m"Bad commit"');
writeFileSync('test6', '');
shell.exec('git add --all && git commit -m"Core: Create jQuery.ajax"');
shell.exec('git add --all && git commit -m"Core: Create jQuery.ajax" -m"Closes gh-100"');
});

it('should work if there is no semver tag', function(done) {
it('should generate a changelog', function(done) {
conventionalChangelogCore({
config: config
})
Expand All @@ -40,9 +40,11 @@ describe('jquery preset', function() {
chunk = chunk.toString();

expect(chunk).to.include('Create jQuery.ajax');
expect(chunk).to.include('))\n* Make jQuery objects iterable');
expect(chunk).to.include(', closes [gh-100](https://github.com/conventional-changelog/conventional-changelog-jquery/issues/100)');
expect(chunk).to.include(')\n* Make jQuery objects iterable');
expect(chunk).to.include('### CSS');
expect(chunk).to.include('Remove an internal argument to the on method');
expect(chunk).to.include(', closes [#2](https://bugs.jquery.com/ticket/2) [#4](https://bugs.jquery.com/ticket/4) [gh-200](https://github.com/conventional-changelog/conventional-changelog-jquery/issues/200)');
expect(chunk).to.include('### Manipulation');

expect(chunk).to.not.include('Bad');
Expand Down

0 comments on commit 7c79d7c

Please sign in to comment.