Skip to content

Commit 7ffc795

Browse files
committed
Add version:update task
1 parent e75f309 commit 7ffc795

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Rakefile

+24
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,27 @@ task :tag do
88
sh("git", "tag", "-a", version, "-m", "#{version} has been released!!!")
99
sh("git", "push", "--tags")
1010
end
11+
12+
namespace :version do
13+
desc "Update version"
14+
task :update do
15+
new_version = ENV["VERSION"]
16+
if new_version.nil?
17+
raise "Specify new version as VERSION environment variable value"
18+
end
19+
20+
xmlua_lua_content = File.read("xmlua.lua").gsub(/xmlua\.VERSION = ".+?"/) do
21+
"xmlua.VERSION = \"#{new_version}\""
22+
end
23+
File.open("xmlua.lua", "w") do |xmlua_lua|
24+
xmlua_lua.print(xmlua_lua_content)
25+
end
26+
27+
rockspec_content = File.read("xmlua.rockspec").gsub(/package_version = ".+?"/) do
28+
"package_version = \"#{new_version}\""
29+
end
30+
File.open("xmlua.rockspec", "w") do |rockspec|
31+
rockspec.print(rockspec_content)
32+
end
33+
end
34+
end

0 commit comments

Comments
 (0)