Skip to content

Commit

Permalink
style(message): Added a message on the changelog for referencing the …
Browse files Browse the repository at this point in the history
…github
  • Loading branch information
rafinskipg committed Oct 11, 2014
1 parent 95362e8 commit d20031a
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 21 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
# (2014-10-11)


## Breaking Changes
## Features

- **options:** Added ignore tags option
([95362e8b](https://github.com/rafinskipg/git-changelog/commits/95362e8b57a673e810ffe54ff3337de1ea5109a8))



---
<sub><sup>*Generated with [git-changelog](https://github.com/rafinskipg/git-changelog). If you have any problem or suggestion, create an issue.* :) **Thanks** </sub></sup>
19 changes: 7 additions & 12 deletions EXTENDEDCHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,14 @@
# (2014-10-11)


## Documentation

- Added docs
([e0ba50c0](https://github.com/rafinskipg/git-changelog/commits/e0ba50c0bb0b13e9b39a59b8f4dda96e86d55644))
- **readme:** Final readme Fixes #1 Closes #1
([e725d8f4](https://github.com/rafinskipg/git-changelog/commits/e725d8f4bf477b517ca6185a75fdfa0aa660b3be))


## Bug Fixes

- **git_changelog_generate:** pass tag if it exists to gitReadLog
([7c801927](https://github.com/rafinskipg/git-changelog/commits/7c801927672792fc9a818653b74c78d77c7bff9e),
[#5](https://github.com/rafinskipg/git-changelog/issues/5))
- **nested lists:** nested list fix. Closes #9
([22855518](https://github.com/rafinskipg/git-changelog/commits/2285551810919bd4d8a749ae3ddd88f9cedcdd0e))
([22855518](https://github.com/rafinskipg/git-changelog/commits/2285551810919bd4d8a749ae3ddd88f9cedcdd0e),
[#9](https://github.com/rafinskipg/git-changelog/issues/9))
- **package.json:** move q to dependancies since it is required to run
([257119cf](https://github.com/rafinskipg/git-changelog/commits/257119cf2bb6d8f341a5d65a2f47bcf803dff205))

Expand All @@ -32,6 +25,8 @@
([5afbb7a9](https://github.com/rafinskipg/git-changelog/commits/5afbb7a95c9f0e985f78666e7e231967524a8928))
- Now it is ready to be a grunt plugin
([6422e055](https://github.com/rafinskipg/git-changelog/commits/6422e0552b30f6e94d11b03310a23c1342aa5965))
- **options:** Added ignore tags option
([95362e8b](https://github.com/rafinskipg/git-changelog/commits/95362e8b57a673e810ffe54ff3337de1ea5109a8))


## Refactor
Expand All @@ -42,12 +37,12 @@
- Added docs


## Docs
## Documentation

- Added docs
- **readme:** Final readme Fixes #1 Closes #1


## Breaking Changes


---
<sub><sup>*Generated with [git-changelog](https://github.com/rafinskipg/git-changelog). If you have any problem or suggestion, create an issue.* :) **Thanks** </sub></sup>
21 changes: 14 additions & 7 deletions tasks/git_changelog_generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ var parseRawCommit = function(raw) {
var lines = raw.split('\n');
var msg = {}, match;

msg.hash = lines.shift();
msg.subject = lines.shift();

msg.closes = [];
msg.breaks = [];

Expand All @@ -70,6 +67,9 @@ var parseRawCommit = function(raw) {
if (match) { msg.closes.push(parseInt(match[1], 10)); }
});

msg.hash = lines.shift();
msg.subject = lines.shift();

match = raw.match(/BREAKING CHANGE:([\s\S]*)/);
if (match) {
msg.breaking = match[1];
Expand Down Expand Up @@ -142,6 +142,7 @@ var printSection = function(stream, title, section, printCommitLinks) {
section[name].forEach(function(commit) {
if (printCommitLinks) {
stream.write(util.format('%s %s\n (%s', prefix, commit.subject, linkToCommit(commit.hash)));

if (commit.closes.length) {
stream.write(',\n ' + commit.closes.map(linkToIssue).join(', '));
}
Expand All @@ -155,7 +156,10 @@ var printSection = function(stream, title, section, printCommitLinks) {
stream.write('\n');
};


var printSalute = function(stream){
stream.write('\n\n---\n');
stream.write('<sub><sup>*Generated with [git-changelog](https://github.com/rafinskipg/git-changelog). If you have any problem or suggestion, create an issue.* :) **Thanks** </sub></sup>');
}

var readGitLog = function( git_log_command, from) {
var deferred = q.defer();
Expand Down Expand Up @@ -198,15 +202,18 @@ var writeChangelog = function(stream, commits) {
organizeCommitsInSections(commits, sections)

stream.write(util.format(HEADER_TPL, OPTS.version, OPTS.appName, OPTS.version, currentDate()));
printSection(stream, 'Documentation', sections.docs);
printSection(stream, 'Bug Fixes', sections.fix);
printSection(stream, 'Features', sections.feat);
printSection(stream, 'Refactor', sections.refactor, false);
printSection(stream, 'Style', sections.style, false);
printSection(stream, 'Test', sections.test, false);
printSection(stream, 'Chore', sections.chore, false);
printSection(stream, 'Docs', sections.docs, false);
printSection(stream, 'Breaking Changes', sections.breaks, false);
printSection(stream, 'Documentation', sections.docs, false);
if(sections.breaks[EMPTY_COMPONENT].length > 0 ) {
printSection(stream, 'Breaking Changes', sections.breaks, false);
}

printSalute(stream);
};

var organizeCommitsInSections = function(commits, sections){
Expand Down
12 changes: 11 additions & 1 deletion test/changelog.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ describe('changelog.js', function() {
});


it('should parse closed issues in the body comment', function() {
var msg = ch.parseRawCommit(
'13f31602f396bc269076ab4d389cfd8ca94b20ba\n' +
'feat(ng-list): Allow custom separator and Closes #33\n');

expect(msg.closes[0]).to.equal(33);
});


it('should parse breaking changes', function() {
var msg = ch.parseRawCommit(
'13f31602f396bc269076ab4d389cfd8ca94b20ba\n' +
Expand All @@ -43,7 +52,8 @@ describe('changelog.js', function() {
'another line with more info\n');

expect(msg.breaking).to.equal(' first breaking change\nsomething else\nanother line with more info\n');
});
});


it('Should organize commits', function() {
var msg = ch.parseRawCommit(
Expand Down

0 comments on commit d20031a

Please sign in to comment.