auto commit on 2019-03-08 17:59
authorKilian Saffran <ksaffran@dks.lu>
Fri, 8 Mar 2019 16:59:52 +0000 (17:59 +0100)
committerKilian Saffran <ksaffran@dks.lu>
Fri, 8 Mar 2019 16:59:52 +0000 (17:59 +0100)
bin/commitall.bat
bin/githelper.pl
bin/gitlaststate.bat [new file with mode: 0644]

index 9d32565..0092257 100644 (file)
@@ -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
index 1adfe2f..c4a93db 100644 (file)
@@ -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 (file)
index 0000000..eab46c1
--- /dev/null
@@ -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