Created
July 9, 2010 13:15
-
-
Save davelyon/469439 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SYSTEM_DEPENDENCIES = ["ruby", "rake", "gem"] | |
GEM_DEPENDENCIES = ["redis", "resque"] | |
def dependency_check(who) | |
if(system("which #{who}")) | |
puts "#{who} installed." | |
else | |
puts "#{who} missing." | |
end | |
end | |
namespace :install do | |
desc "Dependencies: " | |
task :check do | |
SYSTEM_DEPENDENCIES.each { |d| dependency_check(d) } | |
end | |
namespace :dep do | |
task :ubuntu => :check do | |
raise '*** Must run as root ***' unless Process.uid == 0 | |
raise '*** Can\'t find apt-get ***' unless system('which apt-get') | |
system("apt-get install ruby1.8-dev, rake, rubygems, redis") | |
puts "*** FINAL STEPS ***" | |
puts "Strongly suggest adding /var/lib/gems/1.8/gems/bin to path if you wish to use gem executables as root, or for users only add ~/.gem/ruby/1.8/bin/" | |
end | |
end | |
desc "Install everything" | |
task :gems do | |
GEM_DEPENDENCIES.each do |dep| | |
puts "Installing #{dep}" | |
puts system("gem install #{dep} --no-ri --no-rdoc --include-dependencies") | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment