0.1.0 • Published 10 years ago

grunt-git-changelog v0.1.0

Weekly downloads
6
License
-
Repository
github
Last release
10 years ago

grunt-git-changelog

Save changelog & history from git to files

Getting Started

This plugin requires Grunt.

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-git-changelog --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-git-changelog');

The "git_changelog" task

Overview

In your project's Gruntfile, add a section named git_changelog to the data object passed into grunt.initConfig().

grunt.initConfig({
// Configuration to be run.
    git_changelog: {
        cwd: 'changes',
        manifest: "../package.json",
        history: "history.txt",
        changelog: "changelog.txt",
        changesSeparator: '\n\t*********',
        masks: [
            {
                title: 'IMPLEMENTED:\n',
                mask: /(([^\.]+\s)*(Task)(\s[^\.]+)*)/gim,
                format: ' - #%h %an %ad: %s %b' // see http://git-scm.com/docs/git-log for mapping content,
            },
            {
                title: 'FIXED:\n',
                mask: /(([^\.]+\s)*(Bug)(\s[^\.]+)*)/gim,
                format: ' - #%h %an %ad: %s %b'
            },
            {
                title: 'OTHERS:\n',
                mask: /./gim,
                format: ' - #%h: %s %b'
            }
        ]
    }
});

Options

options.cwd

Type: String Default value: '.'

Current working directory.

options.manifest

Type: String Default value: 'manifest.json'

Path to file for saving the last changelog value and for getting the app version.

options.history

Type: String

Path to file for saving the history of changes.

options.changelog

Type: String

Path to file for saving the changelog.

options.changesSeparator

Type: String

Line for separation of the history file.

options.masks

Type: Array

Array of objects for formatting output files.

options.masks[ { title:

Type: String

Title for mapping area in the file.

options.masks[ { mask:

Type: regular expression

Regular expression for mapping area in the file.

options.masks[ { format:

Type: expression

Format of data in mapping area in the file.

Example of output files

history.txt

VERSION:0.0.1-2644a23
DATE:Tue Apr 22 2014 13:58:08

FIXED:
- #2644a23 John Doe Tue Apr 22 13:57:57 2014 +0300: A bug with format was fixed

======================================================================================
VERSION:0.0.1-c9d2cc0
DATE:Tue Apr 22 2014 13:44:31

OTHERS:
- #c9d2cc0: history logic changed

======================================================================================
VERSION:0.0.1-4390c3f
DATE:Tue Apr 22 2014 13:21:36

IMPLEMENTED:
- #4390c3f John Doe Tue Apr 22 13:21:18 2014 +0300: task: history added

======================================================================================
VERSION:0.0.1-763ef23
DATE:Tue Apr 22 2014 13:20:00

IMPLEMENTED:
- #fea1f51 John Doe Tue Apr 22 11:50:34 2014 +0300: task: new method of config
- #347b331 John Doe Thu Apr 17 12:04:04 2014 +0300: #934298723 task some results
FIXED:
- #65340a0 John Doe Mon Apr 21 14:04:20 2014 +0300: bug with hash
- #fb9ff95 John Doe Thu Apr 17 12:04:25 2014 +0300: #98654 bug some fix
OTHERS:
- #763ef23: different formats for other masks
- #966d968: change json
- #016c9a3: no message
- #c556ad4: mulitiline support
- #81069b1: current functionality -lkjds;lkj test multiline
- #5fe5b25: no message
- #b42aea0: 465465lkjhk closes #1
- #01b9ad1: closes
- #b66c41b: something .fixes
- #760a632: [FIX] fix function in test.js
- #9ba4c7d: bla bla bla comment
- #51ce621: [NEW] test.js
- #2621258: [NEW] Gruntfile.json & pakage.json
- #1a73f59: init commit by git ignore

======================================================================================

changelog.txt

VERSION:0.0.1-2644a23
DATE:Tue Apr 22 2014 13:58:08

FIXED:
- #2644a23 John Doe Tue Apr 22 13:57:57 2014 +0300: A bug with format was fixed

======================================================================================

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

(Nothing yet)

License

Copyright (c) 2014 mobidev.biz. Licensed under the MIT license.