UNPKG

429 BPlain TextView Raw
1require 'json'
2
3# Automatically create an atomic commit of the version file update
4# and create a new tag.
5automate_git :actions => [:commit, :tag]
6
7file = './package.json'
8
9read_version do
10 doc = JSON.load File.read file
11 doc['version']
12end
13
14write_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) }
18end