active_delivery 0.4.3 → 1.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +58 -1
- data/LICENSE.txt +19 -17
- data/README.md +503 -32
- data/lib/.rbnext/3.0/active_delivery/base.rb +124 -0
- data/lib/.rbnext/3.0/active_delivery/callbacks.rb +97 -0
- data/lib/.rbnext/3.0/active_delivery/lines/base.rb +63 -0
- data/lib/.rbnext/3.0/active_delivery/lines/mailer.rb +25 -0
- data/lib/.rbnext/3.1/active_delivery/base.rb +124 -0
- data/lib/.rbnext/3.1/active_delivery/lines/base.rb +63 -0
- data/lib/abstract_notifier/async_adapters/active_job.rb +27 -0
- data/lib/abstract_notifier/async_adapters.rb +16 -0
- data/lib/abstract_notifier/base.rb +178 -0
- data/lib/abstract_notifier/testing/minitest.rb +51 -0
- data/lib/abstract_notifier/testing/rspec.rb +164 -0
- data/lib/abstract_notifier/testing.rb +49 -0
- data/lib/abstract_notifier/version.rb +5 -0
- data/lib/abstract_notifier.rb +74 -0
- data/lib/active_delivery/base.rb +156 -27
- data/lib/active_delivery/callbacks.rb +25 -25
- data/lib/active_delivery/ext/string_constantize.rb +24 -0
- data/lib/active_delivery/lines/base.rb +24 -17
- data/lib/active_delivery/lines/mailer.rb +7 -18
- data/lib/active_delivery/lines/notifier.rb +53 -0
- data/lib/active_delivery/raitie.rb +9 -0
- data/lib/active_delivery/testing/rspec.rb +59 -12
- data/lib/active_delivery/testing.rb +19 -5
- data/lib/active_delivery/version.rb +1 -1
- data/lib/active_delivery.rb +8 -0
- metadata +61 -56
- data/.gem_release.yml +0 -3
- data/.github/ISSUE_TEMPLATE/bug_report.md +0 -24
- data/.github/ISSUE_TEMPLATE/feature_request.md +0 -24
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -23
- data/.github/workflows/docs-lint.yml +0 -72
- data/.github/workflows/rspec-jruby.yml +0 -35
- data/.github/workflows/rspec.yml +0 -51
- data/.github/workflows/rubocop.yml +0 -21
- data/.gitignore +0 -43
- data/.mdlrc +0 -1
- data/.rspec +0 -2
- data/.rubocop-md.yml +0 -16
- data/.rubocop.yml +0 -28
- data/Gemfile +0 -17
- data/RELEASING.md +0 -43
- data/Rakefile +0 -20
- data/active_delivery.gemspec +0 -35
- data/forspell.dict +0 -8
- data/gemfiles/jruby.gemfile +0 -5
- data/gemfiles/rails42.gemfile +0 -8
- data/gemfiles/rails5.gemfile +0 -5
- data/gemfiles/rails50.gemfile +0 -8
- data/gemfiles/rails6.gemfile +0 -5
- data/gemfiles/railsmaster.gemfile +0 -6
- data/gemfiles/rubocop.gemfile +0 -4
- data/lefthook.yml +0 -18
- data/lib/active_delivery/action_mailer/parameterized.rb +0 -92
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]
|
data/active_delivery.gemspec
DELETED
@@ -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
|
data/gemfiles/jruby.gemfile
DELETED
data/gemfiles/rails42.gemfile
DELETED
data/gemfiles/rails5.gemfile
DELETED
data/gemfiles/rails50.gemfile
DELETED
data/gemfiles/rails6.gemfile
DELETED
data/gemfiles/rubocop.gemfile
DELETED
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
|