From 7f4af17b7252dd41fd668dd6c81551568c4abeaf Mon Sep 17 00:00:00 2001
From: Longgeek <longgeek@thstack.com>
Date: Sat, 31 May 2014 06:26:38 +0800
Subject: [PATCH] Fix jquery-visibility.min.js name

what i meant was that we can just copy the same mechanism we're using to
run the minifier, instead of using the file object with ensure=>link

Fixed bug #1325117

Change-Id: I10cf4b4772e8d3fff869bfd638b2895b6e8980ea
---
 modules/zuul/manifests/init.pp | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/modules/zuul/manifests/init.pp b/modules/zuul/manifests/init.pp
index 26525f826a..299cb833e8 100644
--- a/modules/zuul/manifests/init.pp
+++ b/modules/zuul/manifests/init.pp
@@ -79,6 +79,12 @@ class zuul (
     }
   }
 
+  if ! defined(Package['yui-compressor']) {
+    package { 'yui-compressor':
+      ensure => present,
+    }
+  }
+
   user { 'zuul':
     ensure     => present,
     home       => '/home/zuul',
@@ -216,11 +222,14 @@ class zuul (
     source   => 'https://github.com/mathiasbynens/jquery-visibility.git',
   }
 
-  file { '/var/lib/zuul/www/jquery-visibility.min.js':
-    ensure  => link,
-    target  => '/opt/jquery-visibility/jquery-visibility.min.js',
-    require => [File['/var/lib/zuul/www'],
-                Vcsrepo['/opt/jquery-visibility']],
+  exec { 'install-jquery-visibility':
+    command     => 'yui-compressor -o /var/lib/zuul/www/jquery-visibility.min.js /opt/jquery-visibility/jquery-visibility.js',
+    path        => 'bin:/usr/bin',
+    refreshonly => true,
+    subscribe   => Vcsrepo['/opt/jquery-visibility'],
+    require     => [File['/var/lib/zuul/www'],
+                    Package['yui-compressor'],
+                    Vcsrepo['/opt/jquery-visibility']],
   }
 
   file { '/var/lib/zuul/www/index.html':