Skip to content

Commit

Permalink
fix(options): Use version_name instead of version
Browse files Browse the repository at this point in the history
  • Loading branch information
rafinskipg committed Dec 25, 2016
1 parent 70fb977 commit 43fdac8
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 33 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ _Git changelog is a utility tool for generating changelogs. It is free and opens



## Documentation
- updating documentation with template info
([70fb9774](https:/rafinskipg/git-changelog/commit/70fb97742ea2182a9d25ca92d6eeab081b44cc63))





---
<sub><sup>*Generated with [git-changelog](https:/rafinskipg/git-changelog). If you have any problems or suggestions, create an issue.* :) **Thanks** </sub></sup>
2 changes: 2 additions & 0 deletions EXTENDEDCHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ _Git changelog is a utility tool for generating changelogs. It is free and opens


## Documentation
- updating documentation with template info
([70fb9774](https:/rafinskipg/git-changelog/commit/70fb97742ea2182a9d25ca92d6eeab081b44cc63))
- Updated readme with the correct specification
([ec2de4bf](https:/rafinskipg/git-changelog/commit/ec2de4bf599dfc77c24c9b86ee9c0d86fe37e5b8))
- Updated options and tagging info
Expand Down
39 changes: 20 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@

Since version `1.0.0` git-changelog has included the [`.changelogrc` specification](#changelogrc-specification) and has discontinued the next options:
- `grep_commits` option has been removed in favour of the `.changelogrc` options
- `tag = false`, in addition to pick logs from the begining of the project, now groups the commits by tag [see example]. **TODO**
- `tag = false` && `group=false` will log from the begining of the project, without grouping by tag **TODO**
- `repo_url` fixed as parameter
- `branch_name` changed to `branch`
- `version_name` instead of `version`

## `.changelogrc` specification

Expand All @@ -61,7 +60,7 @@ This specification is used to grep the commits on your log, it contains a valid
"intro": "Git changelog is a utility tool for generating changelogs. It is free and opensource. :)",
"branch" : "",
"repo_url": "",
"version" : "v1.0.0",
"version_name" : "v1.0.0",
"file": "CHANGELOG.md",
"template": "myCustomTemplate.md",
"sections": [
Expand Down Expand Up @@ -113,7 +112,7 @@ This specification is used to grep the commits on your log, it contains a valid

* **branch** : The name of the branch. Defaults to ` `
* **repo_url** : The url of the project. For issues and commits links. Defaults to `git config --get remote.origin.url`
* **version**: The version of the project. Defaults to ` `, *DEPRECATED* will default to the tag name
* **version_name**: The version name of the project.
* **file**: The name of the file that will be generated. Defaults to `CHANGELOG.md`,
* **template**: The template for generating the changelog. It defaults to the one inside this project (/templates/template.md)
* **app_name** : The name of the project. Defaults to `My App - Changelog`
Expand Down Expand Up @@ -163,7 +162,7 @@ grunt.initConfig({
options: {
app_name : 'Git changelog extended',
file : 'EXTENDEDCHANGELOG.md',
version : 'squeezy potatoe',
version_name : 'squeezy potatoe',
sections : [
{
"title": "Test commits",
Expand Down Expand Up @@ -193,7 +192,7 @@ grunt.initConfig({
file: 'output/customTemplate.md',
template: 'templates/template_two.md',
logo : 'https:/rafinskipg/git-changelog/raw/master/images/git-changelog-logo.png',
version : 'squeezy potatoe',
version_name : 'squeezy potatoe',
tag: 'v0.0.1',
debug: true
}
Expand All @@ -220,19 +219,21 @@ Use it directly with the common options
Options:
-h, --help output usage information
-V, --version output the version number
-e, --extended Extended log
-a, --app_name [app_name] Name [app_name]
-b, --branch [branch] Branch name [branch]
-f, --file [file] File [file]
-r, --repo_url [url] Repo url [url]
-l, --logo [logo] Logo path [logo]
-i, --intro [intro] intro text [intro]
-t, --tag [tag] Since tag [tag]
-rc, --changelogrc [changelogrc] .changelogrc relative path [changelogrc]
-g, --grep [grep] Grep commits for [grep]
-d, --debug Debugger
-h, --help output usage information
-V, --version output the version number of the package
-e, --extended Extended log
-n, --version_name [version_name] Name of the version
-a, --app_name [app_name] Name [app_name]
-b, --branch [branch] Branch name [branch]
-f, --file [file] File [file]
-tpl, --template [template] Template [template]
-r, --repo_url [repo_url] Repo url [repo_url]
-l, --logo [logo] Logo path [logo]
-i, --intro [intro] intro text [intro]
-t, --tag [tag] Since tag [tag]
-rc, --changelogrc [changelogrc] .changelogrc relative path [changelogrc]
-g, --grep [grep] Grep commits for [grep]
-d, --debug Debugger
```

Expand Down
1 change: 1 addition & 0 deletions output/customTemplate.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ _This changelog is generated with a custom template_


## Documentation
- updating documentation with template info (70fb97742ea2182a9d25ca92d6eeab081b44cc63
- Updated readme with the correct specification (ec2de4bf599dfc77c24c9b86ee9c0d86fe37e5b8
- Updated options and tagging info (1ad3b6bedc6431b70e3a2e93e5967bad9a7830ee
- added documentation for explaining the commit message (d516c2fb464072fc1f4c86ec71a910eeab3e830c
Expand Down
2 changes: 1 addition & 1 deletion tasks/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ if (process.argv.join('').replace(/\\/g,'/').indexOf('/grunt') === -1) {
}

if (program.version_name){
options.versionName = program.version_name;
options.version_name = program.version_name;
}

if (program.app_name){
Expand Down
2 changes: 1 addition & 1 deletion tasks/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
branch : '',
//[G]ithub [B]itbucket supported at the momment
repo_url: '',
version : '',
version_name : '',
file: 'CHANGELOG.md',
app_name : 'My app - Changelog',
tag: null,
Expand Down
4 changes: 2 additions & 2 deletions tasks/lib/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ var debug = require('debug')('changelog:generate');
function generateFromCommits(commits, sections) {
this.message('parsed commits', commits.length);
this.log('debug', 'Parsed', commits.length, 'commits');
this.log('info','Generating changelog to', this.options.file || 'stdout', '(', this.options.version, ')');
this.log('info','Generating changelog to', this.options.file || 'stdout', '(', this.options.version_name, ')');

return this.writeChangelog(commits, sections);
}

function generateFromTag(tag) {
var readGitLog;

if (typeof(tag) !== 'undefined' && tag && tag !== false) {
this.log('info', 'Reading git log since', tag);
this.message('since tag', tag);
Expand Down
2 changes: 2 additions & 0 deletions tasks/lib/get-previous-tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ var child = require('child_process');

function cmdDone(resolve, reject, code, stdout, stderr) {
debug('returning from git tag');
//I think this command it's actually not working and always return empty
// Consider trying git describe --abbrev=0 --tags
if (code) {
reject();
} else {
Expand Down
2 changes: 1 addition & 1 deletion tasks/lib/init-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function initOptions(params) {
this.message('logo', this.options.logo);
this.message('sections', this.options.sections);
this.message('debug', this.options.debug);
this.message('version', this.options.version);
this.message('version_name', this.options.version_name);
this.message('changelogrc', this.options.changelogrc);
}

Expand Down
4 changes: 2 additions & 2 deletions tasks/lib/print-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var format = require('util').format;
var logoTemplate = '<img width="300px" src="%s" />\n\n';
var titleTemplate = '__%s__\n\n';
var subtitleTemplate = '_%s_\n\n';
var versionTemplate = '# %s %s (%s)\n\n';
var versionTemplate = '# %s (%s)\n\n';

function printHeader(stream, options, date) {

Expand All @@ -22,7 +22,7 @@ function printHeader(stream, options, date) {
stream.write(format(subtitleTemplate, options.intro));
}

stream.write(format(versionTemplate, options.version || '', options.versionName || '', date));
stream.write(format(versionTemplate, options.version_name || '', date));
stream.write('\n\n---\n');
}

Expand Down
2 changes: 1 addition & 1 deletion tasks/lib/write-change-log.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function writeChangelog(commits) {
title: module.options.app_name,
version:{
number: module.options.tag,
name: module.options.name
name: module.options.version_name
}
};

Expand Down
12 changes: 6 additions & 6 deletions test/git_changelog_generate.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ describe('git_changelog_generate.js', function() {
expect(changelog.options.msg).to.contain('debug: test');
});

it('should store "version" if passed as an option', function() {
changelog.initOptions({ version: 'test' });
expect(changelog.options.version).to.equal('test');
expect(changelog.options.msg).to.contain('version: test');
it('should store "version_name" if passed as an option', function() {
changelog.initOptions({ version_name: 'test' });
expect(changelog.options.version_name).to.equal('test');
expect(changelog.options.msg).to.contain('version_name: test');
});

it('should store any other option, but not save in msg', function() {
Expand Down Expand Up @@ -469,7 +469,7 @@ describe('git_changelog_generate.js', function() {
sinon.stub(changelog, 'printSection');
sinon.stub(changelog, 'printHeader');

changelog.initOptions({ app_name: 'app', version: 'version', sections: sections, template: false });
changelog.initOptions({ app_name: 'app', version_name: 'version_name', sections: sections, template: false });
changelog.writeChangelog(this.commits)
.then(function() {
done();
Expand Down Expand Up @@ -571,7 +571,7 @@ describe('git_changelog_generate.js', function() {
sinon.stub(changelog, 'printSection');
sinon.stub(changelog, 'printHeader');

changelog.initOptions({ app_name: 'app', version: 'version', sections: sections, template:false });
changelog.initOptions({ app_name: 'app', version_name: 'version_name', sections: sections, template:false });
changelog.writeChangelog(this.commits).then(function() {
done();
});
Expand Down

0 comments on commit 43fdac8

Please sign in to comment.