Navigation Menu

Skip to content

Commit

Permalink
Use .member? instead of .none? for older ruby
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Smith committed Nov 9, 2010
1 parent 64651ae commit ce27aa2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tasks/lib.rb
Expand Up @@ -50,7 +50,7 @@ def package_dep opts
distro = detect_distro()

distros = opts.delete :distros
if distros && distros.none?{|x| x == distro[0]}
if distros && !distros.member?(distro[0])
puts "#{distro[0]} does not need #{opts.inspect}"
return "/" # Return a file dependency that will presumably always work.
end
Expand All @@ -69,17 +69,17 @@ def package_dep opts
case distro[0]
when :ubuntu, :debian
installed = `dpkg --list`.split("\n").map { |x| x.split[1] } # Hm, this is out of scope if defined outside.
if installed.none? { |pkg| pkg == package }
if !installed.member?(package)
sh "sudo apt-get -y install #{package}"
end
when :solaris
installed = `pkg-get -l`.split("\n")
if installed.none? { |pkg| pkg == package }
if !installed.member?(package)
sh "sudo pkg-get install #{package}"
end
when :osx
installed = `brew list`.split("\n")
if installed.none? { |pkg| pkg == package }
if !installed.member?(package)
sh "sudo brew install #{package}"
end
else
Expand Down

0 comments on commit ce27aa2

Please sign in to comment.