Class: Cuoco::Bootstrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/cuoco/bootstrapper.rb

Constant Summary collapse

BOOTSTRAP_COMMAND =
"\
  if ! command -v chef-solo &>/dev/null;\
  then\
    INSTALL_COMMAND;
    if ! command -v chef-solo &>/dev/null;\
    then\
      false;\
    else\
      true;\
    fi;\
  else\
    true;\
  fi\
".gsub(/ +/,' ')
DEFAULT_INSTALL_COMMAND =
"
  if command -v curl &>/dev/null;
  then
    curl -L http://opscode.com/chef/install.sh | sudo -p \"sudo password: \" bash;\
  else
    wget -q -O - http://opscode.com/chef/install.sh | sudo -p \"sudo password: \" bash;\
  fi\
"

Instance Method Summary collapse

Constructor Details

#initialize(capistrano) ⇒ Bootstrapper

Returns a new instance of Bootstrapper.



27
28
29
30
31
# File 'lib/cuoco/bootstrapper.rb', line 27

def initialize(capistrano)
  @cap = capistrano

  @install_command = @cap.fetch(:chef_install_command, DEFAULT_INSTALL_COMMAND)
end

Instance Method Details

#bootstrapObject



33
34
35
# File 'lib/cuoco/bootstrapper.rb', line 33

def bootstrap
  @cap.run(BOOTSTRAP_COMMAND.gsub('INSTALL_COMMAND', @install_command), :shell => '/bin/bash')
end