Skip to content

Instantly share code, notes, and snippets.

@prabirshrestha
Created October 16, 2010 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prabirshrestha/629826 to your computer and use it in GitHub Desktop.
Save prabirshrestha/629826 to your computer and use it in GitHub Desktop.
ruby gems install dependencies
require 'rubygems'
require 'rubygems/gem_runner'
require 'rubygems/exceptions'
required_version = Gem::Requirement.new "> 1.8.5"
unless required_version.satisfied_by? Gem.ruby_version then
abort "Expected Ruby Version #{required_version}, was #{Gem.ruby_version}"
end
def install(lib)
begin
matches = Gem.source_index.find_name(lib)
if matches.empty?
puts "Installing #{lib}"
Gem::GemRunner.new.run ['install', lib]
else
puts "Found #{lib} gem - skipping"
end
rescue Gem::SystemExitException => e
end
end
gems = ['rake','net-ssh','net-sftp','rubyzip']
puts "Installing required dependencies"
gems.each { |gem| install gem}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment