Skip to content

Commit

Permalink
Issues: #2, #5
Browse files Browse the repository at this point in the history
Also:
- utilising semver and prompt modules
- improved logging (colouring)
- replacing 'noLatest' option with 'latest'
  • Loading branch information
Askelkana committed Mar 18, 2015
1 parent 92fb29b commit 8d34180
Show file tree
Hide file tree
Showing 3 changed files with 248 additions and 202 deletions.
62 changes: 23 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,6 @@ One the plugin has been installed, it may be enabled inside your Gruntfile with

## Overview

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

grunt.initConfig({
...
svn_custom_tag: {
options: {
// Task-specific options go here.
},
your_project: {
files: [
// the project files and folders you want tagged
]
},
},
...
});

This plugin requires some user input to determine the right version number to use. However, this can also be circumvented by supplying arguments from the command-line (see below).

## Options
Expand All @@ -40,17 +23,19 @@ This plugin requires some user input to determine the right version number to us

Type: `String`

Default: `'F'`
Default: `'z'`

When prompted to select the bump level, pressing enter will select the default bump. See below for more details.

When prompted to select the bump level, pressing enter will select the default bump.
### options.latest

### options.noLatest
Type: `boolean` | `string`

Type: `boolean`
Default: `true`

Default: `false`
The plugin provides the means to copy the bumped version to a `latest` tag folder. Whether or not this is done is determined by the value of this option.

By default, the task copies the created versioned tag to the `'latest'` tag. Setting this to false prevents this.
Set this to `true` to copy to the latest without prompting. Set to `false` to skip this step. Set to `'prompt'` to be asked at run-time.

### options.repository

Expand All @@ -70,13 +55,11 @@ Specifies the root tag folder in the project's SVN respository.

## Version Numbering

Various version numbering systems exist, but this plugin only supports the X.Y.Z notation, but this should cater for the majority of cases. The terminology used in the plugin is "Generation.Version.Fix".
The plugin adheres to the [Semver](http://semver.org/) system of version numbering, and utilises the [semver](https://docs.npmjs.com/misc/semver) npm package to achieve this.

## Tagged Folder Structure

The plugin processes the names of the folders under the specified `tagDir` folder and from them determines the latest (highest) version number, which will then (most likely) be bumped. Folders with names other than the X.Y.Z format are ignored. If also creating a `latest` folder, any existing folder of that name will be overwritten.

When creating a new snapshot, a new folder under `tagDir` will be added, and the specified files imported. See below for an example.
The assumption is that all folders under the `tagDir` folder are versioned (i.e. the name is the version number). When creating a new snapshot, a new folder under the tag root will be added, and the specified files imported. See below for an example.

## Specifying Custom Tagging

Expand Down Expand Up @@ -109,25 +92,26 @@ Note that multiple file object can be specified, and each will be processed in t

## User Input

The plugin will determine the latest (highest) version number from the already existing version folders. This is the number that will be bumped (unless the user explicitly proves a version number). In order to determine the next bump type, the user is asked the nature of the change. Possible responses are:

1. 'G' - A generation change, e.g. 2.1.15 => 3.0.0
2. 'V' - A version change, e.g. 4.2.6 => 4.3.0
3. 'F' - A fix change, e.g. 1.3.12 => 1.3.13
4. 'X' - An explicit version. The user is asked to supply the version directly. Both format clashes will be tested.
5. 'Enter' - Use the default bump type. For convenience.
6. 'Q' - Quit the task.
In order to determine the next bump type, the user is asked the nature of the change. Possible responses (all case-insensitive) are:

Input is case-insensitive.
1. 'X' - A major change, i.e. 2.1.15 => 3.0.0
2. 'Y' - A minor change, i.e. 2.1.15 => 2.2.0
3. 'Z' - A patch change, i.e. 2.1.15 => 2.1.16
4. 'PX' - A premajor change, i.e. 2.1.15 => 3.0.0-0
5. 'PY' - A preminor change, i.e. 2.1.15 => 2.2.0-0
6. 'PZ' - A prepatch change, i.e. 2.1.15 => 2.1.16-0
7. 'E' - An explicit version. The user is asked to supply the version directly.
8. 'Enter' - Use the `defaultBump` option. For convenience.
9. 'Q' - Quit the task.

### Avoiding User Input

It is possible to circumvent having to supply user input by providing the bump type as the first argument for the task. For example:

> grunt svn_custom_tag:my_project:f
> grunt svn_custom_tag:my_project:pz

In this case, only 'G', 'V' and 'F' are recognised. This feature allows for custom tasks to be defined, which can be invoked as required, e.g.
In this case, only the verions bumps (1-6 above) are recognised. This feature allows for custom tasks to be defined, which can be invoked as required, e.g.

grunt.registerTask('tag_fix', [ 'svn_custom_tag:my_project:f' ])
grunt.registerTask('tag_fix', [ 'svn_custom_tag:my_project:z' ])

Lovely jovely!
76 changes: 39 additions & 37 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
{
"name": "grunt-svn-custom-tag",
"description": "Creates custom versioned tag entries in your SVN repository",
"version": "1.1.0",
"author": {
"name": "Askelkana",
"email": "askelkana@gmail.com"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/askelkana/grunt-svn-custom-tag/blob/master/LICENSE-MIT"
}
],
"homepage": "https://github.com/askelkana/grunt-svn-custom-tag",
"repository": {
"type": "git",
"url": "https://github.com/Askelkana/grunt-svn-custom-tag.git"
},
"bugs": {
"url": "https://github.com/askelkana/grunt-svn-custom-tag/issues"
},
"engines": {
"node": ">= 0.8.0"
},
"main": "Gruntfile.js",
"dependencies": {
"sprintf": "*",
"q": "*"
},
"peerDependencies": {
"grunt": "~0.4.0"
},
"keywords": [
"gruntplugin",
"svn",
"tag"
]
"name": "grunt-svn-custom-tag",
"description": "Creates custom versioned tag entries in your SVN repository",
"version": "1.1.0",
"author": {
"name": "Askelkana",
"email": "askelkana@gmail.com"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/askelkana/grunt-svn-custom-tag/blob/master/LICENSE-MIT"
}
],
"homepage": "https://github.com/askelkana/grunt-svn-custom-tag",
"repository": {
"type": "git",
"url": "https://github.com/Askelkana/grunt-svn-custom-tag.git"
},
"bugs": {
"url": "https://github.com/askelkana/grunt-svn-custom-tag/issues"
},
"engines": {
"node": ">= 0.8.0"
},
"main": "Gruntfile.js",
"dependencies": {
"prompt": "^0.2.14",
"q": "*",
"semver": "^4.3.1",
"sprintf": "*"
},
"peerDependencies": {
"grunt": "~0.4.0"
},
"keywords": [
"gruntplugin",
"svn",
"tag"
]
}
Loading

0 comments on commit 8d34180

Please sign in to comment.