Skip to content

Commit

Permalink
add the print-commit helper
Browse files Browse the repository at this point in the history
  • Loading branch information
rafinskipg committed Dec 22, 2016
1 parent 88e426a commit 40089c8
Show file tree
Hide file tree
Showing 12 changed files with 578 additions and 399 deletions.
15 changes: 11 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
# my name
<img width="300px" src="https://github.com/rafinskipg/git-changelog/raw/master/images/git-changelog-logo.png" />

# Git changelog

_Git changelog is a utility tool for generating changelogs. It is free and opensource. :)_

## ( )


## Bug Fixes
- fix error messages (ee5068bffdbb9c0e45c8ce9ce0c2f790440f19e3
- fix error messages
([ee5068bf](https://github.com/rafinskipg/git-changelog/commit/ee5068bffdbb9c0e45c8ce9ce0c2f790440f19e3))

- **git tag**
- get latest tag, regardless of branch for workflows that rely on git-flow releases (48800306fa5ac19b7e9a4c6d7f2f432ee8ae4d84)
- get latest tag, regardless of branch for workflows that rely on git-flow releases
([48800306](https://github.com/rafinskipg/git-changelog/commit/48800306fa5ac19b7e9a4c6d7f2f432ee8ae4d84))




Expand Down
422 changes: 306 additions & 116 deletions EXTENDEDCHANGELOG.md

Large diffs are not rendered by default.

362 changes: 127 additions & 235 deletions output/customTemplate.md

Large diffs are not rendered by default.

116 changes: 83 additions & 33 deletions output/tag1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,106 @@

_This changelog is from the previous tag_

## v0.0.1 ( )
## v0.0.1


## Bug Fixes
- Fix generation of logs (cddb2408fa3017be704acac51dabbba9f477a547
- correctly get branch name from the command line (4baa075bd93f878ee708817f911fe89c102dec02
- correctly detect when running under grunt on Windows (4205ea49a893e4d1807a39268739c13754d40cf2
- fixed tests (2e60172a4666c70d27e66d15dad297b89fff9583
- Stream didn't close properly (99f228cfa5cb26c46ef9e3b00171a5e3d38fd844
- Github commit url (c186f2d877e7907305953610bcaaef331406178a
- fix error messages
([ee5068bf](https://github.com/rafinskipg/git-changelog/commit/ee5068bffdbb9c0e45c8ce9ce0c2f790440f19e3))
- Fix generation of logs
([cddb2408](https://github.com/rafinskipg/git-changelog/commit/cddb2408fa3017be704acac51dabbba9f477a547))
- correctly get branch name from the command line
([4baa075b](https://github.com/rafinskipg/git-changelog/commit/4baa075bd93f878ee708817f911fe89c102dec02))
- correctly detect when running under grunt on Windows
([4205ea49](https://github.com/rafinskipg/git-changelog/commit/4205ea49a893e4d1807a39268739c13754d40cf2))
- fixed tests
([2e60172a](https://github.com/rafinskipg/git-changelog/commit/2e60172a4666c70d27e66d15dad297b89fff9583))
- Stream didn't close properly
([99f228cf](https://github.com/rafinskipg/git-changelog/commit/99f228cfa5cb26c46ef9e3b00171a5e3d38fd844))
- Github commit url
([c186f2d8](https://github.com/rafinskipg/git-changelog/commit/c186f2d877e7907305953610bcaaef331406178a))

- **checkpath**
- add missing require('path') (e5dab826062bd22dd37c8c3d3c24a4d9b4701f6d)
- add missing require('path')
([e5dab826](https://github.com/rafinskipg/git-changelog/commit/e5dab826062bd22dd37c8c3d3c24a4d9b4701f6d))

- **generate**
- create path to file if it does not already exist (62f6210f6895bcf5f9984b26948178b1a93cbc9e)
- create path to file if it does not already exist
([62f6210f](https://github.com/rafinskipg/git-changelog/commit/62f6210f6895bcf5f9984b26948178b1a93cbc9e))

- **git log**
- Ignores letter case (d4cff0a86c5ce46405f3c0dd03f9c49a7d620792, Closes: [#54](https://github.com/rafinskipg/git-changelog/issues/54))
- Ignores letter case
([d4cff0a8](https://github.com/rafinskipg/git-changelog/commit/d4cff0a86c5ce46405f3c0dd03f9c49a7d620792),
[#54](https://github.com/rafinskipg/git-changelog/issues/54))

- **git tag**
- get latest tag, regardless of branch for workflows that rely on git-flow releases (48800306fa5ac19b7e9a4c6d7f2f432ee8ae4d84)
- get latest tag, regardless of branch for workflows that rely on git-flow releases
([48800306](https://github.com/rafinskipg/git-changelog/commit/48800306fa5ac19b7e9a4c6d7f2f432ee8ae4d84))

- **git_changelog_generate**
- pass tag if it exists to gitReadLog (7c801927672792fc9a818653b74c78d77c7bff9e, Closes: [#5](https://github.com/rafinskipg/git-changelog/issues/5))
- pass tag if it exists to gitReadLog
([7c801927](https://github.com/rafinskipg/git-changelog/commit/7c801927672792fc9a818653b74c78d77c7bff9e),
[#5](https://github.com/rafinskipg/git-changelog/issues/5))

- **nested lists**
- nested list fix. Closes #9 (2285551810919bd4d8a749ae3ddd88f9cedcdd0e, Closes: [#9](https://github.com/rafinskipg/git-changelog/issues/9))
- nested list fix. Closes #9
([22855518](https://github.com/rafinskipg/git-changelog/commit/2285551810919bd4d8a749ae3ddd88f9cedcdd0e),
[#9](https://github.com/rafinskipg/git-changelog/issues/9))

- **options**
- use repo_url instead of url (346b39491923a49a3421f174a566b204d5fc7db9)
- use repo_url instead of url
([346b3949](https://github.com/rafinskipg/git-changelog/commit/346b39491923a49a3421f174a566b204d5fc7db9))

- **package.json**
- move q to dependancies since it is required to run (257119cf2bb6d8f341a5d65a2f47bcf803dff205)
- move q to dependancies since it is required to run
([257119cf](https://github.com/rafinskipg/git-changelog/commit/257119cf2bb6d8f341a5d65a2f47bcf803dff205))

- **params**
- Restores versionName in CLI (1d97f952bd5d37f67c1febdf161f4ce9b310eebf)
- Restores versionName in CLI
([1d97f952](https://github.com/rafinskipg/git-changelog/commit/1d97f952bd5d37f67c1febdf161f4ce9b310eebf))




## Pull requests merged
- Merge pull request #60 from seivan/feature/latest_tag_regardless_of_branch (1ff50d0dc03f8c0db9961c034945c3ef8f4268f7
- Merge pull request #58 from olamothe/master (3fed727077168815f24aad7bbf5768913e3843ab
- Merge pull request #55 from kerimdzhanov/patch-1 (31d1389637b59ac3a6c68c3f8fca99045675c36c
- Merge pull request #50 from rafinskipg/changelogrc (fd07a4bf039c7c8ddbb496c644dfd5fcc1627904
- Merge pull request #41 from pmiossec/fix_branch_option (6247118a573259cbe71c6fdd28cb53dcb7f1b855
- Merge pull request #45 from xcambar/versionName (2e50373a6f42e53598612f0e474c008624d6e80c
- Merge pull request #47 from Sjors/patch-1 (d786fd084d7c1c250c866bec3c5d0c73b9abe271
- Merge pull request #46 from zoner14/master (0485a1fd4bf01662f50b93098c6b535eb7c527eb
- Merge pull request #37 from richardthombs/fix-grunt-on-windows (5f02433963b5b603c5763bd5c1a37cf8ca9e3598
- Merge pull request #33 from richardthombs/fix-typos (2656d150eb95c6ad9326e4265ba64edf8e49a11c
- Merge pull request #30 from JohnnyEstilles/refactor/get-stream (a52b1169a2510d83d6d4fd5113ce157f30c4d4d0
- Merge pull request #25 from JohnnyEstilles/code-climate (28053b9292d3d61fb33a004f6088c244e653b76b
- Merge pull request #23 from JohnnyEstilles/docs/readme-updates (3079151a8d5f90d0830aab4437a65dff4d837b2a
- Merge pull request #20 from JohnnyEstilles/feature/code-refactoring (be209f04c22f1ce2cb82e6412c4ddf117897a9e7
- Merge pull request #12 from jodybrewster/master (219ea8091ac81a55b0210c9a7fd41a7f0ee5660f
- Merge pull request #7 from colegleason/fix-tags (1d4f604363094d4eee3b4d7b1ca01133edaad344
- Merge pull request #6 from colegleason/add-q (2a712b9cfd912f36b6f7f70d16b336575881881a
- Merge pull request #60 from seivan/feature/latest_tag_regardless_of_branch
([1ff50d0d](https://github.com/rafinskipg/git-changelog/commit/1ff50d0dc03f8c0db9961c034945c3ef8f4268f7))
- Merge pull request #58 from olamothe/master
([3fed7270](https://github.com/rafinskipg/git-changelog/commit/3fed727077168815f24aad7bbf5768913e3843ab))
- Merge pull request #55 from kerimdzhanov/patch-1
([31d13896](https://github.com/rafinskipg/git-changelog/commit/31d1389637b59ac3a6c68c3f8fca99045675c36c))
- Merge pull request #50 from rafinskipg/changelogrc
([fd07a4bf](https://github.com/rafinskipg/git-changelog/commit/fd07a4bf039c7c8ddbb496c644dfd5fcc1627904))
- Merge pull request #41 from pmiossec/fix_branch_option
([6247118a](https://github.com/rafinskipg/git-changelog/commit/6247118a573259cbe71c6fdd28cb53dcb7f1b855))
- Merge pull request #45 from xcambar/versionName
([2e50373a](https://github.com/rafinskipg/git-changelog/commit/2e50373a6f42e53598612f0e474c008624d6e80c))
- Merge pull request #47 from Sjors/patch-1
([d786fd08](https://github.com/rafinskipg/git-changelog/commit/d786fd084d7c1c250c866bec3c5d0c73b9abe271))
- Merge pull request #46 from zoner14/master
([0485a1fd](https://github.com/rafinskipg/git-changelog/commit/0485a1fd4bf01662f50b93098c6b535eb7c527eb))
- Merge pull request #37 from richardthombs/fix-grunt-on-windows
([5f024339](https://github.com/rafinskipg/git-changelog/commit/5f02433963b5b603c5763bd5c1a37cf8ca9e3598))
- Merge pull request #33 from richardthombs/fix-typos
([2656d150](https://github.com/rafinskipg/git-changelog/commit/2656d150eb95c6ad9326e4265ba64edf8e49a11c))
- Merge pull request #30 from JohnnyEstilles/refactor/get-stream
([a52b1169](https://github.com/rafinskipg/git-changelog/commit/a52b1169a2510d83d6d4fd5113ce157f30c4d4d0))
- Merge pull request #25 from JohnnyEstilles/code-climate
([28053b92](https://github.com/rafinskipg/git-changelog/commit/28053b9292d3d61fb33a004f6088c244e653b76b))
- Merge pull request #23 from JohnnyEstilles/docs/readme-updates
([3079151a](https://github.com/rafinskipg/git-changelog/commit/3079151a8d5f90d0830aab4437a65dff4d837b2a))
- Merge pull request #20 from JohnnyEstilles/feature/code-refactoring
([be209f04](https://github.com/rafinskipg/git-changelog/commit/be209f04c22f1ce2cb82e6412c4ddf117897a9e7))
- Merge pull request #12 from jodybrewster/master
([219ea809](https://github.com/rafinskipg/git-changelog/commit/219ea8091ac81a55b0210c9a7fd41a7f0ee5660f))
- Merge pull request #7 from colegleason/fix-tags
([1d4f6043](https://github.com/rafinskipg/git-changelog/commit/1d4f604363094d4eee3b4d7b1ca01133edaad344))
- Merge pull request #6 from colegleason/add-q
([2a712b9c](https://github.com/rafinskipg/git-changelog/commit/2a712b9cfd912f36b6f7f70d16b336575881881a))





---
<sub><sup>*Generated with [git-changelog](https://github.com/rafinskipg/git-changelog). If you have any problems or suggestions, create an issue.* :) **Thanks** </sub></sup>
1 change: 1 addition & 0 deletions tasks/git_changelog_generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Changelog.prototype.linkToCommit = require('./lib/link-to-commit');
Changelog.prototype.currentDate = require('./lib/current-date');
Changelog.prototype.printHeader = require('./lib/print-header');
Changelog.prototype.printSection = require('./lib/print-section');
Changelog.prototype.printCommit = require('./lib/print-commit');
Changelog.prototype.printSalute = require('./lib/print-salute');
Changelog.prototype.readGitLog = require('./lib/read-gitlog');
Changelog.prototype.writeChangelog = require('./lib/write-change-log');
Expand Down
2 changes: 1 addition & 1 deletion tasks/lib/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function init(params, loadRC) {

module.log('debug', 'Grep commits: ', module.options.grep_commits);

return module.getRepoUrl()
return module.getRepoUrl();
})
.then(getRepoSuccess.bind(this, deferred))
.catch(getRepoFailure.bind(this, deferred));
Expand Down
3 changes: 2 additions & 1 deletion tasks/lib/load-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ function loadTemplateFile(data) {
},
getCommitCloses: function(commit){
return commit.closes.map(module.linkToIssue, module);
}
},
printCommit: this.printCommit.bind(this)
};

_.extend(data, viewHelpers);
Expand Down
23 changes: 23 additions & 0 deletions tasks/lib/print-commit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

var debug = require('debug')('changelog:printSection');
var format = require('util').format;

function printCommit(commit, printCommitLinks) {
var prefix = '';
var result = '';

if (printCommitLinks) {
result += format('%s\n (%s', commit.subject, this.linkToCommit(commit.hash));

if (commit.closes.length) {
result += ',\n ' + commit.closes.map(this.linkToIssue, this).join(', ');
}
result += ')\n';
} else {
result += format('%s\n', commit.subject);
}

return result;
}

module.exports = printCommit;
6 changes: 3 additions & 3 deletions tasks/lib/print-section.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var debug = require('debug')('changelog:printSection');
var format = require('util').format;

function printCommit(stream, printCommitLinks, prefix, commit) {
function printCommitStream(stream, printCommitLinks, prefix, commit) {
if (printCommitLinks) {
stream.write(format('%s %s\n (%s', prefix, commit.subject, this.linkToCommit(commit.hash)));

Expand All @@ -27,7 +27,7 @@ function printComponent(stream, printCommitLinks, component) {
prefix = format('- **%s:**', component.name);
}

component.commits.forEach(printCommit.bind(this, stream, printCommitLinks, prefix), this);
component.commits.forEach(printCommitStream.bind(this, stream, printCommitLinks, prefix), this);
}

function printSection(stream, section) {
Expand All @@ -42,7 +42,7 @@ function printSection(stream, section) {

stream.write(format('\n## %s\n\n', section.title));

section.commits.forEach(printCommit.bind(this, stream, section.printCommitLinks, '-'), this);
section.commits.forEach(printCommitStream.bind(this, stream, section.printCommitLinks, '-'), this);

section.components.forEach(printComponent.bind(this, stream, section.printCommitLinks), this);

Expand Down
8 changes: 4 additions & 4 deletions templates/template.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<% if(logo) { %><img width="300px" src="<%= logo %>" /><%= '\n\n' %><% } %># <%= title %>
<% if(intro) { %><%= '\n' %>_<%= intro %>_<%= '\n' %><% } %>
<% if(version) { %>## <%= version.name %> <%= version.number %> ( <%= version.date %> )<%= '\n' %><% } %>
<% if(version && (version.name || version.number)) { %>##<% if(version.name){%><%= version.name %><% } %> <%= version.number %> <% if(version.date){ %>( <%= version.date %> )<% } %><%= '\n' %><% } %>
<% _.forEach(sections, function(section){
if(section.commitsCount > 0) { %>
## <%= section.title %>
<% _.forEach(section.commits, function(commit){ %> - <%= commit.subject %> (<%= commit.hash %><% if(commit.closes.length){ %>, Closes: <%= getCommitCloses(commit).join(',') %><% } %>
<% }) %><% _.forEach(section.components, function(component){ %> - **<%= component.name %>**
<% _.forEach(component.commits, function(commit){ %> - <%= commit.subject %> (<%= commit.hash %><% if(commit.closes.length){ %>, Closes: <%= getCommitCloses(commit).join(',') %><% } %>)<% }) %>
<% _.forEach(section.commits, function(commit){ %> - <%= printCommit(commit, true) %><% }) %>
<% _.forEach(section.components, function(component){ %> - **<%= component.name %>**
<% _.forEach(component.commits, function(commit){ %> - <%= printCommit(commit, true) %><% }) %>
<% }) %>
<% } %>
<% }) %>
Expand Down
15 changes: 15 additions & 0 deletions templates/template_two.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<% if(logo) { %><img width="300px" src="<%= logo %>" /><%= '\n\n' %><% } %># <%= title %>
<% if(intro) { %><%= '\n' %>_<%= intro %>_<%= '\n' %><% } %>
<% if(version) { %>## <%= version.name %> <%= version.number %> ( <%= version.date %> )<%= '\n' %><% } %>
<% _.forEach(sections, function(section){
if(section.commitsCount > 0) { %>
## <%= section.title %>
<% _.forEach(section.commits, function(commit){ %> - <%= commit.subject %> (<%= commit.hash %><% if(commit.closes.length){ %>, Closes: <%= getCommitCloses(commit).join(',') %><% } %>
<% }) %><% _.forEach(section.components, function(component){ %> - **<%= component.name %>**
<% _.forEach(component.commits, function(commit){ %> - <%= commit.subject %> (<%= commit.hash %><% if(commit.closes.length){ %>, Closes: <%= getCommitCloses(commit).join(',') %><% } %>)<% }) %>
<% }) %>
<% } %>
<% }) %>

---
<sub><sup>*Generated with [git-changelog](https://github.com/rafinskipg/git-changelog). If you have any problems or suggestions, create an issue.* :) **Thanks** </sub></sup>
4 changes: 2 additions & 2 deletions test/git_changelog_generate.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ describe('git_changelog_generate.js', function() {
'some note here\n' +
'reg(ad): need a walk through\n');

expect(msg.body).to.equals('some note here\nreg(ad): need a walk through\n')
})
expect(msg.body).to.equals('some note here\nreg(ad): need a walk through\n');
});

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

0 comments on commit 40089c8

Please sign in to comment.