rspreadsheet.gemspec in rspreadsheet-0.4.1 vs rspreadsheet.gemspec in rspreadsheet-0.4.2

- old
+ new

@@ -16,15 +16,18 @@ spec.files = `git ls-files -z`.split("\x0") spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - def self.package_installed?(pkgname) - system("dpkg-query -l #{pkgname} | grep -q '^i'") + def self.package_natively_installed?(pkgname) + # if the shell fails, the system command returns nil. In that case we assume that the package is NOT installed. It might be overkill, because I am supresing the stderr as well + (system("dpkg-query -l #{pkgname} 2>/dev/null | grep -q '^i'")==true) or # debian based + (system("rpm -qa 2>/dev/null | grep -q '#{pkgname}' ")==true) or # rpm based + (system("pkg_info -q -e #{pkgname} >/dev/null 2>&1")==true) # openbsd and alike end # runtime dependencies - unless package_installed?('ruby-libxml') + unless package_natively_installed?('ruby-libxml') spec.add_runtime_dependency 'libxml-ruby', '~>2.7' # parsing XML files end spec.add_runtime_dependency 'rubyzip', '~>1.1' # opening zip files spec.add_runtime_dependency 'andand', '~>1.3'