forked from hzdg/bedrock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CAKEFILE
50 lines (40 loc) · 1.57 KB
/
CAKEFILE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env coffee
shelljs = require 'shelljs'
{quote} = require 'shell-quote'
pkgmeta = require './package'
bowermeta = require './bower'
semver = require 'semver'
{writeFileSync} = require 'fs'
md5 = (data) -> crypto.createHash('md5').update(data).digest('hex')
exec = (cmd, args) -> shelljs.exec quote([cmd, args...])
# Increment the package version.
# The package versions adhere to the Semantic Versioning specification.
# The supported levels are 'major', 'minor', and 'patch',
# as described by the semver documentation.
#
# For more, see:
# https://github.com/isaacs/node-semver#versions
# http://semver.org/
#
incrementVersion = (level) ->
version = semver.inc pkgmeta.version, level
unless version
throw new Error("Could not increment #{level} version"
" from #{pkgmeta.version}")
else
oldVersion = pkgmeta.version
pkgmeta.version = version
bowermeta.version = version
writeFileSync './package.json', JSON.stringify(pkgmeta, null, 2)
writeFileSync './bower.json', JSON.stringify(bowermeta, null, 2)
exec 'git', ['commit', '-a', '-m', "Release #{version}"]
exec 'git', ['tag', '-a', version, '-m', "Release #{version}"]
task 'version:major', "increment major version", (options) ->
console.log 'Incrementing major version...'
incrementVersion 'major'
task 'version:minor', "increment minor version", (options) ->
console.log 'Incrementing minor version...'
incrementVersion 'minor'
task 'version:patch', "increment patch version", (options) ->
console.log 'Incrementing patch version...'
incrementVersion 'patch'