summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Blanco <slainer68@gmail.com>2010-08-07 22:05:04 +0200
committerCarl Lerche <carllerche@mac.com>2010-08-09 10:38:56 -0700
commit23c05cf2bf7b25c76806119734ee727584d1f9cd (patch)
tree5dd9e926d0ce8a88f6b2ee684fd5bf13fcbacf00
parent6baa8ee4818c0887ed78179470b7f063a240a3ae (diff)
downloadbundler-23c05cf2bf7b25c76806119734ee727584d1f9cd.tar.gz
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.
Signed-off-by: Carl Lerche <carllerche@mac.com>
-rw-r--r--lib/bundler/capistrano.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/bundler/capistrano.rb b/lib/bundler/capistrano.rb
new file mode 100644
index 0000000000..9d94745ba3
--- /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