diff options
-rw-r--r-- | .gitignore | 6 | ||||
-rw-r--r-- | Gemfile | 21 | ||||
-rw-r--r-- | actionmailer/Gemfile | 10 | ||||
-rw-r--r-- | actionmailer/test/abstract_unit.rb | 14 | ||||
-rw-r--r-- | actionpack/Gemfile | 18 | ||||
-rw-r--r-- | actionpack/test/abstract_unit.rb | 15 | ||||
-rw-r--r-- | activemodel/Gemfile | 12 | ||||
-rw-r--r-- | activemodel/test/cases/helper.rb | 13 | ||||
-rw-r--r-- | activerecord/Gemfile | 8 | ||||
-rw-r--r-- | activerecord/test/cases/helper.rb | 13 | ||||
-rw-r--r-- | activeresource/test/abstract_unit.rb | 10 | ||||
-rw-r--r-- | activesupport/lib/active_support/testing/isolation.rb | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor.rb | 5 | ||||
-rw-r--r-- | activesupport/test/abstract_unit.rb | 9 | ||||
-rw-r--r-- | railties/Gemfile | 13 | ||||
-rw-r--r-- | railties/test/abstract_unit.rb | 15 | ||||
-rw-r--r-- | railties/test/application/initializer_test.rb | 20 | ||||
-rw-r--r-- | railties/test/isolation/abstract_unit.rb | 19 |
18 files changed, 83 insertions, 140 deletions
diff --git a/.gitignore b/.gitignore index ea0d8bbba7..3b922f29f7 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 0000000000..ba55d96783 --- /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 430b32e8ca..0000000000 --- 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 7843623996..fcbaa9e186 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 af95766608..0000000000 --- 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 f7a1564f90..05b15d38ee 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 a192fdaf82..0000000000 --- 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 e54c85938b..49783c2735 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 3201e65f02..0000000000 --- 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 63014c0297..871cfa6468 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 6a33040243..ee12f785b5 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 8f7d1c29a9..c75b59c284 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 9f464c8246..0f9b0c7554 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 @@ end 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 af9656615c..f390c66838 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 @@ rescue LoadError 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 c441d69ded..0000000000 --- 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 7977b45a57..47013d7797 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 f42954079b..719520bf68 100644 --- a/railties/test/application/initializer_test.rb +++ b/railties/test/application/initializer_test.rb @@ -82,26 +82,6 @@ module ApplicationTests 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 557292e7d3..11cabb2c0b 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 TestHelpers 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 @@ module TestHelpers 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 @@ module TestHelpers 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 @@ Module.new do 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 |