From c2e54a8a241ad09d918071901cd70b7bbf00c047 Mon Sep 17 00:00:00 2001
From: elijah <elijah@riseup.net>
Date: Fri, 3 Jun 2016 12:02:09 -0700
Subject: [PATCH] auto run bundler when needed for site_static

---
 puppet/modules/site_static/manifests/location.pp | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/puppet/modules/site_static/manifests/location.pp b/puppet/modules/site_static/manifests/location.pp
index d116de2f..ab2b7494 100644
--- a/puppet/modules/site_static/manifests/location.pp
+++ b/puppet/modules/site_static/manifests/location.pp
@@ -23,6 +23,19 @@ define site_static::location($path, $format, $source) {
     }
   }
 
+  if ($format == 'rack') {
+    # Run bundler if there is a Gemfile
+    exec { 'bundler_update':
+      cwd     => $file_path,
+      command => '/bin/bash -c "/usr/bin/bundle check --path vendor/bundle || /usr/bin/bundle install --path vendor/bundle --without test development debug"',
+      unless  => '/usr/bin/bundle check --path vendor/bundle',
+      onlyif  => 'test -f Gemfile',
+      user    => 'www-data',
+      timeout => 600,
+      require => [Class['bundler::install'], Class['site_config::ruby::dev']];
+    }
+  }
+
   vcsrepo { $file_path:
     ensure   => present,
     force    => true,
-- 
GitLab