Class: PKGWizard::RPM
- Inherits:
-
Object
- Object
- PKGWizard::RPM
- Defined in:
- lib/pkg-wizard/rpm.rb
Instance Method Summary collapse
-
#initialize(pkg) ⇒ RPM
constructor
A new instance of RPM.
- #source_package_name ⇒ Object
Constructor Details
#initialize(pkg) ⇒ RPM
Returns a new instance of RPM.
11 12 13 14 15 |
# File 'lib/pkg-wizard/rpm.rb', line 11 def initialize(pkg) @pkg = pkg.strip.chomp raise ArgumentError.new("Invalid package.") if pkg !~ /.*\.rpm$/ raise ArgumentError.new("Invalid package.") if not File.exist?(pkg) end |
Instance Method Details
#source_package_name ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/pkg-wizard/rpm.rb', line 17 def source_package_name info = `rpm -qi -qp #{@pkg} 2>/dev/null`.lines info.find do |s| s =~ /Source RPM\s*:(.*)$/ end $1.strip.chomp end |