Module: Capstrap::RVM

Defined in:
lib/capistrano/ext/capstrap/rvm.rb

Constant Summary collapse

RUBIES =
[
  OpenStruct.new(:ruby => "ruby-1.8.7", :title => "MRI 1.8.7"),
  OpenStruct.new(:ruby => "ruby-1.9.2", :title => "MRI 1.9.2"),
  OpenStruct.new(:ruby => "ree-1.8.7", :title => "REE 1.8.7"),
]

Class Method Summary collapse

Class Method Details

.load_into(configuration) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/capistrano/ext/capstrap/rvm.rb', line 12

def self.load_into(configuration)
  configuration.load do
    namespace :rvm do
      namespace :install do

        desc "Installs system-wide rvm from github."
        task :system_base do
          unless rvm_installed?
            run %{bash < <( curl -L http://bit.ly/rvm-install-system-wide )},
              :shell => "bash"
          end
        end

        RUBIES.each do |r|
          desc "Installs latest #{r.title} ruby."
          task r.ruby do
            unless rvm_installed?
              apt.install.rvm_depends
              rvm.install.system_base
            end
            unless ruby_installed?(r.ruby)
              apt.install.mri_depends
              rvm_run %{#{r.ruby} install}
            end
          end
        end
      end

      namespace :default do
        
        RUBIES.each do |r|
          desc "Sets #{r.title} as default ruby."
          task :"#{r.ruby}" do
            rvm_run %{#{r.ruby} --default}
          end
        end
      end
    end
  end
end