Module: Escualo::Bootstrap

Defined in:
lib/escualo/bootstrap.rb

Class Method Summary collapse

Class Method Details

.check(ssh) ⇒ Object



33
34
35
# File 'lib/escualo/bootstrap.rb', line 33

def self.check(ssh)
  Escualo::Env.present?(ssh, :ESCUALO_BASE_VERSION) && Escualo::Gems.present?(ssh)
end

.enable_swap(ssh) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/escualo/bootstrap.rb', line 22

def self.enable_swap(ssh)
  ssh.exec! %q{ \
    test -e /swapfile ||
    fallocate -l 4G /swapfile && \
    chmod 600 /swapfile && \
    mkswap /swapfile && \
    swapon /swapfile && \
    swapon -s && \
    echo '/swapfile   none    swap    sw    0   0' >> /etc/fstab}
end

.install_ruby(ssh, options) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/escualo/bootstrap.rb', line 3

def self.install_ruby(ssh, options)
  ssh.shell.perform! 'apt-get purge libruby* -y', options
  if options.with_rbenv
    ssh.shell.perform! %q{
      curl https://raw.githubusercontent.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash &&
      echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc &&
      echo 'eval "$(rbenv init -)"' >> ~/.bashrc
    }, options
    ssh.shell.perform! 'rbenv install 2.3.1 && rbenv global 2.3.1 && rbenv rehash', options
  else
    ssh.shell.perform! %Q{
    apt-get install software-properties-common -y &&
    apt-add-repository '#{Escualo::PPA.for 'brightbox/ruby-ng'}' &&
    apt-get update &&
    apt-get install -y ruby2.3 ruby2.3-dev
  }, options
  end
end