Retidy master
authorAlexander Wirt <formorer@debian.org>
Sat, 15 Dec 2012 08:47:14 +0000 (09:47 +0100)
committerAlexander Wirt <formorer@debian.org>
Sat, 15 Dec 2012 08:47:14 +0000 (09:47 +0100)
tools/github

index 0232c9f..a486314 100755 (executable)
@@ -7,10 +7,9 @@ use File::Slurp qw ( slurp );
 use Data::Dumper;
 use Net::GitHub;
 
+my $token = slurp( File::HomeDir->my_home . "/.github-token" );
 
-my $token = slurp(File::HomeDir->my_home . "/.github-token");
-
-my $gh = Net::GitHub->new(  # Net::GitHub::V3
+my $gh = Net::GitHub->new(    # Net::GitHub::V3
     access_token => $token
 );
 
@@ -18,10 +17,11 @@ my @repos = $gh->repos->list_org('grml');
 
 foreach my $repo (@repos) {
     say $repo->{name};
-    say "-" x length($repo->{name});
-    my @hooks = $gh->repos->hooks('grml', $repo->{name});
+    say "-" x length( $repo->{name} );
+    my @hooks = $gh->repos->hooks( 'grml', $repo->{name} );
     my $found = 0;
     foreach my $hook (@hooks) {
+
         #warn Dumper($hook);
         next unless $hook->{name} eq 'web';
         next unless $hook->{config}->{url} eq "http://git.grml.org/github";
@@ -29,16 +29,22 @@ foreach my $repo (@repos) {
     }
     if ($found) {
         say "git.grml.org hook already configured";
-    } else {
-        my $rc = $gh->repos->create_hook('grml', $repo->{name}, {
-                name => 'web',
+    }
+    else {
+        my $rc = $gh->repos->create_hook(
+            'grml',
+            $repo->{name},
+            {
+                name   => 'web',
                 active => 1,
                 config => {
                     'content_type' => 'form',
-                    'url' => 'http://git.grml.org/github'
+                    'url'          => 'http://git.grml.org/github'
                 }
-            });
-        say "Hook created" if $rc->{config}->{url} eq "http://git.grml.org/github";
+            }
+        );
+        say "Hook created"
+          if $rc->{config}->{url} eq "http://git.grml.org/github";
     }
     say;
 }