Class: ServerTools::InstallDebPackage

Inherits:
Object
  • Object
show all
Includes:
SSH
Defined in:
lib/server_tools/install_deb_package.rb

Instance Method Summary collapse

Methods included from SSH

#ssh_opts

Constructor Details

#initialize(hostname, options) ⇒ InstallDebPackage



6
7
8
9
# File 'lib/server_tools/install_deb_package.rb', line 6

def initialize(hostname, options)
  @hostname = hostname
  @options = options
end

Instance Method Details

#copy_commandObject



11
12
13
14
15
16
17
18
19
# File 'lib/server_tools/install_deb_package.rb', line 11

def copy_command
  [
    "rsync -avz",
    %(-e "ssh #{ssh_opts(options)}"),
    "--progress --partial",
    "#{options[:deb_package_file]}",
    "#{options[:ssh_user]}@#{hostname}:~/"
  ].join(' ')
end

#install_commandObject



21
22
23
24
25
26
27
28
29
# File 'lib/server_tools/install_deb_package.rb', line 21

def install_command
  ["ssh #{hostname}", "#{ssh_opts(options)}"].tap do |command|
    if options[:purge_older_version]
      command << %('#{purge_command} && #{_install_command}')
    else
      command << %('#{_install_command}')
    end
  end.join(' ')
end