1 | require 'json'
|
2 |
|
3 | # Automatically create an atomic commit of the version file update
|
4 | # and create a new tag.
|
5 | automate_git :actions => [:commit, :tag]
|
6 |
|
7 | file = './package.json'
|
8 |
|
9 | read_version do
|
10 | doc = JSON.load File.read file
|
11 | doc['version']
|
12 | end
|
13 |
|
14 | write_version do |currentVersion, nextVersion|
|
15 | doc = JSON.load File.read file
|
16 | doc['version'] = nextVersion.to_s
|
17 | File.open(file, 'w') {|f| f.write JSON.pretty_generate(doc) }
|
18 | end
|