aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2010-06-01 16:39:05 -0500
committerDavid Heinemeier Hansson <david@loudthinking.com>2010-06-01 16:39:05 -0500
commitcae25199008bc26d215e7af5558cfcdfdc6ec264 (patch)
tree9b1cd9bf1a2a770af31406652362001460816e5b
parentd57397c4b62b6474ff8eb55bfd763f5e6dcdcd40 (diff)
parenta0bb1dda119a7488b8a4d61b354a64e619b0d1b3 (diff)
downloadrails-cae25199008bc26d215e7af5558cfcdfdc6ec264.tar.gz
rails-cae25199008bc26d215e7af5558cfcdfdc6ec264.tar.bz2
rails-cae25199008bc26d215e7af5558cfcdfdc6ec264.zip
Merge branch 'master' of github.com:rails/rails
-rw-r--r--Gemfile6
-rw-r--r--actionmailer/actionmailer.gemspec1
-rw-r--r--actionmailer/lib/action_mailer.rb6
-rw-r--r--actionmailer/lib/action_mailer/mail_helper.rb7
-rw-r--r--actionpack/actionpack.gemspec2
-rw-r--r--activemodel/activemodel.gemspec1
-rw-r--r--activemodel/lib/active_model/errors.rb12
-rw-r--r--activerecord/activerecord.gemspec1
-rw-r--r--activesupport/activesupport.gemspec4
-rw-r--r--activesupport/lib/active_support/builder.rb6
-rw-r--r--activesupport/lib/active_support/cache/mem_cache_store.rb7
-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/values/time_zone.rb8
14 files changed, 44 insertions, 21 deletions
diff --git a/Gemfile b/Gemfile
index 214fdf77da..d57afc8630 100644
--- a/Gemfile
+++ b/Gemfile
@@ -21,6 +21,12 @@ elsif RUBY_ENGINE == "jruby"
gem "jruby-openssl"
end
+# AS
+gem "memcache-client", ">= 1.7.5"
+
+# AM
+gem "text-format", "~> 1.0.0"
+
# AR
if mri || RUBY_ENGINE == "rbx"
gem "sqlite3-ruby", "= 1.3.0.beta.2", :require => 'sqlite3'
diff --git a/actionmailer/actionmailer.gemspec b/actionmailer/actionmailer.gemspec
index 280771e4db..4706b63b79 100644
--- a/actionmailer/actionmailer.gemspec
+++ b/actionmailer/actionmailer.gemspec
@@ -21,5 +21,4 @@ Gem::Specification.new do |s|
s.add_dependency('actionpack', version)
s.add_dependency('mail', '~> 2.2.1')
- s.add_dependency('text-format', '~> 1.0.0')
end
diff --git a/actionmailer/lib/action_mailer.rb b/actionmailer/lib/action_mailer.rb
index 70cc312634..6e2d288082 100644
--- a/actionmailer/lib/action_mailer.rb
+++ b/actionmailer/lib/action_mailer.rb
@@ -49,9 +49,3 @@ module ActionMailer
autoload :TestCase
autoload :TestHelper
end
-
-module Text
- extend ActiveSupport::Autoload
-
- autoload :Format, 'text/format'
-end
diff --git a/actionmailer/lib/action_mailer/mail_helper.rb b/actionmailer/lib/action_mailer/mail_helper.rb
index ab5c3469b2..aab6e12387 100644
--- a/actionmailer/lib/action_mailer/mail_helper.rb
+++ b/actionmailer/lib/action_mailer/mail_helper.rb
@@ -3,6 +3,13 @@ module ActionMailer
# Uses Text::Format to take the text and format it, indented two spaces for
# each line, and wrapped at 72 columns.
def block_format(text)
+ begin
+ require 'text/format'
+ rescue LoadError => e
+ $stderr.puts "You don't have text-format installed in your application. Please add it to your Gemfile and run bundle install"
+ raise e
+ end unless defined?(Text::Format)
+
formatted = text.split(/\n\r\n/).collect { |paragraph|
Text::Format.new(
:columns => 72, :first_indent => 2, :body_indent => 2, :text => paragraph
diff --git a/actionpack/actionpack.gemspec b/actionpack/actionpack.gemspec
index 040d05f050..0f45cb5a4a 100644
--- a/actionpack/actionpack.gemspec
+++ b/actionpack/actionpack.gemspec
@@ -21,9 +21,11 @@ Gem::Specification.new do |s|
s.add_dependency('activesupport', version)
s.add_dependency('activemodel', version)
+ s.add_dependency('builder', '~> 2.1.2')
s.add_dependency('i18n', '~> 0.4.0')
s.add_dependency('rack', '~> 1.1.0')
s.add_dependency('rack-test', '~> 0.5.4')
s.add_dependency('rack-mount', '~> 0.6.3')
+ s.add_dependency('tzinfo', '~> 0.3.16')
s.add_dependency('erubis', '~> 2.6.5')
end
diff --git a/activemodel/activemodel.gemspec b/activemodel/activemodel.gemspec
index f06761ceb9..678007c0ef 100644
--- a/activemodel/activemodel.gemspec
+++ b/activemodel/activemodel.gemspec
@@ -20,5 +20,6 @@ Gem::Specification.new do |s|
s.has_rdoc = true
s.add_dependency('activesupport', version)
+ s.add_dependency('builder', '~> 2.1.2')
s.add_dependency('i18n', '~> 0.4.0')
end
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb
index 14afc5265f..15d468f5d8 100644
--- a/activemodel/lib/active_model/errors.rb
+++ b/activemodel/lib/active_model/errors.rb
@@ -170,13 +170,13 @@ module ActiveModel
end
end
- # Adds an error message (+messsage+) to the +attribute+, which will be returned on a call to <tt>on(attribute)</tt>
- # for the same attribute and ensure that this error object returns false when asked if <tt>empty?</tt>. More than one
- # error can be added to the same +attribute+ in which case an array will be returned on a call to <tt>on(attribute)</tt>.
- # If no +messsage+ is supplied, :invalid is assumed.
+ # Adds +message+ to the error messages on +attribute+, which will be returned on a call to
+ # <tt>on(attribute)</tt> for the same attribute. More than one error can be added to the same
+ # +attribute+ in which case an array will be returned on a call to <tt>on(attribute)</tt>.
+ # If no +message+ is supplied, <tt>:invalid</tt> is assumed.
#
- # If +message+ is a Symbol, it will be translated, using the appropriate scope (see translate_error).
- # If +message+ is a Proc, it will be called, allowing for things like Time.now to be used within an error
+ # If +message+ is a symbol, it will be translated using the appropriate scope (see +translate_error+).
+ # If +message+ is a proc, it will be called, allowing for things like <tt>Time.now</tt> to be used within an error.
def add(attribute, message = nil, options = {})
message ||= :invalid
message = generate_message(attribute, message, options) if message.is_a?(Symbol)
diff --git a/activerecord/activerecord.gemspec b/activerecord/activerecord.gemspec
index 59caa53be0..44c8fb83e1 100644
--- a/activerecord/activerecord.gemspec
+++ b/activerecord/activerecord.gemspec
@@ -24,4 +24,5 @@ Gem::Specification.new do |s|
s.add_dependency('activesupport', version)
s.add_dependency('activemodel', version)
s.add_dependency('arel', '~> 0.3.3')
+ s.add_dependency('tzinfo', '~> 0.3.16')
end
diff --git a/activesupport/activesupport.gemspec b/activesupport/activesupport.gemspec
index b07e74c5d4..8611a1e5fa 100644
--- a/activesupport/activesupport.gemspec
+++ b/activesupport/activesupport.gemspec
@@ -18,8 +18,4 @@ Gem::Specification.new do |s|
s.require_path = 'lib'
s.has_rdoc = true
-
- s.add_dependency('tzinfo', '~> 0.3.16')
- s.add_dependency('builder', '~> 2.1.2')
- s.add_dependency('memcache-client', '>= 1.7.5')
end
diff --git a/activesupport/lib/active_support/builder.rb b/activesupport/lib/active_support/builder.rb
new file mode 100644
index 0000000000..321e462acd
--- /dev/null
+++ b/activesupport/lib/active_support/builder.rb
@@ -0,0 +1,6 @@
+begin
+ require 'builder'
+rescue LoadError => e
+ $stderr.puts "You don't have builder installed in your application. Please add it to your Gemfile and run bundle install"
+ raise e
+end
diff --git a/activesupport/lib/active_support/cache/mem_cache_store.rb b/activesupport/lib/active_support/cache/mem_cache_store.rb
index d8377a208f..e3a2688e2f 100644
--- a/activesupport/lib/active_support/cache/mem_cache_store.rb
+++ b/activesupport/lib/active_support/cache/mem_cache_store.rb
@@ -1,4 +1,9 @@
-require 'memcache'
+begin
+ require 'memcache'
+rescue LoadError => e
+ $stderr.puts "You don't have memcache installed in your application. Please add it to your Gemfile and run bundle install"
+ raise e
+end
require 'digest/md5'
module ActiveSupport
diff --git a/activesupport/lib/active_support/core_ext/array/conversions.rb b/activesupport/lib/active_support/core_ext/array/conversions.rb
index 7e4d30f5e8..79e3828817 100644
--- a/activesupport/lib/active_support/core_ext/array/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/array/conversions.rb
@@ -134,7 +134,7 @@ class Array
# </messages>
#
def to_xml(options = {})
- require 'builder' unless defined?(Builder)
+ require 'active_support/builder' unless defined?(Builder)
options = options.dup
options[:indent] ||= 2
diff --git a/activesupport/lib/active_support/core_ext/hash/conversions.rb b/activesupport/lib/active_support/core_ext/hash/conversions.rb
index 14e5d2f8ac..565c9af7fb 100644
--- a/activesupport/lib/active_support/core_ext/hash/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/hash/conversions.rb
@@ -55,7 +55,7 @@ class Hash
# configure your own builder with the <tt>:builder</tt> option. The method also accepts
# options like <tt>:dasherize</tt> and friends, they are forwarded to the builder.
def to_xml(options = {})
- require 'builder' unless defined?(Builder)
+ require 'active_support/builder' unless defined?(Builder)
options = options.dup
options[:indent] ||= 2
diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb
index 2ac5134911..67b37785f5 100644
--- a/activesupport/lib/active_support/values/time_zone.rb
+++ b/activesupport/lib/active_support/values/time_zone.rb
@@ -1,5 +1,11 @@
require 'active_support/core_ext/object/blank'
require 'active_support/core_ext/object/try'
+begin
+ require 'tzinfo'
+rescue LoadError => e
+ $stderr.puts "You don't have tzinfo installed in your application. Please add it to your Gemfile and run bundle install"
+ raise e
+end
# The TimeZone class serves as a wrapper around TZInfo::Timezone instances. It allows us to do the following:
#
@@ -313,7 +319,7 @@ module ActiveSupport
# TODO: Preload instead of lazy load for thread safety
def self.find_tzinfo(name)
- require 'tzinfo' unless defined?(::TZInfo)
+ require 'active_support/tzinfo' unless defined?(::TZInfo)
::TZInfo::TimezoneProxy.new(MAPPING[name] || name)
end