Improve portability for git_gerrit_pull

Change-Id: Iaf789dba860df38de30cf447d1823e9f028df444
diff --git a/bin/git_gerrit_pull b/bin/git_gerrit_pull
index 872dd46..95a2073 100755
--- a/bin/git_gerrit_pull
+++ b/bin/git_gerrit_pull
@@ -3,7 +3,6 @@
 use warnings;
 use Mojo::File 'tempfile';
 use Mojo::UserAgent;
-use Cwd qw();
 
 our @ARGV;
 
@@ -22,7 +21,7 @@
   };
 };
 
-unless ($url ) {
+unless ($url) {
   print 'git-gerrit-pull https://github.com/KorAP/.../pull/..' . "\n";
   exit;
 };
@@ -31,13 +30,14 @@
 
 _check('git pull origin master');
 
-$url =~ m!/pull/(\d+?)$!;
+$url =~ m!KorAP/([^/]+?)/pull/(\d+?)$!;
 
 my $ua = Mojo::UserAgent->new;
 
 print "Fetch $url...\n";
 
-my $pr = $1;
+my $project = $1;
+my $pr = $2;
 my $branch = $ua->get($url)->res->dom->at('.commit-ref.head-ref')->all_text;
 
 _check('git fetch github pull/' . $pr . '/head:' . $branch);
@@ -45,28 +45,26 @@
 _check('git rebase master');
 
 
-my $path = Cwd::abs_path();
-
 # Kustvakt
-if ($path =~ m!Kustvakt/?$!) {
+if ($project =~ m!^Kustvakt$!i) {
   _check('cd core && JAVA_HOME="/usr/lib/jvm/java-1.11.0-openjdk-amd64" mvn clean install');
   _check('cd lite && JAVA_HOME="/usr/lib/jvm/java-1.11.0-openjdk-amd64" mvn clean test');
   _check('cd full && JAVA_HOME="/usr/lib/jvm/java-1.11.0-openjdk-amd64" mvn clean test');
 }
 
 # KalamarExport-Plugin
-elsif ($path =~ m!KalamarExportPlugin/?$!) {
+elsif ($project =~ m!^Kalamar-Plugin-Export$!i) {
   _check('JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-amd64" mvn clean test');
 }
 
 # KorapSRU
-elsif ($path =~ m!KorapSRU/?$!) {
+elsif ($project =~ m!^KorapSRU$!i) {
   _check('JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-amd64" mvn clean test');
 }
 
-# Unknown
+# Unknown Project
 else {
-  print "Unknown directory!\n\n";
+  print "Unknown project $project!\n\n";
   exit(1);
 };
 
@@ -120,6 +118,3 @@
 This script is an alternative to C<import_github_pull_requests>
 that ignores CI results on github and just requires the
 URL of a specific GH pull request to send it through Gerrit.
-The detection paths for the repository specific actions may
-differ. It's probably beneficial to make this dependent on the
-GitHub URL instead of the local repository ...