Browse Source

COOK-453, updated rails recipe to use bundler latest best practices

Seth Chisamore 13 years ago
parent
commit
880d381e00
3 changed files with 8 additions and 4 deletions
  1. 1 1
      metadata.json
  2. 1 1
      metadata.rb
  3. 6 2
      recipes/rails.rb

+ 1 - 1
metadata.json

@@ -46,5 +46,5 @@
     "application::tomcat": "Sets up the deployed Java application with Tomcat as the servlet container",
     "application::unicorn": "Sets up the deployed Rails application with Unicorn as the web server"
   },
-  "version": "0.99.0"
+  "version": "0.99.1"
 }

+ 1 - 1
metadata.rb

@@ -3,7 +3,7 @@ maintainer_email "cookbooks@opscode.com"
 license          "Apache 2.0"
 description      "Deploys and configures a variety of applications defined from databag 'apps'"
 long_description  IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version          "0.99.0"
+version          "0.99.1"
 recipe           "application", "Loads application databags and selects recipes to use"
 recipe           "application::java_webapp", "Deploys a Java web application WAR specified in a data bag with the remote_file resource"
 recipe           "application::passenger_apache2", "Sets up a deployed Rails application as a Passenger virtual host in Apache2"

+ 6 - 2
recipes/rails.rb

@@ -73,7 +73,7 @@ directory "#{app['deploy_to']}/shared" do
   recursive true
 end
 
-%w{ log pids system }.each do |dir|
+%w{ log pids system vendor_bundle }.each do |dir|
 
   directory "#{app['deploy_to']}/shared/#{dir}" do
     owner app['owner']
@@ -172,7 +172,11 @@ deploy_revision app['id'] do
 
   before_migrate do
     if app['gems'].has_key?('bundler')
-      execute "bundle install" do
+      link "#{release_path}/vendor/bundle" do
+        to "#{app['deploy_to']}/shared/vendor_bundle"
+      end
+      common_groups = %w{development test cucumber staging production}
+      execute "bundle install --deployment --without #{(common_groups -([node.app_environment])).join(' ')}" do
         ignore_failure true
         cwd release_path
       end