-
Notifications
You must be signed in to change notification settings - Fork 0
/
upload_module_version.pike
74 lines (56 loc) · 1.74 KB
/
upload_module_version.pike
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
// the original source of this file is the Tools.Monger source
// distribution.
int main(int argc, array(string) argv)
{
object m = Tools.Monger.MongerDeveloper();
if(argc!=4)
{
werror("Usage: %s MODULE VERSION LICENSE\n", argv[0]);
exit(1);
}
string module = argv[1];
string version = argv[2];
string license = argv[3];
string changes = get_changes();
object in = Stdio.FILE("stdin");
Stdio.stdout.write("Have you updated the changelog, package components and module version? ");
string ans = in->gets();
if(lower_case(ans[0..0]) != "y") exit(1);
Stdio.stdout.write("Username: ");
string user = in->gets();
Stdio.stdout.write("Password: ");
in->tcsetattr((["ECHO": 0]));
string password = in->gets();
in->tcsetattr((["ECHO": 1]));
Stdio.stdout.write("\n");
write("module: " + module + ", version " + version + "\n");
write("license: " + license + "\n");
write("changes: " + changes);
m->set_auth(user, password);
m->add_new_version(module, version, changes, license);
m->set_dependency(module, version, "Pike", "7.6.0", "7.7.999", 1);
m->set_module_source(module, version, replace(module, ".", "_") + "-" + version + ".tar.gz");
return 0;
}
string get_changes()
{
string changes = "";
string changefile=Stdio.read_file("CHANGES");
int started=0;
foreach(changefile/"\n", string line)
{
if(!started && (Regexp("^Changes since ")->match(line)
|| Regexp("^Version [0-9]")->match(line)))
{
started = 1;
continue;
}
else if(started && (Regexp("^Changes since ")->match(line)
|| Regexp("^Version [0-9]")->match(line)))
{
return changes;
}
else if(started) changes = changes + line + "\n";
}
return changes;
}