From: Kilian Saffran Date: Fri, 8 Mar 2019 16:59:52 +0000 (+0100) Subject: auto commit on 2019-03-08 17:59 X-Git-Url: http://cloud.dks.lu/git/?a=commitdiff_plain;h=9100113c359a11b73897304ea002c39962263fb3;p=dks_server.git auto commit on 2019-03-08 17:59 --- diff --git a/bin/commitall.bat b/bin/commitall.bat index 9d32565..0092257 100644 --- a/bin/commitall.bat +++ b/bin/commitall.bat @@ -1,3 +1,3 @@ @echo off -C:\Strawberry\perl\bin\perl.exe "c:\Users\ksaff\Workspace\dks_server\bin\githelper.pl" \ No newline at end of file +C:\Strawberry\perl\bin\perl.exe "c:\Users\ksaff\Workspace\dks_server\bin\githelper.pl" --set \ No newline at end of file diff --git a/bin/githelper.pl b/bin/githelper.pl index 1adfe2f..c4a93db 100644 --- a/bin/githelper.pl +++ b/bin/githelper.pl @@ -4,19 +4,35 @@ use strict; use File::Basename; use File::Find::Rule; use Data::Dumper; +use Getopt::Long; use POSIX qw (strftime); -my $wksp = $ENV{HOME}.'/Workspace'; +my @wksp = ($ENV{HOME}.'/Workspace',$ENV{HOME}.'/Workspace/Websites',$ENV{HOME}.'/Workspace/Apps'); if ($^O eq "MSWin32"){ - $wksp = $ENV{USERPROFILE}.'/Workspace'; - $wksp =~ s/\\/\//g; + @wksp = ($ENV{USERPROFILE}.'/Workspace',$ENV{USERPROFILE}.'/Workspace/Websites',$ENV{HOME}.'/Workspace/Apps'); + $wksp[0] =~ s/\\/\//g; + $wksp[1] =~ s/\\/\//g; + $wksp[2] =~ s/\\/\//g; } +my $get = 0; +my $set = 0; +GetOptions("get" => \$get,"set" => \$set); #print $wksp."\n"; #print ."\n"; - my $ff = File::Find::Rule->new(); $ff->name(".git"); $ff->directory; -my @rep = $ff->in($wksp); +$ff->maxdepth(3); +my @rep = $ff->in(@wksp); + +if ($get == 1){ + foreach my $r (@rep){ + print "repository ".basename(dirname($r))."!\n"; + chdir(dirname($r)); + my $ret = `git pull`; + print $ret."\n---\n"; + } +} +if ($set == 1){ foreach my $r (@rep){ chdir(dirname($r)); my $ret = `git status`; @@ -40,7 +56,6 @@ foreach my $r (@rep){ $ret = `git status`; print $ret."\n---\n"; } - - #print $ret."\n---\n"; +} } #print Dumper(@rep); \ No newline at end of file diff --git a/bin/gitlaststate.bat b/bin/gitlaststate.bat new file mode 100644 index 0000000..eab46c1 --- /dev/null +++ b/bin/gitlaststate.bat @@ -0,0 +1,3 @@ +@echo off + +C:\Strawberry\perl\bin\perl.exe "c:\Users\ksaff\Workspace\dks_server\bin\githelper.pl" --get \ No newline at end of file