Permalink
Browse files

Unforce text-format from AM

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
1 parent f50928d commit 52f905715efcc60ffb6b10654d170f8d7da10496 @spastorino spastorino committed with mikel Jun 1, 2010
View
@@ -24,6 +24,9 @@ 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'
@@ -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
@@ -49,9 +49,3 @@ module ActionMailer
autoload :TestCase
autoload :TestHelper
end
-
-module Text
- extend ActiveSupport::Autoload
-
- autoload :Format, 'text/format'
-end
@@ -3,6 +3,13 @@ module MailHelper
# 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

0 comments on commit 52f9057

Please sign in to comment.