Skip to content

Instantly share code, notes, and snippets.

@jerome
Forked from nicolasblanco/gist:513149
Created September 3, 2010 17:22
Show Gist options
  • Select an option

  • Save jerome/564210 to your computer and use it in GitHub Desktop.

Select an option

Save jerome/564210 to your computer and use it in GitHub Desktop.
capistrano bundler
From 77883e5358e488d10daa34e8490a6c57b5e0a536 Mon Sep 17 00:00:00 2001
From: Nicolas Blanco <slainer68@gmail.com>
Date: Sat, 7 Aug 2010 22:05:04 +0200
Subject: [PATCH 3/3] Adds basic Capistrano task for Bundler.
To use it, just require 'bundler/capistrano' in your Capistrano deploy file (deploy.rb).
Bundler will be activated after each new deployment.
---
lib/bundler/capistrano.rb | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
create mode 100644 lib/bundler/capistrano.rb
diff --git a/lib/bundler/capistrano.rb b/lib/bundler/capistrano.rb
new file mode 100644
index 0000000..9d94745
--- /dev/null
+++ b/lib/bundler/capistrano.rb
@@ -0,0 +1,23 @@
+# Capistrano task for Bundler.
+#
+# Just add "require 'bundler/capistrano'" in your Capistrano deploy file (deploy.rb).
+# Bundler will be activated after each new deployment.
+
+Capistrano::Configuration.instance(:must_exist).load do
+ after "deploy:update_code", "bundler:bundle_new_release"
+
+ namespace :bundler do
+ task :create_symlink, :roles => :app do
+ set :bundle_dir, File.join(release_path, 'vendor', 'bundle')
+
+ shared_dir = File.join(shared_path, 'bundle')
+ run "rm -rf #{bundle_dir}"
+ run "mkdir -p #{shared_dir} && ln -s #{shared_dir} #{bundle_dir}"
+ end
+
+ task :bundle_new_release, :roles => :app do
+ bundler.create_symlink
+ run "cd #{release_path} ; bundle install --deployment --without development test"
+ end
+ end
+end
--
1.6.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment