New option -o for setversion script
[org-mode.git] / UTILITIES / set-version.pl
blobe34fa92bf551437ad7ea69fc980eda77d7fc58bb
1 #!/usr/bin/perl
2 $version = $ARGV[0];
3 if ($version eq "--all" or $version eq "-a") {
4 $all = 1;
5 $version = $ARGV[1]
8 if ($version eq "--only" or $version eq "-o") {
9 $only = 1;
10 $version = $ARGV[1]
13 die "No version given" unless $version=~/\S/;
14 $date = `date "+%B %Y"`; chomp $date;
15 $year = `date "+%Y"` ; chomp $year;
17 print STDERR "Changing version to \"$version\" and date to \"$date\" in all relevant files\n" ;
19 if (not $only) {
21 print STDERR join("\n",glob("lisp/*.el")),"\n";
22 $cmd = qq{s/^(;; Version:)\\s+(\\S+)[ \t]*\$/\$1 $version/;s/^(\\(defconst org-version )"(\\S+)"/\$1"$version"/};
23 $c1 = "perl -pi -e '$cmd' lisp/*.el";
24 system($c1);
26 print STDERR "doc/org.texi\n";
27 $cmd = qq{s/^(\\\@set VERSION)\\s+(\\S+)[ \t]*\$/\$1 $version/;s/^(\\\@set DATE)\\s+(.*)\$/\$1 $date/;};
28 $c1 = "perl -pi -e '$cmd' doc/org.texi";
29 system($c1);
31 print STDERR "doc/orgcard.tex\n";
32 $cmd = qq{s/^\\\\def\\\\orgversionnumber\\{\\S+\\}/\\\\def\\\\orgversionnumber{$version}/;s/\\\\def\\\\versionyear\\{\\S+\\}/\\\\def\\\\versionyear{$year}/;s/\\\\def\\\\year\\{\\S+\\}/\\\\def\\\\year{$year}/;};
33 $c1 = "perl -pi -e '$cmd' doc/orgcard.tex";
34 system($c1);
36 print STDERR "README_DIST\n";
37 $cmd = qq{s/^(The version of this release is:)\\s+(\\S+)[ \t]*\$/\$1 $version/;};
38 $c1 = "perl -pi -e '$cmd' README_DIST";
39 system($c1);
42 if ($all or $only) {
43 print STDERR "ORGWEBPAGE/index.org\n";
44 $cmd = qq{s/^(\\* Current Version )\\(\\S+?\\)/\$1($version)/;s/^(The current version is)\\s+(\\S+)\\. /\$1 $version. /;s/org-[6-9].*?\\.(zip|tar\\.gz)/org-$version.\$1/g};
45 $c1 = "perl -pi -e '$cmd' ORGWEBPAGE/index.org";
46 system($c1);