lib/rconf/support/package_installer.rb in rconf-0.6.35 vs lib/rconf/support/package_installer.rb in rconf-0.7.0

- old
+ new

@@ -32,11 +32,12 @@ # If no block is given then installation will always occur. # # === Return # true:: Always return true def install(packages, opts=nil, &install_check) - packages = [ packages ].flatten + packages = [ packages ].flatten.compact + return true if packages.empty? report = opts && opts.delete(:report) must_install = true if install_check report_check("Checking for #{packages.join(', ')}") if report must_install = install_check.call @@ -56,12 +57,11 @@ # # === Return # true:: Always return true def install_linux_ubuntu(packages, opts) return if packages.nil? - args = packages.compact.dup - return if args.empty? + args = packages.dup args << opts if opts Command.sudo('apt-get', 'install', '-y', *args) end alias :install_linux_debian :install_linux_ubuntu @@ -69,12 +69,11 @@ # # === Return # true:: Always return true def install_linux_centos(packages, opts) return if packages.nil? - args = packages.compact.dup - return if args.empty? + args = packages.dup args << opts if opts Command.sudo('yum', 'install', '-y', *args) end alias :install_linux_redhat :install_linux_centos @@ -83,10 +82,10 @@ # === Return # true:: Always return true def install_darwin(packages, opts) return if packages.nil? BrewInstaller.check_and_install - packages.compact.each do |p| + packages.each do |p| args = [ p ] args << opts if opts Command.execute('brew', 'install', *args) end end