diff options
author | plegall <plg@piwigo.org> | 2016-03-07 20:59:19 +0100 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2016-03-07 20:59:19 +0100 |
commit | 7f672711a08fa3dcf103179aef04e07fb6f79643 (patch) | |
tree | e056b322f4b4ab3cef9473d8816b195d54fe61be /tools/replace_version.pl | |
parent | e2bf31e482923836120c9abcd38767e5693ac28d (diff) |
new release script, which sets versions for extensions
Diffstat (limited to 'tools/replace_version.pl')
-rw-r--r-- | tools/replace_version.pl | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tools/replace_version.pl b/tools/replace_version.pl new file mode 100644 index 000000000..845948d81 --- /dev/null +++ b/tools/replace_version.pl @@ -0,0 +1,39 @@ +#!/usr/bin/perl + +#### +# Usage +# +# perl replace_version.pl --file=/path/to/file.php --version=2.8.0 + +use strict; +use warnings; + +use Getopt::Long; +use File::Basename; + +my %opt = (); +GetOptions( + \%opt, + qw/ + file=s + version=s + / +); + +if (not -e $opt{file}) { + die "file missing ".$opt{file}; +} + +my $new_content = ''; +open(my $ifh, '<'.$opt{file}) or die 'Houston, problem with "'.$opt{file}.'" for reading'; +while (<$ifh>) { + if (/^Version:/) { + $_ = 'Version: '.$opt{version}.''."\n"; + } + $new_content.= $_; +} +close($ifh); + +open(my $ofh, '>'.$opt{file}) or die 'Houston, problem with "'.$opt{file}.'" for writing'; +print {$ofh} $new_content; +close($ofh); |