Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 32 lines (26 sloc) 0.87 kb
8029ae3 Brian Shirai Install gems with API instead of using subprocesses.
brixen authored
1 require 'rubygems'
2 require 'rubygems/dependency_installer'
3
4 puts "Pre-installing gems for #{RUBY_VERSION}..."
5
6 gems = Dir["preinstalled-gems/*.gem"]
7 options = {
8 :wrappers => true,
9 :domain => :local,
10 :generate_ri => false,
11 :generate_rdoc => false,
12 :ignore_dependencies => true,
13 :conservative => true
14 }
15
16 gems.each do |gem|
17 parts = File.basename(gem, ".gem").split "-"
18 gem_name = parts[0..-2].join "-"
19 gem_version = parts[-1]
20
21 name_re = /#{gem_name}/
22 version_req = Gem::Requirement.create "=#{gem_version}"
23 unless Gem::Specification.any? { |s| s.name =~ name_re and version_req =~ s.version }
24 options[:args] = gem
25 options[:version] = version_req
26 inst = Gem::DependencyInstaller.new options
27 inst.install gem, version_req
28
29 puts "Installed #{gem_name}-#{gem_version}"
30 end
31 end
Something went wrong with that request. Please try again.