aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-09-13 22:55:46 -0500
committerJoshua Peek <josh@joshpeek.com>2009-09-13 22:55:46 -0500
commitb2f0b8cbda74cc89834b2db749fb0fbe44f5d8f2 (patch)
tree05ae73741366a390fd543b67f7080325c8d7525e
parent6f9e449830902319d3c0897e67d8ac9c89bff39d (diff)
downloadrails-b2f0b8cbda74cc89834b2db749fb0fbe44f5d8f2.tar.gz
rails-b2f0b8cbda74cc89834b2db749fb0fbe44f5d8f2.tar.bz2
rails-b2f0b8cbda74cc89834b2db749fb0fbe44f5d8f2.zip
Rollback AS bundler work and improve activation of vendored dependencies
-rw-r--r--actionpack/Gemfile6
-rw-r--r--actionpack/lib/action_view/template/handlers/builder.rb2
-rw-r--r--actionpack/test/abstract_unit.rb2
-rw-r--r--actionpack/test/template/form_options_helper_test.rb2
-rw-r--r--activesupport/Gemfile18
-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
-rw-r--r--activesupport/test/abstract_unit.rb6
-rw-r--r--activesupport/test/bundler_helper.rb30
18 files changed, 54 insertions, 96 deletions
diff --git a/actionpack/Gemfile b/actionpack/Gemfile
index 8abf63bd35..b1579b427b 100644
--- a/actionpack/Gemfile
+++ b/actionpack/Gemfile
@@ -9,12 +9,6 @@ only :test do
gem "mocha"
gem "sqlite3-ruby"
gem "RedCloth"
-
- activesupport_vendor = rails_root.join('activesupport', 'lib', 'active_support', 'vendor')
-
- gem 'builder', '2.1.2', :vendored_at => activesupport_vendor.join('builder-2.1.2')
- gem 'memcache-client', '1.6.5', :vendored_at => activesupport_vendor.join('memcache-client-1.6.5')
- gem 'tzinfo', '0.3.13', :vendored_at => activesupport_vendor.join('tzinfo-0.3.13')
end
disable_system_gems
diff --git a/actionpack/lib/action_view/template/handlers/builder.rb b/actionpack/lib/action_view/template/handlers/builder.rb
index 5f381f7bf0..ba0d17b5af 100644
--- a/actionpack/lib/action_view/template/handlers/builder.rb
+++ b/actionpack/lib/action_view/template/handlers/builder.rb
@@ -6,7 +6,7 @@ module ActionView
self.default_format = Mime::XML
def compile(template)
- require 'builder'
+ require 'active_support/vendor/builder'
"xml = ::Builder::XmlMarkup.new(:indent => 2);" +
"self.output_buffer = xml.target!;" +
template.source +
diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb
index f1914217f4..7776bd0704 100644
--- a/actionpack/test/abstract_unit.rb
+++ b/actionpack/test/abstract_unit.rb
@@ -7,7 +7,7 @@ $:.unshift(File.dirname(__FILE__) + '/fixtures/helpers')
$:.unshift(File.dirname(__FILE__) + '/fixtures/alternate_helpers')
require 'bundler_helper'
-ensure_requirable %w( rack rack/test sqlite3 builder memcache tzinfo )
+ensure_requirable %w( rack rack/test sqlite3 )
ENV['TMPDIR'] = File.join(File.dirname(__FILE__), 'tmp')
diff --git a/actionpack/test/template/form_options_helper_test.rb b/actionpack/test/template/form_options_helper_test.rb
index aa40e46aa8..f3cdab05bf 100644
--- a/actionpack/test/template/form_options_helper_test.rb
+++ b/actionpack/test/template/form_options_helper_test.rb
@@ -1,5 +1,5 @@
require 'abstract_unit'
-require 'tzinfo'
+require 'active_support/vendor/tzinfo'
TZInfo::Timezone.cattr_reader :loaded_zones
diff --git a/activesupport/Gemfile b/activesupport/Gemfile
deleted file mode 100644
index 5423d6f405..0000000000
--- a/activesupport/Gemfile
+++ /dev/null
@@ -1,18 +0,0 @@
-lib_dir = Pathname.new(File.dirname(__FILE__)).join('lib')
-vendor_dir = lib_dir.join('active_support', 'vendor')
-
-# gem 'builder', '~> 2.1.2'
-# gem 'memcache-client', '>= 1.6.5'
-# gem 'tzinfo', '~> 0.3.13'
-# gem 'i18n', '~> 0.1.3'
-
-gem 'builder', '2.1.2', :vendored_at => vendor_dir.join('builder-2.1.2')
-gem 'memcache-client', '1.6.5', :vendored_at => vendor_dir.join('memcache-client-1.6.5')
-gem 'tzinfo', '0.3.13', :vendored_at => vendor_dir.join('tzinfo-0.3.13')
-gem 'i18n', '0.1.3', :vendored_at => vendor_dir.join('i18n-0.1.3')
-
-only :test do
- gem 'mocha', '>= 0.9.7'
-end
-
-disable_rubygems
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
diff --git a/activesupport/test/abstract_unit.rb b/activesupport/test/abstract_unit.rb
index f364b7ecd8..4bc035c439 100644
--- a/activesupport/test/abstract_unit.rb
+++ b/activesupport/test/abstract_unit.rb
@@ -1,8 +1,6 @@
ORIG_ARGV = ARGV.dup
-require 'bundler_helper'
-ensure_requirable %w( builder memcache tzinfo )
-
+require 'rubygems'
require 'test/unit'
ENV['NO_RELOAD'] = '1'
@@ -14,7 +12,7 @@ require 'active_support/test_case'
require 'active_support/ruby/shim'
def uses_memcached(test_name)
- require 'memcache'
+ require 'active_support/vendor/memcache'
begin
MemCache.new('localhost').stats
yield
diff --git a/activesupport/test/bundler_helper.rb b/activesupport/test/bundler_helper.rb
deleted file mode 100644
index 5f3e982f19..0000000000
--- a/activesupport/test/bundler_helper.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-BUNDLER_ENV_FILE = File.join(File.dirname(__FILE__), '..', 'vendor', 'gems', 'environment')
-
-def load_bundled_gems
- load_bundled_gems! if File.exist?("#{BUNDLER_ENV_FILE}.rb")
-end
-
-def load_bundled_gems!
- puts "Checking if the bundled testing requirements are up to date..."
-
- result = system "gem bundle"
- unless result
- puts "The gem bundler is not installed. Installing."
- system "gem install bundler"
- system "gem bundle"
- end
-
- require BUNDLER_ENV_FILE
-end
-
-def ensure_requirable(libs)
- load_bundled_gems
-
- begin
- libs.each { |lib| require lib }
- rescue LoadError => e
- puts "Missing required libs to run test"
- puts e.message
- load_bundled_gems!
- end
-end