active_delivery 0.4.4 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +62 -0
  3. data/LICENSE.txt +19 -17
  4. data/README.md +595 -33
  5. data/lib/.rbnext/3.0/abstract_notifier/async_adapters/active_job.rb +27 -0
  6. data/lib/.rbnext/3.0/active_delivery/base.rb +248 -0
  7. data/lib/.rbnext/3.0/active_delivery/callbacks.rb +101 -0
  8. data/lib/.rbnext/3.0/active_delivery/lines/base.rb +89 -0
  9. data/lib/.rbnext/3.0/active_delivery/lines/mailer.rb +26 -0
  10. data/lib/.rbnext/3.0/active_delivery/testing.rb +62 -0
  11. data/lib/.rbnext/3.1/abstract_notifier/base.rb +217 -0
  12. data/lib/.rbnext/3.1/active_delivery/base.rb +248 -0
  13. data/lib/.rbnext/3.1/active_delivery/lines/base.rb +89 -0
  14. data/lib/abstract_notifier/async_adapters/active_job.rb +27 -0
  15. data/lib/abstract_notifier/async_adapters.rb +16 -0
  16. data/lib/abstract_notifier/base.rb +217 -0
  17. data/lib/abstract_notifier/callbacks.rb +94 -0
  18. data/lib/abstract_notifier/testing/minitest.rb +51 -0
  19. data/lib/abstract_notifier/testing/rspec.rb +164 -0
  20. data/lib/abstract_notifier/testing.rb +53 -0
  21. data/lib/abstract_notifier/version.rb +5 -0
  22. data/lib/abstract_notifier.rb +75 -0
  23. data/lib/active_delivery/base.rb +147 -27
  24. data/lib/active_delivery/callbacks.rb +25 -25
  25. data/lib/active_delivery/ext/string_constantize.rb +24 -0
  26. data/lib/active_delivery/lines/base.rb +42 -16
  27. data/lib/active_delivery/lines/mailer.rb +7 -18
  28. data/lib/active_delivery/lines/notifier.rb +53 -0
  29. data/lib/active_delivery/raitie.rb +9 -0
  30. data/lib/active_delivery/testing/rspec.rb +59 -12
  31. data/lib/active_delivery/testing.rb +19 -5
  32. data/lib/active_delivery/version.rb +1 -1
  33. data/lib/active_delivery.rb +8 -0
  34. metadata +63 -54
  35. data/.gem_release.yml +0 -3
  36. data/.github/ISSUE_TEMPLATE/bug_report.md +0 -24
  37. data/.github/ISSUE_TEMPLATE/feature_request.md +0 -24
  38. data/.github/PULL_REQUEST_TEMPLATE.md +0 -23
  39. data/.github/workflows/docs-lint.yml +0 -72
  40. data/.github/workflows/rspec-jruby.yml +0 -35
  41. data/.github/workflows/rspec.yml +0 -51
  42. data/.github/workflows/rubocop.yml +0 -21
  43. data/.gitignore +0 -43
  44. data/.mdlrc +0 -1
  45. data/.rspec +0 -2
  46. data/.rubocop-md.yml +0 -16
  47. data/.rubocop.yml +0 -28
  48. data/Gemfile +0 -17
  49. data/RELEASING.md +0 -43
  50. data/Rakefile +0 -20
  51. data/active_delivery.gemspec +0 -35
  52. data/forspell.dict +0 -8
  53. data/gemfiles/jruby.gemfile +0 -5
  54. data/gemfiles/rails42.gemfile +0 -8
  55. data/gemfiles/rails5.gemfile +0 -5
  56. data/gemfiles/rails50.gemfile +0 -8
  57. data/gemfiles/rails6.gemfile +0 -5
  58. data/gemfiles/railsmaster.gemfile +0 -6
  59. data/gemfiles/rubocop.gemfile +0 -4
  60. data/lefthook.yml +0 -18
  61. data/lib/active_delivery/action_mailer/parameterized.rb +0 -92
