public

  • Download Gist
.gems version of rake gems:install.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
namespace :gems do
desc "Install missing gem dependencies"
task :install do
File.read("#{File.dirname(__FILE__)}/.gems").each do |gem_decl|
gem_name, version, source = gem_decl[/^([^\s]+)/,1], gem_decl[/--version ([^\s]+)/,1], gem_decl[/--source ([^\s]+)/,1]
begin
version ? gem(gem_name, version) : gem(gem_name)
rescue Gem::LoadError
puts "Installing #{gem_name} #{version}..."
cmd = "gem install #{gem_name}"
cmd += " --version #{version}" if version
cmd += " --source #{source}" if source
puts `#{cmd}`
end
end
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.