Skip to content

Latest commit

 

History

History
90 lines (67 loc) · 2.29 KB

README.md

File metadata and controls

90 lines (67 loc) · 2.29 KB

grunt-version-manager

Plugin for managing applications version (release, snapshot), based on git branch.

This plugin adds "-SNAPSHOT" suffix to given 'version'* if it is called from any other branch than 'release branch'*.

*version and release branch should be defined in plugin options

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-version-manager --save-dev

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

grunt.loadNpmTasks('grunt-version-manager');

The "version_manager" task

Overview

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

grunt.initConfig({
  version_manager: {
    options: {
      // Task-specific options go here.
    }
  }
});

Options

Only two options are required - 'branch' and 'version'. You can add any other string options. They will be displayed with 'version' on the stdout.

options.branch

Type: String Default value: master

A string value that describes release branch.

options.version

Type: String Default value: 0.0.0

A string value that describes version of your project.

Usage Examples

Simple config

grunt.initConfig({
  pkg: grunt.file.readJSON('package.json'),
  version_manager: {
    options: {
      branch: 'master',
      version: '<%= pkg.version %>'
    }
  }
});

Config with custom options

grunt.initConfig({
  pkg: grunt.file.readJSON('package.json'),
  version_manager: {
    options: {
      branch: 'master',
      version: '<%= pkg.version %>',
      desc: 'some description',
      author: 'some author'
    }
  }
});

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)