Module: CapistranoDeploy::Rvm

Defined in:
lib/capistrano-deploy/rvm.rb

Class Method Summary collapse

Class Method Details

.load_into(configuration) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/capistrano-deploy/rvm.rb', line 3

def self.load_into(configuration)
  configuration.load do
    set :rvm_ruby_string, 'default'
    set :rvm_path, '/usr/local/rvm'

    set(:rvm_shell_path) { "#{rvm_path}/bin/rvm-shell" }

    set :default_shell do
      shell = rvm_shell_path
      ruby  = rvm_ruby_string.to_s.strip
      shell = "rvm_path=#{rvm_path} #{shell} '#{ruby}'" unless ruby.empty?

      shell
    end

    if File.exists?('.rvmrc')
      matches = File.read('.rvmrc').scan(/^rvm\s+use\s+.*?([\w\-\.]+@[\w\-]+).*$/)
      if matches.any?
        set :rvm_ruby_string, matches.last.first
      end
    end
  end
end