Class: Dply::Yum

Inherits:
Object
  • Object
show all
Includes:
Helper
Defined in:
lib/dply/yum.rb

Instance Method Summary collapse

Methods included from Helper

#cmd, #error, #git, #logger, #stringify_values!, #symlink

Constructor Details

#initialize(pkgs, sudo: false) ⇒ Yum

Returns a new instance of Yum.



8
9
10
11
# File 'lib/dply/yum.rb', line 8

def initialize(pkgs, sudo: false)
  @pkgs = pkgs
  @sudo = sudo
end

Instance Method Details

#installObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/dply/yum.rb', line 13

def install
  return if installed?
  command = ""
  command << "sudo -n " if @sudo
  command << "yum install -y #{not_installed_pkgs.join(' ')}"
  cmd command
  not_installed = query_not_installed
  if not_installed.size != 0
    error "following pkgs not installed: #{not_installed.join(" ")}"
  end
end

#installed?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/dply/yum.rb', line 25

def installed?
  not_installed_pkgs.size == 0
end