Class: Blue::RubyInstall

Inherits:
Object
  • Object
show all
Defined in:
lib/capistrano/ruby.rb

Class Method Summary collapse

Class Method Details

.load(capistrano_config) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/capistrano/ruby.rb', line 4

def self.load(capistrano_config)
  capistrano_config.load do

    namespace :blue do
      namespace :setup do
        desc "Install Ruby 1.9.3"
        task :ruby do
          version = "ruby-#{Blue.config.ruby.major_version}-p#{Blue.config.ruby.minor_version}"

          cmd = [
            'sudo apt-get install autoconf libyaml-dev -y || true',
            'cd /tmp',
            "sudo rm -rf #{version}* || true",
            "wget -q http://ftp.ruby-lang.org/pub/ruby/#{version}.tar.gz",
            "tar zxvf #{version}.tar.gz",
            "cd /tmp/#{version}",
            "./configure --prefix=/usr",
            "make",
            "sudo make install"
          ].join(' && ')

          run "test -x /usr/bin/ruby && test #{Blue.config.ruby.major_version}p#{Blue.config.ruby.minor_version} = $(ruby --version | awk '{print $2}') || (#{cmd})"
        end
      end
    end
  end
end