Skip to content

Commit 0cc4cd0

Browse files
spastorinojosevalim
authored andcommitted
Unforce text-format from AM
Signed-off-by: José Valim <[email protected]>
1 parent 5714438 commit 0cc4cd0

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ end
2424
# AS
2525
gem "memcache-client", ">= 1.7.5"
2626

27+
# AM
28+
gem "text-format", "~> 1.0.0"
29+
2730
# AR
2831
if mri || RUBY_ENGINE == "rbx"
2932
gem "sqlite3-ruby", "= 1.3.0.beta.2", :require => 'sqlite3'

actionmailer/actionmailer.gemspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,4 @@ Gem::Specification.new do |s|
2121

2222
s.add_dependency('actionpack', version)
2323
s.add_dependency('mail', '~> 2.2.1')
24-
s.add_dependency('text-format', '~> 1.0.0')
2524
end

actionmailer/lib/action_mailer.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,3 @@ module ActionMailer
4949
autoload :TestCase
5050
autoload :TestHelper
5151
end
52-
53-
module Text
54-
extend ActiveSupport::Autoload
55-
56-
autoload :Format, 'text/format'
57-
end

actionmailer/lib/action_mailer/mail_helper.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ module MailHelper
33
# Uses Text::Format to take the text and format it, indented two spaces for
44
# each line, and wrapped at 72 columns.
55
def block_format(text)
6+
begin
7+
require 'text/format'
8+
rescue LoadError => e
9+
$stderr.puts "You don't have text-format installed in your application. Please add it to your Gemfile and run bundle install"
10+
raise e
11+
end unless defined?(Text::Format)
12+
613
formatted = text.split(/\n\r\n/).collect { |paragraph|
714
Text::Format.new(
815
:columns => 72, :first_indent => 2, :body_indent => 2, :text => paragraph

0 commit comments

Comments
 (0)