Permalink
Browse files

Have all the tests running off a single Gemfile

  • Loading branch information...
1 parent a5c82a9 commit 4f6d6f7031a88b647814fc0154e6b69b636dc912 Yehuda Katz + Carl Lerche committed Oct 20, 2009
View
@@ -27,10 +27,6 @@ railties/guides/output
*.rbc
*.swp
*.swo
-actionpack/bin
-activerecord/bin
+bin
vendor/gems/
-*/vendor/gems/
railties/tmp
-activerecord/vendor
-actionpack/vendor
View
21 Gemfile
@@ -0,0 +1,21 @@
+Gem.sources.each { |uri| source uri }
+
+gem "rails", "3.0.pre", :vendored_at => "railties"
+%w(
+ activesupport
+ activemodel
+ actionpack
+ actionmailer
+ activerecord
+ activeresource
+).each do |lib|
+ gem lib, '3.0.pre', :vendored_at => lib
+end
+gem "rack", "1.0.1"
+gem "rack-mount", :git => "git://github.com/josh/rack-mount.git"
+gem "rack-test", "~> 0.5.0"
+gem "erubis", "~> 2.6.0"
+gem "arel", :git => "git://github.com/rails/arel.git"
+gem "mocha"
+gem "sqlite3-ruby"
+gem "RedCloth"
View
@@ -1,10 +0,0 @@
-Gem.sources.each { |uri| source uri }
-sibling = "#{File.dirname(__FILE__)}/.."
-
-gem "activesupport", "3.0.pre", :vendored_at => "#{sibling}/activesupport"
-gem "activemodel", "3.0.pre", :vendored_at => "#{sibling}/activemodel"
-gem "actionpack", "3.0.pre", :vendored_at => "#{sibling}/actionpack"
-gem "rack-mount", :git => "git://github.com/josh/rack-mount.git"
-gem "mocha"
-
-#disable_system_gems
@@ -1,15 +1,15 @@
-bundled = "#{File.dirname(__FILE__)}/../vendor/gems/environment"
-if File.exist?("#{bundled}.rb")
- require bundled
-else
- $:.unshift "#{File.dirname(__FILE__)}/../../activesupport/lib"
- $:.unshift "#{File.dirname(__FILE__)}/../../actionpack/lib"
+root = File.expand_path('../../..', __FILE__)
+begin
+ require "#{root}/vendor/gems/environment"
+rescue LoadError
+ $:.unshift("#{root}/activesupport/lib")
+ $:.unshift("#{root}/actionpack/lib")
+ $:.unshift("#{root}/actionmailer/lib")
end
require 'rubygems'
require 'test/unit'
-$:.unshift "#{File.dirname(__FILE__)}/../lib"
require 'action_mailer'
require 'action_mailer/test_case'
View
@@ -1,18 +0,0 @@
-rails_root = Pathname.new(File.dirname(__FILE__)).join("..")
-
-Gem.sources.each { |uri| source uri }
-
-gem "rack", "1.0.1", :git => "git://github.com/rails/rack.git", :branch => "rack-1.0"
-gem "rack-mount", :git => "git://github.com/josh/rack-mount.git"
-gem "rack-test", "~> 0.5.0"
-gem "activesupport", "3.0.pre", :vendored_at => rails_root.join("activesupport")
-gem "activemodel", "3.0.pre", :vendored_at => rails_root.join("activemodel")
-gem "arel", :git => "git://github.com/rails/arel.git"
-gem "activerecord", "3.0.pre", :vendored_at => rails_root.join("activerecord")
-gem "erubis", "~> 2.6.0"
-
-gem "mocha"
-gem "sqlite3-ruby"
-gem "RedCloth"
-
-disable_system_gems
@@ -1,13 +1,12 @@
-bundled = "#{File.dirname(__FILE__)}/../vendor/gems/environment"
-if File.exist?("#{bundled}.rb")
- require bundled
-else
- $:.unshift "#{File.dirname(__FILE__)}/../../activesupport/lib"
- $:.unshift "#{File.dirname(__FILE__)}/../../activemodel/lib"
+root = File.expand_path('../../..', __FILE__)
+begin
+ require "#{root}/vendor/gems/environment"
+rescue LoadError
+ $:.unshift "#{root}/activesupport/lib"
+ $:.unshift "#{root}/activemodel/lib"
+ $:.unshift "#{root}/lib"
end
-$:.unshift(File.dirname(__FILE__) + '/../lib')
-
$:.unshift(File.dirname(__FILE__) + '/lib')
$:.unshift(File.dirname(__FILE__) + '/fixtures/helpers')
$:.unshift(File.dirname(__FILE__) + '/fixtures/alternate_helpers')
View
@@ -1,12 +0,0 @@
-rails_root = Pathname.new(File.dirname(__FILE__)).join("..")
-
-Gem.sources.each { |uri| source uri }
-
-gem "activesupport", "3.0.pre", :vendored_at => rails_root.join("activesupport")
-gem "arel", :git => "git://github.com/rails/arel.git"
-
-only :test do
- gem "sqlite3-ruby"
-end
-
-disable_system_gems
@@ -1,13 +1,12 @@
-bundled = "#{File.dirname(__FILE__)}/../vendor/gems/environment"
-if File.exist?("#{bundled}.rb")
- require bundled
-else
- $:.unshift(File.dirname(__FILE__) + '/../../lib')
- $:.unshift(File.dirname(__FILE__) + '/../../../activesupport/lib')
+root = File.expand_path('../../../..', __FILE__)
+begin
+ require "#{root}/vendor/gems/environment"
+rescue LoadError
+ $:.unshift("#{root}/activesupport/lib")
+ $:.unshift("#{root}/activemodel/lib")
end
require 'config'
-
require 'active_model'
# Show backtraces for deprecated behavior for quicker cleanup.
View
@@ -1,8 +0,0 @@
-Gem.sources.each { |uri| source uri }
-sibling = "#{File.dirname(__FILE__)}/.."
-
-gem "activesupport", "3.0.pre", :vendored_at => "#{sibling}/activesupport"
-gem "activemodel", "3.0.pre", :vendored_at => "#{sibling}/activemodel"
-gem "arel", :git => "git://github.com/rails/arel.git"
-
-gem "mocha"
@@ -1,10 +1,9 @@
-$:.unshift(File.dirname(__FILE__) + '/../../lib')
-
-bundled = "#{File.dirname(__FILE__)}/../../vendor/gems/environment"
-if File.exist?("#{bundled}.rb")
- require bundled
-else
- $:.unshift(File.dirname(__FILE__) + '/../../../activesupport/lib')
+root = File.expand_path('../../../..', __FILE__)
+begin
+ require "#{root}/vendor/gems/environment"
+rescue LoadError
+ $:.unshift("#{root}/activesupport/lib")
+ $:.unshift("#{root}/activerecord/lib")
end
require 'config'
@@ -1,9 +1,15 @@
+root = File.expand_path('../../..', __FILE__)
+begin
+ require "#{root}/vendor/gems/environment"
+rescue LoadError
+ $:.unshift("#{root}/activesupport/lib")
+ $:.unshift("#{root}/activeresource/lib")
+end
+
require 'rubygems'
require 'test/unit'
require 'active_support'
require 'active_support/test_case'
-
-$:.unshift "#{File.dirname(__FILE__)}/../lib"
require 'active_resource'
$:.unshift "#{File.dirname(__FILE__)}/../test"
@@ -1,5 +1,3 @@
-require "active_support/core_ext/load_error"
-
module ActiveSupport
module Testing
class ProxyTestResult
@@ -1,3 +1,5 @@
+require 'pathname'
+
def ActiveSupport.requirable?(file)
$LOAD_PATH.any? { |p| Dir.glob("#{p}/#{file}.*").any? }
end
@@ -10,7 +12,8 @@ def ActiveSupport.requirable?(file)
gem lib, "~> #{version}"
# Use the vendored lib if the gem's missing or we aren't using RubyGems.
rescue LoadError, NoMethodError
- $LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/vendor/#{lib}-#{version}/lib")
+ # There could be symlinks
+ $LOAD_PATH.unshift Pathname.new(__FILE__).dirname.join("vendor/#{lib}-#{version}/lib").realpath.to_s
end
end
end
@@ -1,4 +1,12 @@
ORIG_ARGV = ARGV.dup
+root = File.expand_path('../../..', __FILE__)
+begin
+ require "#{root}/vendor/gems/environment"
+rescue LoadError
+ $:.unshift("#{root}/activesupport/lib")
+ $:.unshift("#{root}/activerecord/lib")
+end
+
require 'test/unit'
@@ -11,7 +19,6 @@
end
ENV['NO_RELOAD'] = '1'
-$:.unshift "#{File.dirname(__FILE__)}/../lib"
require 'active_support'
require 'active_support/test_case'
View
@@ -1,13 +0,0 @@
-Gem.sources.each { |uri| source uri }
-sibling = "#{File.dirname(__FILE__)}/.."
-
-gem "mocha"
-
-gem "arel", :git => "git://github.com/rails/arel.git"
-gem "rack", "1.0.1", :git => "git://github.com/rails/rack.git", :branch => "rack-1.0"
-gem "rack-mount", :git => "git://github.com/josh/rack-mount.git"
-gem "rack-test", "~> 0.5.0"
-
-%w(activesupport activemodel actionpack actionmailer activerecord activeresource).each do |lib|
- gem lib, '3.0.pre', :vendored_at => "#{sibling}/#{lib}"
-end
@@ -1,16 +1,15 @@
ORIG_ARGV = ARGV.dup
-bundled = "#{File.dirname(__FILE__)}/../vendor/gems/environment"
-if File.exist?("#{bundled}.rb")
- require bundled
-else
- %w(activesupport activemodel activerecord actionpack actionmailer activeresource).each do |lib|
- $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../../#{lib}/lib"
+root = File.expand_path('../../..', __FILE__)
+begin
+ require "#{root}/vendor/gems/environment"
+rescue LoadError
+ %w(activesupport activemodel activerecord actionpack actionmailer activeresource railties).each do |lib|
+ $:.unshift "#{root}/#{lib}/lib"
end
end
-$:.unshift File.dirname(__FILE__) + "/../lib"
-$:.unshift File.dirname(__FILE__) + "/../builtin/rails_info"
+$:.unshift "#{root}/railties/builtin/rails_info"
require 'stringio'
require 'test/unit'
@@ -82,26 +82,6 @@ module Zoo::ReptileHouse ; end
end
end
- test "action_pack is added to the load path if action_controller is required" do
- Rails::Initializer.run do |config|
- config.root = app_path
- config.frameworks = [:action_controller]
- end
- Rails.initialize!
-
- assert $:.include?("#{framework_path}/actionpack/lib")
- end
-
- test "action_pack is added to the load path if action_view is required" do
- Rails::Initializer.run do |config|
- config.root = app_path
- config.frameworks = [:action_view]
- end
- Rails.initialize!
-
- assert $:.include?("#{framework_path}/actionpack/lib")
- end
-
test "after_initialize block works correctly" do
Rails::Initializer.run do |config|
config.root = app_path
@@ -6,7 +6,6 @@
#
# It is also good to know what is the bare minimum to get
# Rails booted up.
-
require 'fileutils'
# TODO: Remove rubygems when possible
@@ -82,6 +81,7 @@ module Generation
def build_app(options = {})
FileUtils.rm_rf(app_path)
FileUtils.cp_r(tmp_path('app_template'), app_path)
+ FileUtils.ln_s(RAILS_FRAMEWORK_ROOT, app_path('vendor/rails'))
# Delete the initializers unless requested
unless options[:initializers]
@@ -114,13 +114,10 @@ def controller(name, contents)
end
def boot_rails
- bundled = "#{File.dirname(__FILE__)}/../../vendor/gems/environment"
- if File.exist?("#{bundled}.rb")
- require bundled
- %w(railties railties/lib).each do |path|
- $LOAD_PATH.unshift File.expand_path("../../../../#{path}", __FILE__)
- end
- else
+ root = File.expand_path('../../../..', __FILE__)
+ begin
+ require "#{root}/vendor/gems/environment"
+ rescue LoadError
%w(
actionmailer/lib
actionpack/lib
@@ -131,8 +128,7 @@ def boot_rails
railties/lib
railties
).reverse_each do |path|
- path = File.expand_path("../../../../#{path}", __FILE__)
- $:.unshift(path)
+ $:.unshift "#{root}/#{path}"
end
end
end
@@ -155,5 +151,6 @@ class Test::Unit::TestCase
end
FileUtils.mkdir(tmp_path)
- `#{Gem.ruby} #{RAILS_FRAMEWORK_ROOT}/railties/bin/rails #{tmp_path('app_template')}`
+ root = File.expand_path('../../../..', __FILE__)
+ `#{Gem.ruby} -r #{root}/vendor/gems/environment #{RAILS_FRAMEWORK_ROOT}/railties/bin/rails #{tmp_path('app_template')}`
end

0 comments on commit 4f6d6f7

Please sign in to comment.