forked from OpenVoxProject/openbolt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvox.rake
More file actions
29 lines (25 loc) · 1.05 KB
/
vox.rake
File metadata and controls
29 lines (25 loc) · 1.05 KB
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
# frozen_string_literal: true
namespace :vox do
desc 'Update the version in preparation for a release'
task 'version:bump:full', [:version] do |_, args|
abort 'You must provide a tag.' if args[:version].nil? || args[:version].empty?
version = args[:version]
abort "#{version} does not appear to be a valid version string in x.y.z format" unless Gem::Version.correct?(version)
# Update lib/bolt/version.rb and openbolt.gemspec
puts "Setting version to #{version}"
data = File.read('lib/bolt/version.rb')
new_data = data.sub(/VERSION = '\d+\.\d+\.\d+(-\w+(\..*)?)?'/, "VERSION = '#{version}'")
if data != new_data
File.write('lib/bolt/version.rb', new_data)
else
warn 'Failed to update version in lib/bolt/version.rb'
end
data = File.read('openbolt.gemspec')
new_data = data.sub(/(spec.version *=) '\d+\.\d+\.\d+(-\w+(\.\w+)?)?'/, "\\1 '#{version}'")
if data != new_data
File.write('openbolt.gemspec', new_data)
else
warn 'Failed to update version in openbolt.gemspec'
end
end
end