Skip to content
This repository
Browse code

Making further changes for active support removal

  • Loading branch information...
commit 8bea8ede624e81fb4704e66097a1c8cf35f8de8d 1 parent 6eb4c44
Mikel Lindsaar authored
5 Gemfile
... ... @@ -1,10 +1,15 @@
1 1 source :rubygems
2 2
  3 +gem "activesupport", ">= 2.3.6"
3 4 gem "tlsmail" if RUBY_VERSION <= '1.8.6'
4 5 gem "mime-types", "~> 1.16"
5 6 gem "treetop", "~> 1.4.8"
6 7 gem "i18n", ">= 0.4.0"
7 8
  9 +if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
  10 + gem 'jruby-openssl'
  11 +end
  12 +
8 13 group :test do
9 14 gem "ZenTest", "~> 4.4.0"
10 15 gem "rake", "~> 0.8.7"
4 lib/VERSION
... ... @@ -1,4 +1,4 @@
1 1 major:2
2   -minor:2
3   -patch:18
  2 +minor:3
  3 +patch:0
4 4 build:
23 lib/mail.rb
@@ -26,20 +26,25 @@ module Mail # :doc:
26 26
27 27 require 'mail/version'
28 28
29   - # Only load our extensions if AS is not already loaded
30   - unless defined?(ActiveSupport)
31   - require 'mail/core_extensions/nil'
32   - require 'mail/core_extensions/string'
  29 + require 'mail/core_extensions/nil'
  30 + require 'mail/core_extensions/object'
  31 + require 'mail/core_extensions/string'
  32 + require 'mail/core_extensions/shellwords' unless String.new.respond_to?(:shellescape)
  33 + require 'mail/core_extensions/smtp' if RUBY_VERSION < '1.9.3'
  34 + require 'mail/indifferent_hash'
  35 +
  36 + # Only load our multibyte extensions if AS is not already loaded
  37 + if defined?(ActiveSupport)
  38 + puts("====================================================")
  39 + puts(" USING ACTIVE SUPPORT ")
  40 + puts("====================================================")
  41 + require 'active_support/core_ext/string'
  42 + else
33 43 require 'mail/core_extensions/string/access'
34 44 require 'mail/core_extensions/string/multibyte'
35   - require 'mail/core_extensions/object'
36 45 require 'mail/multibyte'
37   - require 'mail/indifferent_hash'
38 46 end
39 47
40   - require 'mail/core_extensions/shellwords' unless String.new.respond_to?(:shellescape)
41   - require 'mail/core_extensions/smtp' if RUBY_VERSION < '1.9.3'
42   -
43 48 require 'mail/patterns'
44 49 require 'mail/utilities'
45 50 require 'mail/configuration'
2  lib/mail/core_extensions/nil.rb
... ... @@ -1,5 +1,7 @@
1 1 # encoding: utf-8
2 2
  3 +# This is not loaded if ActiveSupport is already loaded
  4 +
3 5 class NilClass #:nodoc:
4 6 def to_crlf
5 7 ''
4 lib/mail/core_extensions/object.rb
... ... @@ -1,3 +1,7 @@
  1 +# encoding: utf-8
  2 +
  3 +# This is not loaded if ActiveSupport is already loaded
  4 +
1 5 class Object
2 6 def blank?
3 7 if respond_to?(:empty?)
2  lib/mail/core_extensions/shellwords.rb
... ... @@ -1,3 +1,5 @@
  1 +# encoding: utf-8
  2 +
1 3 # The following is imported from ruby 1.9.2 shellwords.rb
2 4 #
3 5 module Shellwords
1  lib/mail/core_extensions/smtp.rb
... ... @@ -1,3 +1,4 @@
  1 +# encoding: utf-8
1 2 module Net
2 3 class SMTP
3 4 # This is a backport of r30294 from ruby trunk because of a bug in net/smtp.
2  lib/mail/core_extensions/string.rb
@@ -20,7 +20,7 @@ def ascii_only?
20 20 !(self =~ /[^#{US_ASCII_REGEXP}]/)
21 21 end
22 22 end
23   -
  23 +
24 24 def not_ascii_only?
25 25 !ascii_only?
26 26 end
6 lib/mail/core_extensions/string/access.rb
... ... @@ -1,3 +1,9 @@
  1 +# encoding: utf-8
  2 +
  3 +# This is not loaded if ActiveSupport is already loaded
  4 +
  5 +# This is an almost cut and paste from ActiveSupport v3.0.6, copied in here so that Mail
  6 +# itself does not depend on ActiveSupport to avoid versioning conflicts
1 7
2 8 class String
3 9 unless '1.9'.respond_to?(:force_encoding)
6 lib/mail/core_extensions/string/multibyte.rb
... ... @@ -1,4 +1,10 @@
1 1 # encoding: utf-8
  2 +
  3 +# This is not loaded if ActiveSupport is already loaded
  4 +
  5 +# This is an almost cut and paste from ActiveSupport v3.0.6, copied in here so that Mail
  6 +# itself does not depend on ActiveSupport to avoid versioning conflicts
  7 +
2 8 require 'mail/multibyte'
3 9
4 10 class String
6 lib/mail/indifferent_hash.rb
... ... @@ -1,5 +1,9 @@
  1 +# encoding: utf-8
  2 +
  3 +# This is an almost cut and paste from ActiveSupport v3.0.6, copied in here so that Mail
  4 +# itself does not depend on ActiveSupport to avoid versioning conflicts
  5 +
1 6 module Mail
2   - # Sort of like ActiveSupport HashWithIndifferentAccess, but lighter
3 7 class IndifferentHash < Hash
4 8
5 9 def initialize(constructor = {})
4 mail.gemspec
@@ -13,12 +13,12 @@ Gem::Specification.new do |s|
13 13 s.has_rdoc = true
14 14 s.extra_rdoc_files = ["README.rdoc", "CHANGELOG.rdoc", "TODO.rdoc"]
15 15
16   - s.add_dependency('activesupport', ">= 2.3.6")
17 16 s.add_dependency('mime-types', "~> 1.16")
18 17 s.add_dependency('treetop', '~> 1.4.8')
19 18 s.add_dependency('i18n', '>= 0.4.0')
  19 + s.add_dependency('jruby-openssl') if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
20 20 s.add_dependency('tlsmail', '~> 0.0.1') if RUBY_VERSION == '1.8.6'
21 21
22 22 s.require_path = 'lib'
23   - s.files = %w(README.rdoc Rakefile TODO.rdoc) + Dir.glob("lib/**/*")
  23 + s.files = %w(README.rdoc CHANGELOG.rdoc Dependencies.txt Gemfile Rakefile TODO.rdoc) + Dir.glob("lib/**/*")
24 24 end

0 comments on commit 8bea8ed

Please sign in to comment.
Something went wrong with that request. Please try again.