-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmake
executable file
·91 lines (77 loc) · 2.53 KB
/
make
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/env raku
constant $readme-src = "lib/App/termie.rakumod";
constant $github-repo = 'bduggan/termie';
if %*ENV<VERBOSE> {
&shell.wrap: -> |c { say c.raku; callsame; }
&QX.wrap: -> |c { say c.raku; callsame; }
}
my $module = q:x[jq -r .name META6.json].trim.?subst('::','-',:g) or exit note 'no name';
my $version = q:x[jq -r .version META6.json].trim or exit note 'no version';
my $badges = qq:to/MD/;
[](https://github.com/$github-repo/actions/workflows/linux.yml)
[](https://github.com/$github-repo/actions/workflows/macos.yml)
MD
multi MAIN('test', Bool :$v) {
my $env = '';
if $*DISTRO ~~ /macos/ {
$env ~= 'DYLD_LIBRARY_PATH=. ';
}
shell "$env TEST_AUTHOR=1 prove {$v ?? '-v' !! ''} -e 'raku {$v ?? '--ll-exception' !! ''} -Ilib' t/*.rakutest";
}
multi MAIN('dist') {
make-dist($version);
}
sub make-dist($version) {
my $out = "tar/{$module}-{$version}.tar.gz";
shell qq:to/SH/;
echo "Making $version";
mkdir -p tar
git archive --prefix={$module}-{$version}/ -o $out {$version}
SH
say "wrote $out";
}
sub update-changes($version, $next) {
"/tmp/changes".IO.spurt: $next ~ ' ' ~ now.Date.yyyy-mm-dd ~ "\n\n";
shell "git log --format=full $version...HEAD >> /tmp/changes";
shell "echo >> /tmp/changes";
"CHANGES".IO.e and do {
shell "cat CHANGES >> /tmp/changes && mv /tmp/changes CHANGES";
}
shell "nvim CHANGES";
}
multi MAIN('docs') {
shell q:to/SH/;
./gen-docs --html > doc.md
SH
}
multi MAIN('bumpdist') {
shell "zef test .";
my $next = qq:x[raku -e '"$version".split(".") >>+>> <0 0 1> ==> join(".") ==> say()'].trim;
say "$version -> $next";
exit note "no next version" unless $next;
shell qq:to/SH/;
perl -p -i -e "s/{$version}/{$next}/" META6.json
SH
update-changes($version,$next);
shell "git commit -am$next";
shell "git tag $next";
make-dist($next);
}
multi MAIN('clean') {
shell 'rm -f dist/*.tar.gz';
}
multi MAIN('tar') {
my $out = "tar/{$module}-{$version}.tar.gz";
shell qq:to/SH/;
echo "Making $version";
mkdir -p tar
git archive --prefix={$module}-{$version}/ -o $out {$version}
SH
say "wrote $out";
}
multi MAIN('release') {
"tar/{$module}-{$version}.tar.gz".IO.e or die "no tarfile created for $version, make tar first";
shell "git push github";
shell "git push --tags github";
shell "fez upload --file tar/{$module}-{$version}.tar.gz";
}