aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support.rb8
-rw-r--r--activesupport/lib/active_support/cache/mem_cache_store.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/array/conversions.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/hash/conversions.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/string/xchar.rb2
-rw-r--r--activesupport/lib/active_support/values/time_zone.rb2
-rw-r--r--activesupport/lib/active_support/vendor.rb42
-rw-r--r--activesupport/lib/active_support/vendor/builder.rb6
-rw-r--r--activesupport/lib/active_support/vendor/i18n.rb6
-rw-r--r--activesupport/lib/active_support/vendor/memcache.rb6
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo.rb6
11 files changed, 49 insertions, 35 deletions
diff --git a/activesupport/lib/active_support.rb b/activesupport/lib/active_support.rb
index 4dcb6191df..3372fb853a 100644
--- a/activesupport/lib/active_support.rb
+++ b/activesupport/lib/active_support.rb
@@ -37,11 +37,5 @@ end
require 'active_support/autoload'
require 'active_support/vendor'
-begin
- require 'i18n'
-rescue LoadError
- $: << File.expand_path(File.join(File.dirname(__FILE__), 'active_support/vendor/i18n-0.1.3/lib'))
- retry
-end
-
+require 'active_support/vendor/i18n'
I18n.load_path << "#{File.dirname(__FILE__)}/active_support/locale/en.yml"
diff --git a/activesupport/lib/active_support/cache/mem_cache_store.rb b/activesupport/lib/active_support/cache/mem_cache_store.rb
index 96a8000778..7c97b05261 100644
--- a/activesupport/lib/active_support/cache/mem_cache_store.rb
+++ b/activesupport/lib/active_support/cache/mem_cache_store.rb
@@ -1,4 +1,4 @@
-require 'memcache'
+require 'active_support/vendor/memcache'
module ActiveSupport
module Cache
diff --git a/activesupport/lib/active_support/core_ext/array/conversions.rb b/activesupport/lib/active_support/core_ext/array/conversions.rb
index c53cf3f530..0743ab181e 100644
--- a/activesupport/lib/active_support/core_ext/array/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/array/conversions.rb
@@ -157,7 +157,7 @@ class Array
#
def to_xml(options = {})
raise "Not all elements respond to to_xml" unless all? { |e| e.respond_to? :to_xml }
- require 'builder' unless defined?(Builder)
+ require 'active_support/vendor/builder' unless defined?(Builder)
options = options.dup
options[:root] ||= all? { |e| e.is_a?(first.class) && first.class.to_s != "Hash" } ? ActiveSupport::Inflector.pluralize(ActiveSupport::Inflector.underscore(first.class.name)) : "records"
diff --git a/activesupport/lib/active_support/core_ext/hash/conversions.rb b/activesupport/lib/active_support/core_ext/hash/conversions.rb
index bd9419e1a2..1f8bd7cd82 100644
--- a/activesupport/lib/active_support/core_ext/hash/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/hash/conversions.rb
@@ -84,7 +84,7 @@ class Hash
alias_method :to_param, :to_query
def to_xml(options = {})
- require 'builder' unless defined?(Builder)
+ require 'active_support/vendor/builder' unless defined?(Builder)
options = options.dup
options[:indent] ||= 2
diff --git a/activesupport/lib/active_support/core_ext/string/xchar.rb b/activesupport/lib/active_support/core_ext/string/xchar.rb
index 7183218634..26857c8b0d 100644
--- a/activesupport/lib/active_support/core_ext/string/xchar.rb
+++ b/activesupport/lib/active_support/core_ext/string/xchar.rb
@@ -6,7 +6,7 @@ rescue LoadError
# fast_xs extension unavailable
else
begin
- require 'builder'
+ require 'active_support/vendor/builder'
rescue LoadError
# builder demands the first shot at defining String#to_xs
end
diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb
index 564528bfe2..4eb268ac7d 100644
--- a/activesupport/lib/active_support/values/time_zone.rb
+++ b/activesupport/lib/active_support/values/time_zone.rb
@@ -306,7 +306,7 @@ module ActiveSupport
# TODO: Preload instead of lazy load for thread safety
def tzinfo
- require 'tzinfo' unless defined?(TZInfo)
+ require 'active_support/vendor/tzinfo' unless defined?(TZInfo)
@tzinfo ||= TZInfo::Timezone.get(MAPPING[name])
end
diff --git a/activesupport/lib/active_support/vendor.rb b/activesupport/lib/active_support/vendor.rb
index f9ecefe4e7..10dbfd9a77 100644
--- a/activesupport/lib/active_support/vendor.rb
+++ b/activesupport/lib/active_support/vendor.rb
@@ -1,27 +1,23 @@
-# Prefer gems to the bundled libs.
-require 'rubygems'
+# Fakes out gem optional dependencies until they are fully supported by gemspec.
+# Activate any optional dependencies that are available.
+if defined? Gem
+ begin
+ gem 'builder', '~> 2.1.2'
+ rescue Gem::LoadError
+ end
-begin
- gem 'builder', '~> 2.1.2'
-rescue Gem::LoadError
- $:.unshift "#{File.dirname(__FILE__)}/vendor/builder-2.1.2/lib"
-end
-
-begin
- gem 'memcache-client', '>= 1.6.5'
-rescue Gem::LoadError
- $:.unshift "#{File.dirname(__FILE__)}/vendor/memcache-client-1.6.5/lib"
-end
+ begin
+ gem 'memcache-client', '>= 1.6.5'
+ rescue Gem::LoadError
+ end
-begin
- gem 'tzinfo', '~> 0.3.13'
-rescue Gem::LoadError
- $:.unshift "#{File.dirname(__FILE__)}/vendor/tzinfo-0.3.13/lib"
-end
+ begin
+ gem 'tzinfo', '~> 0.3.13'
+ rescue Gem::LoadError
+ end
-begin
- gem 'i18n', '~> 0.1.3'
-rescue Gem::LoadError
- $:.unshift "#{File.dirname(__FILE__)}/vendor/i18n-0.1.3/lib"
- require 'i18n'
+ begin
+ gem 'i18n', '~> 0.1.3'
+ rescue Gem::LoadError
+ end
end
diff --git a/activesupport/lib/active_support/vendor/builder.rb b/activesupport/lib/active_support/vendor/builder.rb
new file mode 100644
index 0000000000..ad89e6635d
--- /dev/null
+++ b/activesupport/lib/active_support/vendor/builder.rb
@@ -0,0 +1,6 @@
+begin
+ require 'builder'
+rescue LoadError
+ $:.unshift File.expand_path(File.join(File.dirname(__FILE__), 'builder-2.1.2', 'lib'))
+ retry
+end
diff --git a/activesupport/lib/active_support/vendor/i18n.rb b/activesupport/lib/active_support/vendor/i18n.rb
new file mode 100644
index 0000000000..6011253035
--- /dev/null
+++ b/activesupport/lib/active_support/vendor/i18n.rb
@@ -0,0 +1,6 @@
+begin
+ require 'i18n'
+rescue LoadError
+ $:.unshift File.expand_path(File.join(File.dirname(__FILE__), 'i18n-0.1.3', 'lib'))
+ retry
+end
diff --git a/activesupport/lib/active_support/vendor/memcache.rb b/activesupport/lib/active_support/vendor/memcache.rb
new file mode 100644
index 0000000000..d0c9c9f8b5
--- /dev/null
+++ b/activesupport/lib/active_support/vendor/memcache.rb
@@ -0,0 +1,6 @@
+begin
+ require 'memcache'
+rescue LoadError
+ $:.unshift File.expand_path(File.join(File.dirname(__FILE__), 'memcache-client-1.6.5', 'lib'))
+ retry
+end
diff --git a/activesupport/lib/active_support/vendor/tzinfo.rb b/activesupport/lib/active_support/vendor/tzinfo.rb
new file mode 100644
index 0000000000..01fba6d632
--- /dev/null
+++ b/activesupport/lib/active_support/vendor/tzinfo.rb
@@ -0,0 +1,6 @@
+begin
+ require 'tzinfo'
+rescue LoadError
+ $:.unshift File.expand_path(File.join(File.dirname(__FILE__), 'tzinfo-0.3.13', 'lib'))
+ retry
+end