Sha256: 6e25f9b65ebffcba65c1326d7e72ba03f19ce2dc8b1fba9350715bd6f4335101

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 KB

Contents

######################################################################
#                             RVM TASKS                              #
######################################################################
module ChickenSoup
  def run_with_ruby_manager(ruby_env_string, command, options = {})
    run "rvm use #{ruby_env_string} && #{command}", options
  end
end

Capistrano::Configuration.instance(:must_exist).load do
  extend ChickenSoup

  run_task 'ruby:update', :as => manager_username

  namespace :ruby do
    desc <<-DESC
      During the deployment, the wrapper ruby executable used by the
      application server will be switched to utilize the ruby sepecified
      by the application.

      Note: This is only available during a subzero deployment since the web
      server will need to be restarted in order for the changes to take effect.
    DESC
    task :update do
      if ruby_version_update_pending
        after   'ruby:update',    'gems:clean', 'gems:install'

        set     :ruby_version_update_pending,   false

        run("rvm use --create #{full_ruby_environment_string}")
        run("rvm wrapper #{full_ruby_environment_string} #{application_server_type}")
      else
        set     :ruby_version_update_pending,   true
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chicken_soup-0.6.1 lib/chicken_soup/capabilities/rvm/rvm-tasks.rb
chicken_soup-0.6.0 lib/chicken_soup/capabilities/rvm/rvm-tasks.rb