[Slim-Checkins] r34289 - /vendor/plugins/check.pl

[email protected] Thu, 21 Jan 2016 07:59:55 -0000
Newsgroups gmane.music.equipment.slimdevices.cvs
Message-ID <[email protected]>
Author: mherger
Date: Thu Jan 21 07:59:55 2016
New Revision: 34289

URL: http://svn.slimdevices.com/slim?rev=34289&view=rev
Log:
Update plugin update checker to better suite my needs on the Mac.

Modified:
    vendor/plugins/check.pl

Modified: vendor/plugins/check.pl
URL: http://svn.slimdevices.com/slim/vendor/plugins/check.pl?rev=34289&r1=34288&r2=34289&view=diff
==============================================================================
--- vendor/plugins/check.pl (original)
+++ vendor/plugins/check.pl Thu Jan 21 07:59:55 2016
@@ -12,12 +12,26 @@
 warn $svnUp if DEBUG;
 
 my $buildCmd = "$Bin/buildrepo.pl";
+
+# Unfortunately Perl 5.18 introduced changes to the hash handling which would change the file's structure.
+# Try to use an older version if possible. This is mostly to simplify my needs on OSX.
+if ( $] > 5.016 && -f '/usr/bin/perl5.16' ) {
+	$buildCmd = "/usr/bin/perl5.16 $buildCmd";
+}
+
 my $build = `$buildCmd`;
 
 warn $build if DEBUG;
 
 my $diff = `svn diff $Bin`;
 
-warn $diff if $diff;
+if ($diff) {
+	if ( $^O =~ /darwin/i ) {
+		`osascript -e 'display notification "Plugin updates are available. Please bump the repository file." with title "Plugin Update"'`
+	}
+	else {
+		print "$diff\n";
+	}
+}
 
 1;