#!/usr/bin/perl
use warnings;
use strict;
my $git = system('git fetch --tags');
print "What's here? --- $git\n";
####
my $git = system('git fetch --tags &> /dev/null');
##
##
git fetch --tags &> /tmp/git.txt
##
##
#!/usr/bin/perl
use warnings;
use strict;
use Capture::Tiny ':all';
use Version::Compare;
use Sort::Key::Natural qw( natsort );
my $GIT_HOME = '/usr/local/src/Arelle_Web/DQC_Test/';
my (@git) = capture{system("git --git-dir=${GIT_HOME}.git fetch --tags");};
@git = grep { $_ ne '' } @git;
my @tags;
if(scalar(@git) > 1){
print "Tags have been updated\n";
my $string = join("\n", @git);
@tags = ($string =~ m/\[new tag\]\s+(.+?)\s/g);
}
else {
@tags = split("\n",capture{system("git --git-dir=${GIT_HOME}.git tag")});
print "No New Tags\n";
}
@tags = natsort @tags;
chomp(my $running_version = capture{system("git --git-dir=${GIT_HOME}.git describe --tag");});
$running_version =~ s/^v//;
my ($ver_major) = $running_version =~ /^(\d)/;
my @version = grep(/^v$ver_major.+/,@tags);
if(@version){
@version = natsort @version;
my $newest = pop(@version);
$newest =~ s/^v//;
if(&Version::Compare::version_compare($newest,$running_version) == 1){
print "v$newest is greater than the running version v$running_version\n";
}
}