Repository navigation
Expand file tree
/
Copy pathRakefile
More file actions
64 lines (59 loc) · 1.9 KB
/
Copy pathRakefile
File metadata and controls
64 lines (59 loc) · 1.9 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# -*- ruby -*-
def version
configure_ac = File.read("configure.ac")
configure_ac[/^AC_INIT\(\[SigScheme\], \[(.+?)\]/, 1]
end
desc "Tag"
task :tag do
sh("git", "tag", "-a", version, "-m", "SigScheme #{version}!!!")
sh("git", "push", "origin", version)
end
namespace :version do
desc "Bump version"
task :bump do
next_version = version.succ
configure_ac =
File.read("configure.ac").
gsub(/^(AC_INIT\(\[SigScheme\], )\[.+?\]/) {"#{$1}[#{next_version}]"}
File.write("configure.ac", configure_ac)
meson_build =
File.read("meson.build").
sub(/^(project\(.*?version:\s*')\d+\.\d+\.\d+/m) {"#{$1}#{next_version}"}
File.write("meson.build", meson_build)
sigscheme_h_path = "include/sigscheme/sigscheme.h"
sigscheme_h =
File.read(sigscheme_h_path).
sub(/^(#define SSCM_VERSION_STRING\s+)".+?"/) do
"#{$1}\"#{next_version}\""
end
major, minor, patchlevel = next_version.split(".")
{
"MAJOR" => major,
"MINOR" => minor,
"PATCHLEVEL" => patchlevel,
}.each do |name, value|
sigscheme_h =
sigscheme_h.sub(/^(#define SSCM_VERSION_#{name}\s+)\(\d+\)/) do
"#{$1}(#{value})"
end
end
File.write(sigscheme_h_path, sigscheme_h)
sh("git", "add", "configure.ac", "meson.build", sigscheme_h_path)
sh("git", "commit", "-m", "Bump version")
sh("git", "push")
end
end
desc "Release"
task :release => ["tag", "version:bump"]
namespace :unicode do
desc "Update src/unicode-table.c to VERSION such as VERSION=17.0.0"
task :update do
unicode_version = ENV["VERSION"] or abort("VERSION is required")
table = IO.popen([RbConfig.ruby,
"tools/generate-unicode-table.rb",
unicode_version],
&:read)
abort("failed to generate the table") unless $?.success?
File.write("src/unicode-table.c", table)
end
end