lib/polisher/yum.rb in polisher-0.5.1 vs lib/polisher/yum.rb in polisher-0.6.1
- old
+ new
@@ -1,11 +1,11 @@
# Polisher Yum Operations
#
# Licensed under the MIT license
# Copyright (C) 2013 Red Hat, Inc.
-require 'pkgwat'
+require 'awesome_spawn'
module Polisher
class Yum
YUM_CMD = '/usr/bin/yum'
@@ -14,10 +14,12 @@
# @param [String] name name of gem to loopup
# @param [Callable] bl optional callback to invoke with version retrieved
# @returns [String] version of gem in yum or nil if not found
def self.version_for(name, &bl)
version = nil
- out=`#{YUM_CMD} info rubygem-#{name} 2> /dev/null`
+ result = AwesomeSpawn.run "#{YUM_CMD} info rubygem-#{name}"
+ out = result.output
+
if out.include?("Version")
version = out.lines.to_a.find { |l| l =~ /^Version.*/ }
version = version.split(':').last.strip
end
bl.call(:yum, name, [version]) unless(bl.nil?)