Sha256: 5f3ab597aff11ddbde456a5e3a3a244042e33a4f9c7c4173025cd054bcf7e9a3
Contents?: true
Size: 1010 Bytes
Versions: 6
Compression:
Stored size: 1010 Bytes
Contents
require 'dply/helper' module Dply class Yum include Helper def initialize(pkgs, sudo: false) if pkgs.is_a? Set @pkgs = pkgs.to_a else @pkgs = pkgs end @sudo = sudo end 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 def installed? not_installed_pkgs.size == 0 end private def pkgs_str @pkgs.join " " end def not_installed_pkgs @not_installed_pkgs ||= query_not_installed end def query_not_installed return [] if pkgs_str.strip.empty? command = "rpm -V --noscripts --nodeps --nofiles #{pkgs_str}" matches = `#{command}`.scan(/^package (.*) is not installed$/) end end end
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
dply-0.2.3 | lib/dply/yum.rb |
dply-0.2.2 | lib/dply/yum.rb |
dply-0.2.0 | lib/dply/yum.rb |
dply-0.1.19 | lib/dply/yum.rb |
dply-0.1.18 | lib/dply/yum.rb |
dply-0.1.17 | lib/dply/yum.rb |