From 21b41f198a487b262eea57264986f25f88f54c03 Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Thu, 6 Feb 2014 22:37:16 -0500 Subject: [PATCH] Initial commit of bump-version.pl --- utils/bump-version.pl | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 utils/bump-version.pl diff --git a/utils/bump-version.pl b/utils/bump-version.pl new file mode 100755 index 000000000..d0ee26d93 --- /dev/null +++ b/utils/bump-version.pl @@ -0,0 +1,38 @@ +#!/usr/bin/env perl + +# This script will bump the version number in any files listed in the below +# @files array. It can only bump versions up, and does so by use of sed. + +use strict; +use warnings; +use Getopt::Long; + +my @files = ( + "../version", + "../configure.ac" +); + + +my ($new, $current); + +open my $file, "../version" or die $!; +chomp($current = <$file>); +close $file; + +sub usage { + print "Usage: bump-version.sh -n \n"; + exit 1; +} + +sub bump_version { + foreach my $file (@files) { + system("sed -i \"s/$current/$new/g\" $file"); + } +} + + +GetOptions ("n=s" => \$new) or usage; +usage if ! $new; +die("New version ($new) is not greater than old version ($current)!") if ( $new le $current); + +bump_version;