grunt-get-branchname

0.2.0 • Public • Published

grunt-get-branchname

Get the current Git branch name and pass it to another task's config

Getting Started

This plugin requires Grunt ~0.4.5

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-get-branchname --save-dev

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

grunt.loadNpmTasks('grunt-get-branchname');

The "get_branchname" task

Overview

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

grunt.initConfig({
  get_branchname: {
    options: {
      // Task-specific options go here.
    },
    your_target: {
      // Target-specific options go here.
    },
  },
});

Options

options.target

Type: String Default value: null

A string value that is used to specify the Grunt configuration object to inject the current Git branch name into

options.short

Type: Boolean Default value: true

A Boolean to specify whether just the name of the branch is specified, e.g. master, or whether the full symbolic-ref, e.g. refs/heads/master is injected

options.quiet

Type: Boolean Default value: false

A Boolean to specify whether any errors being returned by the command are suppressed

Usage Examples

grunt.initConfig({
  get_branchname: {
    options: {
      target: 'sometask.dev.branchname' // property will be created if it does not exist
    },
  },
});

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

0.1.0 Initial release

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.2.01latest

Version History

VersionDownloads (Last 7 Days)Published
0.2.01
0.1.20
0.1.10
0.1.00

Package Sidebar

Install

npm i grunt-get-branchname

Weekly Downloads

1

Version

0.2.0

License

none

Last publish

Collaborators

  • dan-wellman