Merge branch 'master' of github.com:rails/rails

This commit is contained in:
David Heinemeier Hansson
2010-06-01 16:39:05 -05:00
14 changed files with 44 additions and 21 deletions

View File

@@ -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'

View File

@@ -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

View File

@@ -49,9 +49,3 @@ module ActionMailer
autoload :TestCase
autoload :TestHelper
end
module Text
extend ActiveSupport::Autoload
autoload :Format, 'text/format'
end

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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