-
-
Save xiangyuan/c9298aa3ad7b1c2e76b9a22a6f0ceb0a to your computer and use it in GitHub Desktop.
How to install RubyGems via an automated ruby script
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
#!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' | |
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
#!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' | |
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
#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 |
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
#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