Sha256: 64a838133551a4a93cb9f5459128d1242eae08e6aab97c1d190df3085651e929
Contents?: true
Size: 811 Bytes
Versions: 14
Compression:
Stored size: 811 Bytes
Contents
require_relative 'helper' module Dply module Yum extend Helper def self.install(pkgs) return if installed?(pkgs) cmd install_command(pkgs) not_installed = not_installed(pkgs) if not_installed.size != 0 error "following pkgs not installed: #{not_installed.join(" ")}" end end def self.installed?(pkgs) not_installed(pkgs).size == 0 end class << self private def not_installed(pkgs) return [] if pkgs.empty? command = %w(rpm -V --noscripts --nodeps --nofiles) command.concat pkgs out = IO.popen(command).read out.scan(/^package (.*) is not installed$/).flatten end def install_command(pkgs) %w(yum install -y).concat(not_installed pkgs) end end end end
Version data entries
14 entries across 14 versions & 1 rubygems