Skip to content

Commit

Permalink
Merge pull request #1478 from deivid-rodriguez/drop-old-rubies-support
Browse files Browse the repository at this point in the history
Require Ruby >= 2.5, add Psych 4 support, and get CI green
  • Loading branch information
mikel authored Apr 21, 2022
2 parents 6e5db59 + 100a4f2 commit b9fa30a
Show file tree
Hide file tree
Showing 46 changed files with 548 additions and 1,313 deletions.
41 changes: 19 additions & 22 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,34 @@ on:

jobs:
ruby:
name: ${{ matrix.ruby }} (timeout ${{ matrix.timeout }})
runs-on: ubuntu-latest
timeout-minutes: 5
timeout-minutes: ${{ matrix.timeout }}
strategy:
fail-fast: false
matrix:
include:
- docker-image: 'silvioq/ruby-1.8.7'
bundler-version: '1.17.3'
- docker-image: 'library/ruby:1.9'
bundler-version: '1.17.3'
- docker-image: 'library/ruby:2.0'
bundler-version: '1.17.3'
- docker-image: 'library/ruby:2.2'
bundler-version: '1.17.3'
- docker-image: 'library/ruby:2.3'
- docker-image: 'library/ruby:2.4'
- docker-image: 'library/ruby:2.5'
- docker-image: 'library/ruby:2.6'
- docker-image: 'library/ruby:2.7'
- docker-image: 'library/ruby:3.0'
- docker-image: 'flavorjones/truffleruby:stable'
- docker-image: 'bitnami/jruby:latest'
container: ${{ matrix.docker-image }}
- ruby: 2.5
timeout: 5
- ruby: 2.6
timeout: 5
- ruby: 2.7
timeout: 5
- ruby: '3.0'
timeout: 5
- ruby: truffleruby
timeout: 50
- ruby: jruby
timeout: 5
steps:
- uses: actions/checkout@v2
- name: Install bundler ${{ matrix.bundler-version }}
run: gem install bundler ${{ matrix.bundler-version && format('{0} {1}', '-v', matrix.bundler-version) || '' }}
- name: Install dependencies
run: bundle install
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run tests
run: bundle exec rake spec
continue-on-error: ${{ matrix.ruby == 'truffleruby' }}
actionmailer:
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 1 addition & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ pull request merged quickly:
5. Add a spec for your change. Only refactoring and documentation changes
require no new specs. If you are adding functionality or fixing a bug, we need
a spec!
6. Test the spec _at_ _least_ against MRI-1.9.3 and MRI-1.8.7
6. Test the spec on supported rubies.
7. Update the README if needed to reflect your change / addition
8. Update the CHANGELOG and give yourself credit
9. With all specs passing push your changes back to your fork
10. Send me a pull request.
- If it needs any changes, please push or force push to the same branch you made the pull request from. GitHub will just update the pull request with your changes.

Note, specs that break MRI 1.8.7 or 1.9.3 will not be accepted.

At this point you're waiting on us. We like to at least comment on, if not
accept, pull requests within three business days (and, typically, one business
day). We may suggest some changes or improvements or alternatives.
Expand Down
25 changes: 2 additions & 23 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,14 @@ source 'https://rubygems.org'

gemspec

# For testing against ActiveSupport::Multibyte::Chars
if RUBY_VERSION < '1.9.3'
gem 'activesupport', '< 4'
gem 'i18n', '< 0.7'
elsif RUBY_VERSION < '2.2.2'
gem 'activesupport', '< 5'
elsif RUBY_VERSION < '2.7.0'
if RUBY_VERSION < '2.7.0'
gem 'activesupport', '< 6'
else
gem 'activesupport', :git => 'https://github.com/rails/rails', :branch => 'main'
end

gem 'tlsmail', '~> 0.0.1' if RUBY_VERSION <= '1.8.6'
gem 'jruby-openssl', :platforms => :jruby

gem 'rufo', '< 0.4' if RUBY_VERSION < '2.3.5'
gem 'rake', '< 11.0' if RUBY_VERSION < '1.9.3'
if RUBY_VERSION < '2.0'
gem 'rdoc', '< 4.3'
elsif RUBY_VERSION < '2.2.2'
gem 'rdoc', '< 6'
end

gem 'mini_mime'

if RUBY_VERSION >= '2.0'
gem 'byebug', :platforms => :mri
elsif RUBY_VERSION >= '1.9'
gem 'debugger', :platforms => :mri
else
gem 'ruby-debug', :platforms => :mri
end
gem 'byebug', :platforms => :mri
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ implementation that makes generating, sending and parsing email a no
brainer.

It is also designed from the ground up to work with the more modern versions
of Ruby. This is because Ruby > 1.9 handles text encodings much more wonderfully
than Ruby 1.8.x and so these features have been taken full advantage of in this
library allowing Mail to handle a lot more messages more cleanly than TMail.
Mail does run on Ruby 1.8.x... it's just not as fun to code.
of Ruby. Modern Rubies handle text encodings much more wonderfully than before
so these features have been taken full advantage of in this library allowing
Mail to handle a lot more messages more cleanly than TMail.

Finally, Mail has been designed with a very simple object oriented system
that really opens up the email messages you are parsing, if you know what
Expand Down Expand Up @@ -48,7 +47,9 @@ our documentation, add new features—up to you! Thank you for pitching in.

## Compatibility

Mail supports Ruby 1.8.7+, including JRuby and Rubinius.
Mail supports Ruby 2.5+, including JRuby and TruffleRuby.

As new versions of Ruby are released, Mail will be compatible with support for the "preview" and all "normal maintenance", "security maintenance" and the two most recent "end of life" versions listed at the [Ruby Maintenance Branches](https://www.ruby-lang.org/en/downloads/branches/) page. Pull requests to assist in adding support for new preview releases are more than welcome.

Every Mail commit is tested by GitHub Actions on [all supported Ruby versions](https://github.com/mikel/mail/blob/master/.github/workflows/test.yml).

Expand Down
18 changes: 0 additions & 18 deletions lib/mail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,8 @@ module Mail # :doc:
require 'net/smtp'
require 'mini_mime'

if RUBY_VERSION <= '1.8.6'
begin
require 'tlsmail'
rescue LoadError
raise "You need to install tlsmail if you are using ruby <= 1.8.6"
end
end

if RUBY_VERSION >= "1.9.0"
require 'mail/version_specific/ruby_1_9'
RubyVer = Ruby19
else
require 'mail/version_specific/ruby_1_8'
RubyVer = Ruby18
end

require 'mail/version'

require 'mail/core_extensions/string'
require 'mail/core_extensions/smtp'
require 'mail/indifferent_hash'

require 'mail/multibyte'
Expand Down
5 changes: 1 addition & 4 deletions lib/mail/attachments_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,7 @@ def guess_encoding
end

def set_mime_type(filename)
# Have to do this because MIME::Types is not Ruby 1.9 safe yet
if RUBY_VERSION >= '1.9'
filename = filename.encode(Encoding::UTF_8) if filename.respond_to?(:encode)
end
filename = filename.encode(Encoding::UTF_8) if filename.respond_to?(:encode)

@mime_type = MiniMime.lookup_by_filename(filename)
@mime_type && @mime_type.content_type
Expand Down
28 changes: 0 additions & 28 deletions lib/mail/core_extensions/smtp.rb

This file was deleted.

17 changes: 0 additions & 17 deletions lib/mail/core_extensions/string.rb

This file was deleted.

Loading

0 comments on commit b9fa30a

Please sign in to comment.