grunt-git-tag-parse

0.0.2 • Public • Published

grunt-git-tag-parse

Save a grunt variable containing a version string from a git ta, falling backon revision if a tag is not available

Getting Started

This plugin requires Grunt ~0.4.1

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-tag-parse --save-dev

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

grunt.loadNpmTasks('grunt-git-tag-parse');

The "git_tag_parse" task

Overview

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

grunt.initConfig({
  git_tag_parse: {
    test: {
      options: {
        property:'someConfigName'
      },
    }
  },
});

Options

options.property

Type: String Default value: 'meta.revision'

A string value representing the grunt config key to store the git tag into

options.revision

Type: String Default value: 'HEAD'

A string value denoting the git revision to interrogate.

options.number

Type: Number Default value: '6'

A number representing the length passed to --short for cases where the current HEAD is not tagged and the plugin returns a git revision

Usage Examples

Default Options

In this example, the default options are used to do something with whatever. So if the testing file has the content Testing and the 123 file had the content 1 2 3, the generated result would be Testing, 1 2 3.

grunt.initConfig({
  git_tag_parse: {
    test: {
      options: {},
    }
  },
});

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)

Readme

Keywords

Package Sidebar

Install

npm i grunt-git-tag-parse

Weekly Downloads

1

Version

0.0.2

License

none

Last publish

Collaborators

  • dlasky