Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

32 lines (26 sloc) 0.87 kb
require 'rubygems'
require 'rubygems/dependency_installer'
puts "Pre-installing gems for #{RUBY_VERSION}..."
gems = Dir["preinstalled-gems/*.gem"]
options = {
:wrappers => true,
:domain => :local,
:generate_ri => false,
:generate_rdoc => false,
:ignore_dependencies => true,
:conservative => true
}
gems.each do |gem|
parts = File.basename(gem, ".gem").split "-"
gem_name = parts[0..-2].join "-"
gem_version = parts[-1]
name_re = /#{gem_name}/
version_req = Gem::Requirement.create "=#{gem_version}"
unless Gem::Specification.any? { |s| s.name =~ name_re and version_req =~ s.version }
options[:args] = gem
options[:version] = version_req
inst = Gem::DependencyInstaller.new options
inst.install gem, version_req
puts "Installed #{gem_name}-#{gem_version}"
end
end
Jump to Line
Something went wrong with that request. Please try again.