data/.gitignore DELETED
@@ -1,43 +0,0 @@
1
- # Numerous always-ignore extensions
2
- *.diff
3
- *.err
4
- *.orig
5
- *.log
6
- *.rej
7
- *.swo
8
- *.swp
9
- *.vi
10
- *~
11
- *.sass-cache
12
- *.iml
13
- .idea/
14
-
15
- # Sublime
16
- *.sublime-project
17
- *.sublime-workspace
18
-
19
- # OS or Editor folders
20
- .DS_Store
21
- .cache
22
- .project
23
- .settings
24
- .tmproj
25
- Thumbs.db
26
-
27
- .bundle/
28
- log/*.log
29
- pkg/
30
- spec/dummy/db/*.sqlite3
31
- spec/dummy/db/*.sqlite3-journal
32
- spec/dummy/tmp/
33
-
34
- Gemfile.lock
35
- Gemfile.local
36
- .rspec
37
- .ruby-version
38
- *.gem
39
-
40
- tmp/
41
- .rbnext/
42
-
43
- gemfiles/*.lock
data/.mdlrc DELETED
@@ -1 +0,0 @@
1
- rules "~MD013", "~MD033", "~MD034", "~MD029", "~MD026", "~MD002"
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- -f d
2
- --color
data/.rubocop-md.yml DELETED
@@ -1,16 +0,0 @@
1
- inherit_from: ".rubocop.yml"
2
-
3
- require:
4
- - rubocop-md
5
-
6
- AllCops:
7
- Include:
8
- - '**/*.md'
9
-
10
- Lint/Void:
11
- Exclude:
12
- - '**/*.md'
13
-
14
- Lint/DuplicateMethods:
15
- Exclude:
16
- - '**/*.md'
data/.rubocop.yml DELETED
@@ -1,28 +0,0 @@
1
- require:
2
- - standard/cop/semantic_blocks
3
-
4
- inherit_gem:
5
- standard: config/base.yml
6
-
7
- AllCops:
8
- Exclude:
9
- - 'bin/*'
10
- - 'tmp/**/*'
11
- - 'Gemfile'
12
- - 'node_modules/**/*'
13
- - 'vendor/**/*'
14
- - 'gemfiles/**/*'
15
- DisplayCopNames: true
16
- TargetRubyVersion: 2.5
17
-
18
- Standard/SemanticBlocks:
19
- Enabled: false
20
-
21
- Style/FrozenStringLiteralComment:
22
- Enabled: true
23
-
24
- Style/TrailingCommaInArrayLiteral:
25
- EnforcedStyleForMultiline: no_comma
26
-
27
- Style/TrailingCommaInHashLiteral:
28
- EnforcedStyleForMultiline: no_comma
data/Gemfile DELETED
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- gem 'pry-byebug', platform: :mri
6
-
7
- gemspec
8
-
9
- eval_gemfile "gemfiles/rubocop.gemfile"
10
-
11
- local_gemfile = "#{File.dirname(__FILE__)}/Gemfile.local"
12
-
13
- if File.exist?(local_gemfile)
14
- eval(File.read(local_gemfile)) # rubocop:disable Security/Eval
15
- else
16
- gem "rails", "~> 6.0"
17
- end
data/RELEASING.md DELETED
@@ -1,43 +0,0 @@
1
- # How to release a gem
2
-
3
- This document describes a process of releasing a new version of a gem.
4
-
5
- 1. Bump version.
6
-
7
- ```sh
8
- git commit -m "Bump 1.<x>.<y>"
9
- ```
10
-
11
- We're (kinda) using semantic versioning:
12
-
13
- - Bugfixes should be released as fast as possible as patch versions.
14
- - New features could be combined and released as minor or patch version upgrades (depending on the _size of the feature_—it's up to maintainers to decide).
15
- - Breaking API changes should be avoided in minor and patch releases.
16
- - Breaking dependencies changes (e.g., dropping older Ruby support) could be released in minor versions.
17
-
18
- How to bump a version:
19
-
20
- - Change the version number in `lib/active_delivery/version.rb` file.
21
- - Update the changelog (add new heading with the version name and date).
22
- - Update the installation documentation if necessary (e.g., during minor and major updates).
23
-
24
- 2. Push code to GitHub and make sure CI passes.
25
-
26
- ```sh
27
- git push
28
- ```
29
-
30
- 3. Release a gem.
31
-
32
- ```sh
33
- gem release -t
34
- git push --tags
35
- ```
36
-
37
- We use [gem-release](https://github.com/svenfuchs/gem-release) for publishing gems with a single command:
38
-
39
- ```sh
40
- gem release -t
41
- ```
42
-
43
- Don't forget to push tags and write release notes on GitHub (if necessary).
data/Rakefile DELETED
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
- require "rspec/core/rake_task"
5
-
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- begin
9
- require "rubocop/rake_task"
10
- RuboCop::RakeTask.new
11
-
12
- RuboCop::RakeTask.new("rubocop:md") do |task|
13
- task.options << %w[-c .rubocop-md.yml]
14
- end
15
- rescue LoadError
16
- task(:rubocop) {}
17
- task("rubocop:md") {}
18
- end
19
-
20
- task default: %w[rubocop rubocop:md spec]
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- lib = File.expand_path("../lib", __FILE__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require "active_delivery/version"
6
-
7
- Gem::Specification.new do |spec|
8
- spec.name = "active_delivery"
9
- spec.version = ActiveDelivery::VERSION
10
- spec.authors = ["Vladimir Dementyev"]
11
- spec.email = ["dementiev.vm@gmail.com"]
12
-
13
- spec.summary = "Rails framework for managing all types of notifications in one place"
14
- spec.description = "Rails framework for managing all types of notifications in one place"
15
- spec.homepage = "https://github.com/palkan/active_delivery"
16
- spec.license = "MIT"
17
-
18
- spec.required_ruby_version = ">= 2.5"
19
-
20
- spec.metadata = {
21
- "bug_tracker_uri" => "http://github.com/palkan/active_delivery/issues",
22
- "changelog_uri" => "https://github.com/palkan/active_delivery/blob/master/CHANGELOG.md",
23
- "documentation_uri" => "http://github.com/palkan/active_delivery",
24
- "homepage_uri" => "http://github.com/palkan/active_delivery",
25
- "source_code_uri" => "http://github.com/palkan/active_delivery"
26
- }
27
-
28
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
29
- spec.require_paths = ["lib"]
30
-
31
- spec.add_development_dependency "bundler", ">= 1.16"
32
- spec.add_development_dependency "rake", "~> 13.0"
33
- spec.add_development_dependency "rspec", "~> 3.0"
34
- spec.add_development_dependency "standard", "~> 0.2.0"
35
- end
data/forspell.dict DELETED
@@ -1,8 +0,0 @@
1
- # Format: one word per line. Empty lines and #-comments are supported too.
2
- # If you want to add word with its forms, you can write 'word: example' (without quotes) on the line,
3
- # where 'example' is existing word with the same possible forms (endings) as your word.
4
- # Example: deduplicate: duplicate
5
- assignees
6
- matchers
7
- palkan
8
- testability
@@ -1,5 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '~> 5.0'
4
-
5
- gemspec path: '..'
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activesupport", "~> 4.2"
6
- gem "actionmailer", "~> 4.2"
7
-
8
- gemspec path: ".."
@@ -1,5 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '~> 5.0'
4
-
5
- gemspec path: '..'
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activesupport", "~> 5.0.7"
6
- gem "actionmailer", "~> 5.0.7"
7
-
8
- gemspec path: ".."
@@ -1,5 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '~> 6.0'
4
-
5
- gemspec path: '..'
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'arel', github: 'rails/arel'
4
- gem 'rails', github: 'rails/rails'
5
-
6
- gemspec path: '..'
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org" do
2
- gem "rubocop-md", "~> 0.3"
3
- gem "standard", "~> 0.2.0"
4
- end
data/lefthook.yml DELETED
@@ -1,18 +0,0 @@
1
- pre-commit:
2
- commands:
3
- mdl:
4
- tags: style
5
- glob: "**/*.md"
6
- run: mdl {staged_files}
7
- liche:
8
- tags: links
9
- glob: "docs/*.md"
10
- run: liche -d docs/ -r docs/* && test {staged_files}
11
- forspell:
12
- tags: grammar
13
- glob: "**/*.md"
14
- run: forspell {staged_files}
15
- rubocop:
16
- tags: style
17
- glob: "**/*.md"
18
- run: BUNDLE_GEMFILE=gemfiles/rubocop.gemfile bundle exec rubocop {staged_files}
@@ -1,92 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActionMailer
4
- # See https://api.rubyonrails.org/classes/ActionMailer/Parameterized.html
5
- module Parameterized
6
- extend ActiveSupport::Concern
7
-
8
- included do
9
- attr_accessor :params
10
- end
11
-
12
- module ClassMethods
13
- # Provide the parameters to the mailer in order to use them in the instance methods and callbacks.
14
- #
15
- # InvitationsMailer.with(inviter: person_a, invitee: person_b).account_invitation.deliver_later
16
- #
17
- # See Parameterized documentation for full example.
18
- def with(params)
19
- ActionMailer::Parameterized::Mailer.new(self, params)
20
- end
21
- end
22
-
23
- class Mailer # :nodoc:
24
- def initialize(mailer, params)
25
- @mailer, @params = mailer, params
26
- end
27
-
28
- private
29
-
30
- def method_missing(method_name, *args)
31
- if @mailer.action_methods.include?(method_name.to_s)
32
- ActionMailer::Parameterized::MessageDelivery.new(@mailer, method_name, @params, *args)
33
- else
34
- super
35
- end
36
- end
37
-
38
- def respond_to_missing?(method, include_all = false)
39
- @mailer.respond_to?(method, include_all)
40
- end
41
- end
42
-
43
- class MessageDelivery < ActionMailer::MessageDelivery # :nodoc:
44
- def initialize(mailer_class, action, params, *args)
45
- super(mailer_class, action, *args)
46
- @mailer ||= mailer_class
47
- @mail_method ||= action
48
- @params = params
49
- end
50
-
51
- def __getobj__ #:nodoc:
52
- @obj ||= processed_mailer.message
53
- end
54
-
55
- def processed?
56
- @processed_mailer || @obj
57
- end
58
-
59
- private
60
-
61
- def processed_mailer
62
- @processed_mailer ||= @mailer.send(*mailer_args).tap do |m|
63
- m.params = @params
64
- m.process @mail_method, *@args
65
- end
66
- end
67
-
68
- def mailer_args
69
- ActionMailer::VERSION::MAJOR < 5 ? [:new, nil, *@args] : [:new]
70
- end
71
-
72
- def enqueue_delivery(delivery_method, options = {})
73
- if processed?
74
- super
75
- else
76
- args = @mailer.name, @mail_method.to_s, delivery_method.to_s, @params, *@args
77
- ActionMailer::Parameterized::DeliveryJob.set(options).perform_later(*args)
78
- end
79
- end
80
- end
81
-
82
- class DeliveryJob < ActionMailer::DeliveryJob # :nodoc:
83
- def perform(mailer, mail_method, delivery_method, params, *args)
84
- mailer.constantize.with(params).public_send(mail_method, *args).send(delivery_method)
85
- end
86
- end
87
- end
88
- end
89
-
90
- ActiveSupport.on_load(:action_mailer) do
91
- include ActionMailer::Parameterized
92
- end