Skip to content

Commit

Permalink
Merge pull request #713 from bf4/correct_deps
Browse files Browse the repository at this point in the history
Tests against all the mime-types; correct dependencies once and for all
  • Loading branch information
Mikel Lindsaar committed Jun 2, 2014
2 parents 963f86c + 38c896b commit 2ef4180
Show file tree
Hide file tree
Showing 16 changed files with 207 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@
/.idea
/.rbenv-vars
/.ruby-version
gemfiles/*.lock
36 changes: 30 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,42 @@
language: ruby
bundler_args: --path vendor/bundle
script: bundle exec rake
before_install:
- gem install bundler
- bundle config --local without local_development
gemfile:
- gemfiles/mime_types_1.16.gemfile
- gemfiles/mime_types_2.0.gemfile
- gemfiles/mime_types_2.1.gemfile
- gemfiles/mime_types_2.2.gemfile
- gemfiles/mime_types_2.3.gemfile
- gemfiles/mime_types_2.latest.gemfile
- gemfiles/mime_types_edge.gemfile
rvm:
- 1.8.7
- 1.9.2
- 1.9.3
- 2.0.0
- ruby-head
- jruby-18mode
- jruby-19mode
- jruby
- jruby-head
- rbx-18mode
- rbx-19mode
- rbx-2
matrix:
exclude:
- rvm: 1.8.7
gemfile: gemfiles/mime_types_2.0.gemfile
- rvm: 1.8.7
gemfile: gemfiles/mime_types_2.1.gemfile
- rvm: 1.8.7
gemfile: gemfiles/mime_types_2.2.gemfile
- rvm: 1.8.7
gemfile: gemfiles/mime_types_2.3.gemfile
- rvm: 1.8.7
gemfile: gemfiles/mime_types_2.latest.gemfile
- rvm: 1.8.7
gemfile: gemfiles/mime_types_edge.gemfile
allow_failures:
- rvm: ruby-head # green, but unstable
- rvm: jruby-head # green, but unstable
- rvm: rbx-18mode # seems to be running 1.9 mode instead!?
- rvm: rbx-19mode # segfaulting in String#ascii_only?
- rvm: rbx-2 # see https://github.com/rubinius/rubinius/issues/3050
fast_finish: true
27 changes: 27 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
appraise "mime-types-1.16" do
gem "mime-types", "~> 1.16"
end

appraise "mime-types-2.0" do
gem "mime-types", "~> 2.0.0"
end

appraise "mime-types-2.1" do
gem "mime-types", "~> 2.1.0"
end

appraise "mime-types-2.2" do
gem "mime-types", "~> 2.2.0"
end

appraise "mime-types-2.3" do
gem "mime-types", "~> 2.3.0"
end

appraise "mime-types-2.latest" do
gem "mime-types", "~> 2.3"
end

appraise "mime-types-edge" do
gem "mime-types", :github => "halostatue/mime-types"
end
13 changes: 13 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,16 @@ Syntax:
* Follow the conventions you see used in the source already.

And in case we didn't emphasize it enough: we love specs!

### Testing against mime-types versions:

Use [appraisal](https://github.com/thoughtbot/appraisal) to run against all supported versions of mime-types.

1. Run `(bundle check || bundle) && appraisal` so that all the 'appraised' gemfiles are bundled.
2. Run either `appraisal rake` or `rake appraisal` to run all the tests.

To run only one 'appraised' gemfile, run. e.g. `BUNDLE_GEMFILE=gemfiles/mime_types_edge.gemfile (bundle check || bundle) && rake`

To change the appraisals, modify the `Appraisals` file, run `appraisal`, commit the generated gemfiles, and modify the .travis.yml matrix.

To run on all rubies / gemfiles, just like TravisCI, see [WWTD](https://github.com/grosser/wwtd).
1 change: 0 additions & 1 deletion Dependencies.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
treetop: we need to include this in the gem spec
tlsmail: if ruby < 1.8.6... we could make it optional, or embed it in Mail
mime/types: I think we embed a simplified version, or help maintain it, it is old (2006)
15 changes: 9 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
source 'https://rubygems.org'
source "https://rubygems.org"

gemspec

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

gem 'jruby-openssl', :platform => :jruby
group :development, :test do
gem "appraisal", "~> 1.0"
end

group :test do
gem "ruby-debug", :platform => :mri_18
# For gems not required to run tests
group :local_development, :test do
gem "ruby-debug", :platforms => :mri_18
end
10 changes: 9 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
ENV['BUNDLE_GEMFILE'] = File.expand_path('../Gemfile', __FILE__)
if !ENV["APPRAISAL_INITIALIZED"] && !ENV["TRAVIS"]
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __FILE__)
end
require 'rubygems'
require 'bundler/setup'

Expand All @@ -17,5 +19,11 @@ RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = %w(--backtrace --color)
end

begin
require "appraisal"
rescue LoadError
warn "Appraisal is only available in test/development"
end

# load custom rake tasks
Dir["#{File.dirname(__FILE__)}/tasks/**/*.rake"].sort.each { |ext| load ext }
16 changes: 16 additions & 0 deletions gemfiles/mime_types_1.16.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "jruby-openssl", :platforms => :jruby
gem "mime-types", "~> 1.16"

