Skip to content

Commit

Permalink
Harmonize framework require strategy. Don't add self to load path sin…
Browse files Browse the repository at this point in the history
…ce Rails initializer and RubyGems handle it.
  • Loading branch information
jeremy committed Aug 26, 2008
1 parent b7a37b7 commit 172606e
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 38 deletions.
12 changes: 6 additions & 6 deletions actionmailer/lib/action_mailer.rb
Expand Up @@ -21,13 +21,13 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++

unless defined?(ActionController)
begin
$:.unshift "#{File.dirname(__FILE__)}/../../actionpack/lib"
begin
require 'action_controller'
rescue LoadError
actionpack_path = "#{File.dirname(__FILE__)}/../../actionpack/lib"
if File.directory?(actionpack_path)
$:.unshift actionpack_path
require 'action_controller'
rescue LoadError
require 'rubygems'
gem 'actionpack', '>= 1.12.5'
end
end

Expand Down
15 changes: 6 additions & 9 deletions actionpack/lib/action_controller.rb
Expand Up @@ -21,16 +21,13 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++

$:.unshift(File.dirname(__FILE__)) unless
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))

unless defined?(ActiveSupport)
begin
$:.unshift "#{File.dirname(__FILE__)}/../../activesupport/lib"
begin
require 'active_support'
rescue LoadError
activesupport_path = "#{File.dirname(__FILE__)}/../../activesupport/lib"
if File.directory?(activesupport_path)
$:.unshift activesupport_path
require 'active_support'
rescue LoadError
require 'rubygems'
gem 'activesupport'
end
end

Expand Down
11 changes: 10 additions & 1 deletion actionpack/lib/action_view.rb
Expand Up @@ -21,6 +21,15 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++

begin
require 'active_support'
rescue LoadError
activesupport_path = "#{File.dirname(__FILE__)}/../../activesupport/lib"
if File.directory?(activesupport_path)
$:.unshift activesupport_path
require 'active_support'
end
end

require 'action_view/template_handlers'
require 'action_view/renderable'
Expand All @@ -35,7 +44,7 @@
require 'action_view/template_error'

I18n.backend.populate do
I18n.load_translations File.dirname(__FILE__) + '/action_view/locale/en-US.yml'
I18n.load_translations "#{File.dirname(__FILE__)}/action_view/locale/en-US.yml"
end

require 'action_view/helpers'
Expand Down
17 changes: 7 additions & 10 deletions activerecord/lib/active_record.rb
Expand Up @@ -21,17 +21,14 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++

$:.unshift(File.dirname(__FILE__)) unless
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))

active_support_path = File.dirname(__FILE__) + "/../../activesupport/lib"
if File.exist?(active_support_path)
$:.unshift active_support_path
require 'active_support'
else
require 'rubygems'
gem 'activesupport'
begin
require 'active_support'
rescue LoadError
activesupport_path = "#{File.dirname(__FILE__)}/../../activesupport/lib"
if File.directory?(activesupport_path)
$:.unshift activesupport_path
require 'active_support'
end
end

require 'active_record/base'
Expand Down
17 changes: 7 additions & 10 deletions activeresource/lib/active_resource.rb
Expand Up @@ -21,16 +21,13 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++

$:.unshift(File.dirname(__FILE__)) unless
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))

unless defined?(ActiveSupport)
begin
$:.unshift(File.dirname(__FILE__) + "/../../activesupport/lib")
begin
require 'active_support'
rescue LoadError
activesupport_path = "#{File.dirname(__FILE__)}/../../activesupport/lib"
if File.directory?(activesupport_path)
$:.unshift activesupport_path
require 'active_support'
rescue LoadError
require 'rubygems'
gem 'activesupport'
end
end

Expand All @@ -44,4 +41,4 @@ module ActiveResource
include Validations
include CustomMethods
end
end
end
2 changes: 0 additions & 2 deletions activesupport/lib/active_support.rb
Expand Up @@ -21,8 +21,6 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++

$:.unshift(File.dirname(__FILE__))

require 'active_support/vendor'
require 'active_support/basic_object'
require 'active_support/inflector'
Expand Down

0 comments on commit 172606e

Please sign in to comment.