-
-
Save bdotdub/259672 to your computer and use it in GitHub Desktop.
This file contains 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
require 'rubygems' | |
dependencies = <<-EOS | |
rack 0.9.1 | |
activesupport >= 2.2.2 | |
daemons >= 1.0.10 | |
djanowski-workling | |
djanowski-collage >= 0.1.3 | |
faker >= 0.3.1 | |
fiveruns-memcache-client >= 1.5.0 | |
haml >= 2.0.5 | |
json >= 1.1.3 | |
mmangino-facebooker >= 1.0.12 | |
postgres >= 0.7.9 | |
quietbacktrace >= 0.1.1 | |
riddle ~> 0.9.8 | |
rr >= 0.6.0 | |
sequel >= 2.8.0 | |
sinatra 0.9.1 | |
soveran-spawner >= 0.0.4 | |
term-ansicolor | |
thoughtbot-shoulda >= 2.0.6 | |
EOS | |
missing = [] | |
dependencies.each_line do |line| | |
next unless line =~ /^([\w\-_]+) ?(.*)?$/ | |
name, version = $1, $2 | |
version = nil if version.empty? | |
vendor_name = name.dup | |
vendor_name << "-#{version[/([\d\.]+)$/, 1]}" if version | |
vendor_path = File.join(File.dirname(__FILE__), 'vendor', "#{vendor_name}*", 'lib') | |
if vendor_path = Dir[vendor_path].first | |
# Vendored gem | |
puts "Vendored gem #{name} #{version} in #{vendor_path}" if $0 == __FILE__ | |
$:.unshift(vendor_path) | |
else | |
# RubyGems | |
begin | |
gem(*[name, version].compact) | |
rescue Gem::LoadError => e | |
$stderr.puts "=> #{e.message}" | |
missing << [name, version] | |
end | |
end | |
end | |
missing.each do |spec| | |
puts "sudo gem install #{spec[0]} #{('-v %s ' % spec[1][/([0-9\.]+)$/] if spec[1])}--no-rdoc --no-ri" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment