1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/guides/bug_report_templates/action_mailbox_gem.rb

85 lines
2.3 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# Activate the gem you are reporting the issue against.
gem "rails", "~> 6.1.0"
gem "sqlite3"
Add `net/smtp` gem for bug report templates to support Ruby 3.1 Ruby 3.1 extracts some gems to bundled one, which requires to add these gems to Gemfile explicitly. `net/smtp` is one of them, which affected Action Mailbox bug report templates. * Steps to reproduce Install `ruby 3.1.0dev` ``` git clone https://github.com/rails/rails.git cd rails/guides ruby bug_report_templates/action_mailbox_gem.rb ruby bug_report_templates/action_mailbox_main.rb ``` * This commit addresses the following error `cannot load such file -- net/smtp (LoadError)` ``` $ ruby bug_report_templates/action_mailbox_gem.rb ... snip ... Using rails 6.1.0 /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `require': cannot load such file -- net/smtp (LoadError) from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `block in require' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:299:in `load_dependency' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `require' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/mail-2.7.1/lib/mail.rb:9:in `<module:Mail>' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/mail-2.7.1/lib/mail.rb:3:in `<top (required)>' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `require' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `block in require' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:299:in `load_dependency' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `require' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/actionmailbox-6.1.0/lib/action_mailbox/mail_ext.rb:3:in `<top (required)>' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `require' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `block in require' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:299:in `load_dependency' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `require' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/actionmailbox-6.1.0/lib/action_mailbox.rb:3:in `<top (required)>' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `require' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `block in require' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:299:in `load_dependency' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `require' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/actionmailbox-6.1.0/lib/action_mailbox/engine.rb:9:in `<top (required)>' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `require' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `block in require' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:299:in `load_dependency' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `require' from bug_report_templates/action_mailbox_gem.rb:17:in `<main>' ``` * Added comment when this dependency can be removed based on https://bugs.ruby-lang.org/issues/17873 Refer https://github.com/ruby/ruby/pull/4530 https://github.com/rails/rails/pull/42308 Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2021-06-02 10:54:30 -04:00
if RUBY_VERSION >= "3.1"
# net-smtp, net-imap and net-pop were removed from default gems in Ruby 3.1, but is used by the `mail` gem.
# So we need to add them as dependencies until `mail` is fixed: https://github.com/mikel/mail/pull/1439
gem "net-smtp", require: false
Address action_mailbox bug report templates failures with Ruby3.1.0dev This commit addresses CI failure since https://buildkite.com/rails/rails/builds/81642#ee889e34-4f2f-4bb6-9204-9c9bd0d27fa8 `net-smtp` gem v0.2.2 released which adds dependency to digest gem which attempts to install digest 3.0.0. However, Ruby 3.1.0dev requires digest gem 3.0.1, which causes this failure. Refer https://github.com/ruby/net-smtp/releases/tag/v0.2.2 https://github.com/ruby/net-smtp/commit/b1adc9e0be2c53a7ca23209ceedc5f7192149f6c - Steps to reproduce ``` $ cd guides/bug_report_templates $ ruby action_mailbox_main.rb - Result without this commit ```ruby $ ruby -v ruby 3.1.0dev (2021-10-10T15:24:09Z master 10c650628a) [x86_64-linux] $ cd guides/bug_report_templates $ ruby action_mailbox_main.rb Fetching gem metadata from https://rubygems.org/...... Resolving dependencies... Using rake 13.0.6 Using concurrent-ruby 1.1.9 Using minitest 5.14.4 Using builder 3.2.4 Using erubi 1.10.0 Using mini_mime 1.1.1 Using bundler 2.3.0.dev Using rack 2.2.3 Using digest 3.0.0 Using io-wait 0.1.1 Using method_source 1.0.0 Using timeout 0.1.1 Using thor 1.1.0 Using zeitwerk 2.5.0.beta5 Using sqlite3 1.4.2 Using i18n 1.8.10 Using tzinfo 2.0.4 Using mail 2.7.1 Using marcel 1.0.2 Using rack-test 1.1.0 Using net-protocol 0.1.1 Using sprockets 4.0.2 Using activesupport 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@5e1a039) Using websocket-extensions 0.1.5 Using net-smtp 0.2.2 Using websocket-driver 0.7.5 Using crass 1.0.6 Using nio4r 2.5.8 Using racc 1.5.2 Using mini_portile2 2.6.1 Using nokogiri 1.12.5 Using loofah 2.12.0 Using rails-html-sanitizer 1.4.2 Using rails-dom-testing 2.0.3 Using globalid 0.5.2 Using actionview 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@5e1a039) Using activemodel 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@5e1a039) Using actionpack 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@5e1a039) Using activejob 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@5e1a039) Using actioncable 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@5e1a039) Using actionmailer 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@5e1a039) Using sprockets-rails 3.2.2 Using activerecord 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@5e1a039) Using railties 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@5e1a039) Using activestorage 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@5e1a039) Using actiontext 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@5e1a039) Using actionmailbox 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@5e1a039) Using rails 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@5e1a039) /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/runtime.rb:309:in `check_for_activated_spec!': You have already activated digest 3.0.1.pre, but your Gemfile requires digest 3.0.0. Since digest is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports digest as a default gem. (Gem::LoadError) from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/runtime.rb:25:in `block in setup' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/spec_set.rb:136:in `each' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/spec_set.rb:136:in `each' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/runtime.rb:24:in `map' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/runtime.rb:24:in `setup' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/inline.rb:71:in `block in gemfile' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/settings.rb:131:in `temporary' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/inline.rb:55:in `gemfile' from action_mailbox_main.rb:5:in `<main>' $ ```
2021-10-10 11:51:06 -04:00
Bump required digest version to 3.1.0.pre for Ruby 3.1 This commit addresses these failures. - `bundle install` failure ```ruby $ bundle install Fetching gem metadata from https://rubygems.org/......... Could not find gem 'digest (~> 3.0.1.pre)' in rubygems repository https://rubygems.org/ or installed locally. The source contains the following versions of 'digest': 1.0.0, 3.0.0, 3.1.0.pre0, 3.1.0.pre1, 3.1.0.pre2, 3.1.0.pre2 java $ ``` * Action Mailbox bug report template failures ```ruby $ cd guides/bug_report_templates $ ruby -v ruby 3.1.0dev (2021-10-12T11:53:18Z master 58ae1efb49) [x86_64-linux] $ ruby action_mailbox_main.rb Fetching gem metadata from https://rubygems.org/...... /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/resolver.rb:278:in `block in verify_gemfile_dependencies_are_found!': Could not find gem 'digest (~> 3.0.1.pre)' in rubygems repository https://rubygems.org/ or installed locally. (Bundler::GemNotFound) The source contains the following versions of 'digest': 1.0.0, 3.0.0, 3.1.0.pre0, 3.1.0.pre1, 3.1.0.pre2, 3.1.0.pre2 java from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/resolver.rb:253:in `each' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/resolver.rb:253:in `verify_gemfile_dependencies_are_found!' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/resolver.rb:50:in `start' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/resolver.rb:23:in `resolve' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/definition.rb:267:in `resolve' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/definition.rb:183:in `resolve_remotely!' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/installer.rb:280:in `resolve_if_needed' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/installer.rb:82:in `block in run' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/process_lock.rb:12:in `block in lock' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/process_lock.rb:9:in `open' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/process_lock.rb:9:in `lock' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/installer.rb:71:in `run' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/installer.rb:23:in `install' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/inline.rb:63:in `block (2 levels) in gemfile' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/settings.rb:131:in `temporary' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/inline.rb:62:in `block in gemfile' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/settings.rb:131:in `temporary' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/inline.rb:55:in `gemfile' from action_mailbox_main.rb:5:in `<main>' $ ``` Refer https://github.com/ruby/ruby/commit/e94bcda02539e1695cdda9550ace45c1890e541c
2021-10-12 08:19:50 -04:00
# digest gem, which is one of the default gems has bumped to 3.1.0.pre for ruby 3.1.0dev.
Address action_mailbox bug report templates failures with Ruby3.1.0dev This commit addresses CI failure since https://buildkite.com/rails/rails/builds/81642#ee889e34-4f2f-4bb6-9204-9c9bd0d27fa8 `net-smtp` gem v0.2.2 released which adds dependency to digest gem which attempts to install digest 3.0.0. However, Ruby 3.1.0dev requires digest gem 3.0.1, which causes this failure. Refer https://github.com/ruby/net-smtp/releases/tag/v0.2.2 https://github.com/ruby/net-smtp/commit/b1adc9e0be2c53a7ca23209ceedc5f7192149f6c - Steps to reproduce ``` $ cd guides/bug_report_templates $ ruby action_mailbox_main.rb - Result without this commit ```ruby $ ruby -v ruby 3.1.0dev (2021-10-10T15:24:09Z master 10c650628a) [x86_64-linux] $ cd guides/bug_report_templates $ ruby action_mailbox_main.rb Fetching gem metadata from https://rubygems.org/...... Resolving dependencies... Using rake 13.0.6 Using concurrent-ruby 1.1.9 Using minitest 5.14.4 Using builder 3.2.4 Using erubi 1.10.0 Using mini_mime 1.1.1 Using bundler 2.3.0.dev Using rack 2.2.3 Using digest 3.0.0 Using io-wait 0.1.1 Using method_source 1.0.0 Using timeout 0.1.1 Using thor 1.1.0 Using zeitwerk 2.5.0.beta5 Using sqlite3 1.4.2 Using i18n 1.8.10 Using tzinfo 2.0.4 Using mail 2.7.1 Using marcel 1.0.2 Using rack-test 1.1.0 Using net-protocol 0.1.1 Using sprockets 4.0.2 Using activesupport 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@5e1a039) Using websocket-extensions 0.1.5 Using net-smtp 0.2.2 Using websocket-driver 0.7.5 Using crass 1.0.6 Using nio4r 2.5.8 Using racc 1.5.2 Using mini_portile2 2.6.1 Using nokogiri 1.12.5 Using loofah 2.12.0 Using rails-html-sanitizer 1.4.2 Using rails-dom-testing 2.0.3 Using globalid 0.5.2 Using actionview 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@5e1a039) Using activemodel 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@5e1a039) Using actionpack 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@5e1a039) Using activejob 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@5e1a039) Using actioncable 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@5e1a039) Using actionmailer 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@5e1a039) Using sprockets-rails 3.2.2 Using activerecord 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@5e1a039) Using railties 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@5e1a039) Using activestorage 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@5e1a039) Using actiontext 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@5e1a039) Using actionmailbox 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@5e1a039) Using rails 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@5e1a039) /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/runtime.rb:309:in `check_for_activated_spec!': You have already activated digest 3.0.1.pre, but your Gemfile requires digest 3.0.0. Since digest is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports digest as a default gem. (Gem::LoadError) from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/runtime.rb:25:in `block in setup' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/spec_set.rb:136:in `each' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/spec_set.rb:136:in `each' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/runtime.rb:24:in `map' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/runtime.rb:24:in `setup' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/inline.rb:71:in `block in gemfile' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/settings.rb:131:in `temporary' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/inline.rb:55:in `gemfile' from action_mailbox_main.rb:5:in `<main>' $ ```
2021-10-10 11:51:06 -04:00
# Also `net-smtp` v0.2.2 adds dependency to digest gem which attempts to install digest 3.0.0.
Bump required digest version to 3.1.0.pre for Ruby 3.1 This commit addresses these failures. - `bundle install` failure ```ruby $ bundle install Fetching gem metadata from https://rubygems.org/......... Could not find gem 'digest (~> 3.0.1.pre)' in rubygems repository https://rubygems.org/ or installed locally. The source contains the following versions of 'digest': 1.0.0, 3.0.0, 3.1.0.pre0, 3.1.0.pre1, 3.1.0.pre2, 3.1.0.pre2 java $ ``` * Action Mailbox bug report template failures ```ruby $ cd guides/bug_report_templates $ ruby -v ruby 3.1.0dev (2021-10-12T11:53:18Z master 58ae1efb49) [x86_64-linux] $ ruby action_mailbox_main.rb Fetching gem metadata from https://rubygems.org/...... /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/resolver.rb:278:in `block in verify_gemfile_dependencies_are_found!': Could not find gem 'digest (~> 3.0.1.pre)' in rubygems repository https://rubygems.org/ or installed locally. (Bundler::GemNotFound) The source contains the following versions of 'digest': 1.0.0, 3.0.0, 3.1.0.pre0, 3.1.0.pre1, 3.1.0.pre2, 3.1.0.pre2 java from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/resolver.rb:253:in `each' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/resolver.rb:253:in `verify_gemfile_dependencies_are_found!' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/resolver.rb:50:in `start' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/resolver.rb:23:in `resolve' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/definition.rb:267:in `resolve' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/definition.rb:183:in `resolve_remotely!' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/installer.rb:280:in `resolve_if_needed' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/installer.rb:82:in `block in run' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/process_lock.rb:12:in `block in lock' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/process_lock.rb:9:in `open' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/process_lock.rb:9:in `lock' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/installer.rb:71:in `run' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/installer.rb:23:in `install' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/inline.rb:63:in `block (2 levels) in gemfile' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/settings.rb:131:in `temporary' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/inline.rb:62:in `block in gemfile' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/settings.rb:131:in `temporary' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/inline.rb:55:in `gemfile' from action_mailbox_main.rb:5:in `<main>' $ ``` Refer https://github.com/ruby/ruby/commit/e94bcda02539e1695cdda9550ace45c1890e541c
2021-10-12 08:19:50 -04:00
gem "digest", "~> 3.1.0.pre", require: false
Add `net/smtp` gem for bug report templates to support Ruby 3.1 Ruby 3.1 extracts some gems to bundled one, which requires to add these gems to Gemfile explicitly. `net/smtp` is one of them, which affected Action Mailbox bug report templates. * Steps to reproduce Install `ruby 3.1.0dev` ``` git clone https://github.com/rails/rails.git cd rails/guides ruby bug_report_templates/action_mailbox_gem.rb ruby bug_report_templates/action_mailbox_main.rb ``` * This commit addresses the following error `cannot load such file -- net/smtp (LoadError)` ``` $ ruby bug_report_templates/action_mailbox_gem.rb ... snip ... Using rails 6.1.0 /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `require': cannot load such file -- net/smtp (LoadError) from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `block in require' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:299:in `load_dependency' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `require' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/mail-2.7.1/lib/mail.rb:9:in `<module:Mail>' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/mail-2.7.1/lib/mail.rb:3:in `<top (required)>' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `require' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `block in require' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:299:in `load_dependency' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `require' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/actionmailbox-6.1.0/lib/action_mailbox/mail_ext.rb:3:in `<top (required)>' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `require' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `block in require' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:299:in `load_dependency' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `require' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/actionmailbox-6.1.0/lib/action_mailbox.rb:3:in `<top (required)>' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `require' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `block in require' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:299:in `load_dependency' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `require' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/actionmailbox-6.1.0/lib/action_mailbox/engine.rb:9:in `<top (required)>' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `require' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `block in require' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:299:in `load_dependency' from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/activesupport-6.1.0/lib/active_support/dependencies.rb:332:in `require' from bug_report_templates/action_mailbox_gem.rb:17:in `<main>' ``` * Added comment when this dependency can be removed based on https://bugs.ruby-lang.org/issues/17873 Refer https://github.com/ruby/ruby/pull/4530 https://github.com/rails/rails/pull/42308 Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2021-06-02 10:54:30 -04:00
end
end
require "active_record/railtie"
require "active_storage/engine"
require "action_mailbox/engine"
require "tmpdir"
class TestApp < Rails::Application
config.root = __dir__
config.hosts << "example.org"
config.eager_load = false
config.session_store :cookie_store, key: "cookie_store_key"
secrets.secret_key_base = "secret_key_base"
config.logger = Logger.new($stdout)
Rails.logger = config.logger
config.active_storage.service = :local
config.active_storage.service_configurations = {
local: {
root: Dir.tmpdir,
service: "Disk"
}
}
config.action_mailbox.ingress = :relay
end
ENV["DATABASE_URL"] = "sqlite3::memory:"
Rails.application.initialize!
require ActiveStorage::Engine.root.join("db/migrate/20170806125915_create_active_storage_tables.rb").to_s
require ActionMailbox::Engine.root.join("db/migrate/20180917164000_create_action_mailbox_tables.rb").to_s
ActiveRecord::Schema.define do
CreateActiveStorageTables.new.change
CreateActionMailboxTables.new.change
end
class ApplicationMailbox < ActionMailbox::Base
routing (/^replies@/i) => :replies
end
class RepliesMailbox < ActionMailbox::Base
def process
$processed = mail.subject
end
end
require "minitest/autorun"
class RepliesMailboxTest < ActionMailbox::TestCase
setup do
$processed = false
@inbound_email = receive_inbound_email_from_mail \
to: "replies@example.com", subject: "Here is a reply"
end
test "successful mailbox processing" do
assert_equal "Here is a reply", $processed
end
end