Skip to content

Instantly share code, notes, and snippets.

@wallymathieu
Forked from BenHall/Automated RubyGem Install
Created September 2, 2011 04:15
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wallymathieu/1187910 to your computer and use it in GitHub Desktop.
Save wallymathieu/1187910 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'
#!c:/ruby/bin/ruby.exe
require 'rubygems'
require 'rubygems/gem_runner'
require 'rubygems/exceptions'
# to run it on ironruby
def install(lib)
begin
matches = Gem.source_index.find_name(lib)
if matches.empty?
puts "Installing #{lib}"
Gem::GemRunner.new.run ['install', lib, "--no-ri", "--no-rdoc"]
else
puts "Found #{lib} gem - skipping"
end
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
#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