Skip to content

Instantly share code, notes, and snippets.

@BenHall
Created November 16, 2009 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save BenHall/236148 to your computer and use it in GitHub Desktop.
Save BenHall/236148 to your computer and use it in GitHub Desktop.
How to install RubyGems via an automated ruby script
#!c:/ruby/bin/ruby.exe
require 'rubygems'
require 'rubygems/gem_runner'
require 'rubygems/exceptions'
def install(lib)
begin
Gem::GemRunner.new.run ['install', lib]
rescue Gem::SystemExitException => e
end
end
puts "Installing required dependencies"
install 'aws-s3'
puts "Checking dependencies"
require 'aws/s3'
#Taken from gem file
required_version = Gem::Requirement.new "> 1.8.3"
unless required_version.satisfied_by? Gem.ruby_version then
abort "Expected Ruby Version #{required_version}, was #{Gem.ruby_version}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment