diff --git a/.gitignore b/.gitignore index ea0d8bbba774651e63b99de448db036594dac8eb..3b922f29f743bf8c477ae3f70976be3a27eda38f 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000000000000000000000000000000000000..ba55d96783be6e8beba0d1671d00e47251ace7f4 --- /dev/null +++ b/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" \ No newline at end of file diff --git a/actionmailer/Gemfile b/actionmailer/Gemfile deleted file mode 100644 index 430b32e8ca28946726e8cdb90b868aa5a769f728..0000000000000000000000000000000000000000 --- a/actionmailer/Gemfile +++ /dev/null @@ -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 diff --git a/actionmailer/test/abstract_unit.rb b/actionmailer/test/abstract_unit.rb index 78436239969994593b5d1f2faec022da0b181901..fcbaa9e186e969d0ff80cac0c92d3164aa687ec6 100644 --- a/actionmailer/test/abstract_unit.rb +++ b/actionmailer/test/abstract_unit.rb @@ -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' diff --git a/actionpack/Gemfile b/actionpack/Gemfile deleted file mode 100644 index af95766608cf6977c4ff73d4c6e8525cdce8bad0..0000000000000000000000000000000000000000 --- a/actionpack/Gemfile +++ /dev/null @@ -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 diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index f7a1564f907a6f1e3c28f610966db5691e38c0e9..05b15d38ee0fe8e5c054ea2d6888864401cf9be8 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -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') diff --git a/activemodel/Gemfile b/activemodel/Gemfile deleted file mode 100644 index a192fdaf829a84d40b5fe63fba3f475466d06a3c..0000000000000000000000000000000000000000 --- a/activemodel/Gemfile +++ /dev/null @@ -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 diff --git a/activemodel/test/cases/helper.rb b/activemodel/test/cases/helper.rb index e54c85938b83e64fa9488e752cd5685419706a20..49783c27357f3d64a96dc1ac0a94a6a6d8bbf2f9 100644 --- a/activemodel/test/cases/helper.rb +++ b/activemodel/test/cases/helper.rb @@ -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. diff --git a/activerecord/Gemfile b/activerecord/Gemfile deleted file mode 100644 index 3201e65f02563f40ef98c1f1d6da575e5e6b8b30..0000000000000000000000000000000000000000 --- a/activerecord/Gemfile +++ /dev/null @@ -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" diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 63014c0297991fa3ffb032948cbf8826b0da7c03..871cfa646880c9b0af8905f038e82ed516024f38 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -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' diff --git a/activeresource/test/abstract_unit.rb b/activeresource/test/abstract_unit.rb index 6a33040243954ed3c9e0874c593eceb460f19061..ee12f785b5cd49a4332a13926698af05a751aa2a 100644 --- a/activeresource/test/abstract_unit.rb +++ b/activeresource/test/abstract_unit.rb @@ -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" diff --git a/activesupport/lib/active_support/testing/isolation.rb b/activesupport/lib/active_support/testing/isolation.rb index 8f7d1c29a9a7de58b35bf1874098501b36ea79c1..c75b59c284e77dd91dac30196b145bf54ec23e6b 100644 --- a/activesupport/lib/active_support/testing/isolation.rb +++ b/activesupport/lib/active_support/testing/isolation.rb @@ -1,5 +1,3 @@ -require "active_support/core_ext/load_error" - module ActiveSupport module Testing class ProxyTestResult diff --git a/activesupport/lib/active_support/vendor.rb b/activesupport/lib/active_support/vendor.rb index 9f464c82465ef890f1b8391e2dd0a714ca27a553..0f9b0c7554d3b4574bdee29bd149160a7776a51e 100644 --- a/activesupport/lib/active_support/vendor.rb +++ b/activesupport/lib/active_support/vendor.rb @@ -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 diff --git a/activesupport/test/abstract_unit.rb b/activesupport/test/abstract_unit.rb index af9656615cbd91f5959a3668fc6b541b8e7e56dd..f390c66838cccf688196a0ce9bbf1b7fd1c59144 100644 --- a/activesupport/test/abstract_unit.rb +++ b/activesupport/test/abstract_unit.rb @@ -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' diff --git a/railties/Gemfile b/railties/Gemfile deleted file mode 100644 index c441d69ded8c3f8f3478798052395dfb21fdc887..0000000000000000000000000000000000000000 --- a/railties/Gemfile +++ /dev/null @@ -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 diff --git a/railties/test/abstract_unit.rb b/railties/test/abstract_unit.rb index 7977b45a572e9bbcbe01ea544e9f058686efd5eb..47013d7797b6ede20cb158c4137e7ec6a33fbe48 100644 --- a/railties/test/abstract_unit.rb +++ b/railties/test/abstract_unit.rb @@ -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' diff --git a/railties/test/application/initializer_test.rb b/railties/test/application/initializer_test.rb index f42954079bf56f6b78d7c95006eed41f43038766..719520bf68f40b8ab59dd6de8a97b476d9cdf6f8 100644 --- a/railties/test/application/initializer_test.rb +++ b/railties/test/application/initializer_test.rb @@ -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 diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb index 557292e7d3968766a2ff1a9a26f7d09761c5b0e1..11cabb2c0b13b916027294a53860510d94b57eb0 100644 --- a/railties/test/isolation/abstract_unit.rb +++ b/railties/test/isolation/abstract_unit.rb @@ -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