1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Detect missing dependencies and automatically run bundler

This commit is contained in:
Joshua Peek 2009-09-13 15:10:29 -05:00
parent ef38e67562
commit fff3f0ae0c
4 changed files with 32 additions and 13 deletions

View file

@ -13,7 +13,6 @@ gem 'i18n', '0.1.3', :vendored_at => vendor_dir.join('i18n-0.1.3')
only :test do
gem 'mocha', '>= 0.9.7'
gem 'ruby-prof', '>= 0.6.1'
end
disable_rubygems

View file

@ -28,16 +28,6 @@ task :isolated_test do
end or raise "Failures"
end
task :bundle do
puts "Checking if the bundled testing requirements are up to date..."
result = system "gem bundle"
unless result
puts "The gem bundler is not installed. Installing."
system "gem install bundler"
system "gem bundle"
end
end
# Create compressed packages
dist_dirs = [ "lib", "test"]

View file

@ -1,7 +1,7 @@
ORIG_ARGV = ARGV.dup
bundler = File.join(File.dirname(__FILE__), '..', 'vendor', 'gems', 'environment')
require bundler if File.exist?("#{bundler}.rb")
require 'bundler_helper'
ensure_requirable %w( builder memcache tzinfo mocha )
require 'test/unit'

View file

@ -0,0 +1,30 @@
BUNDLER_ENV_FILE = File.join(File.dirname(__FILE__), '..', 'vendor', 'gems', 'environment')
def load_bundled_gems
load_bundled_gems! if File.exist?("#{BUNDLER_ENV_FILE}.rb")
end
def load_bundled_gems!
puts "Checking if the bundled testing requirements are up to date..."
result = system "gem bundle"
unless result
puts "The gem bundler is not installed. Installing."
system "gem install bundler"
system "gem bundle"
end
require BUNDLER_ENV_FILE
end
def ensure_requirable(libs)
load_bundled_gems
begin
libs.each { |lib| require lib }
rescue LoadError => e
puts "Missing required libs to run test"
puts e.message
load_bundled_gems!
end
end