group :development, :test do
gem "appraisal", "~> 1.0"
end

group :local_development, :test do
gem "ruby-debug", :platforms => :mri_18
end

gemspec :path => "../"
16 changes: 16 additions & 0 deletions gemfiles/mime_types_2.0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "jruby-openssl", :platforms => :jruby
gem "mime-types", "~> 2.0.0"

group :development, :test do
gem "appraisal", "~> 1.0"
end

group :local_development, :test do
gem "ruby-debug", :platforms => :mri_18
end

gemspec :path => "../"
16 changes: 16 additions & 0 deletions gemfiles/mime_types_2.1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "jruby-openssl", :platforms => :jruby
gem "mime-types", "~> 2.1.0"

group :development, :test do
gem "appraisal", "~> 1.0"
end

group :local_development, :test do
gem "ruby-debug", :platforms => :mri_18
end

gemspec :path => "../"
16 changes: 16 additions & 0 deletions gemfiles/mime_types_2.2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "jruby-openssl", :platforms => :jruby
gem "mime-types", "~> 2.2.0"

group :development, :test do
gem "appraisal", "~> 1.0"
end

group :local_development, :test do
gem "ruby-debug", :platforms => :mri_18
end

gemspec :path => "../"
16 changes: 16 additions & 0 deletions gemfiles/mime_types_2.3.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "jruby-openssl", :platforms => :jruby
gem "mime-types", "~> 2.3.0"

group :development, :test do
gem "appraisal", "~> 1.0"
end

group :local_development, :test do
gem "ruby-debug", :platforms => :mri_18
end

gemspec :path => "../"
16 changes: 16 additions & 0 deletions gemfiles/mime_types_2.latest.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "jruby-openssl", :platforms => :jruby
gem "mime-types", "~> 2.3"

group :development, :test do
gem "appraisal", "~> 1.0"
end

group :local_development, :test do
gem "ruby-debug", :platforms => :mri_18
end

gemspec :path => "../"
16 changes: 16 additions & 0 deletions gemfiles/mime_types_edge.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "jruby-openssl", :platforms => :jruby
gem "mime-types", :github => "halostatue/mime-types"

group :development, :test do
gem "appraisal", "~> 1.0"
end

group :local_development, :test do
gem "ruby-debug", :platforms => :mri_18
end

gemspec :path => "../"
4 changes: 1 addition & 3 deletions mail.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ Gem::Specification.new do |s|
s.extra_rdoc_files = ["README.md", "CONTRIBUTING.md", "CHANGELOG.rdoc", "TODO.rdoc"]
s.rdoc_options << '--exclude' << 'lib/mail/values/unicode_tables.dat'

s.add_dependency('mime-types', "~> 1.16")
s.add_dependency('jruby-openssl') if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
s.add_dependency('tlsmail', '~> 0.0.1') if RUBY_VERSION == '1.8.6'
s.add_dependency('mime-types', [">= 1.16", "< 3"])

s.add_development_dependency('bundler', '>= 1.0.3')
s.add_development_dependency('rake', '> 0.8.7')
Expand Down
6 changes: 5 additions & 1 deletion test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
require 'rubygems'
require 'mail'
require 'ruby-debug'
begin
require 'ruby-debug'
rescue LoadError
STDERR.puts "Continuing without ruby-debug"
end

smtp = { :address => 'mail.fiendz.org', :port => 587, :domain => 'fiendz.org', :user_name => 'test@fiendz.org', :password => 'foobar', :enable_starttls_auto => true, :openssl_verify_mode => 'none' }
Mail.defaults { delivery_method :smtp, smtp }
Expand Down

0 comments on commit 2ef4180

Please sign in to comment.