caffeinate 0.2.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +162 -77
- data/app/controllers/caffeinate/campaign_subscriptions_controller.rb +3 -3
- data/app/models/caffeinate/application_record.rb +0 -1
- data/app/models/caffeinate/campaign.rb +49 -2
- data/app/models/caffeinate/campaign_subscription.rb +50 -13
- data/app/models/caffeinate/mailing.rb +14 -6
- data/app/views/layouts/{caffeinate.html.erb → _caffeinate.html.erb} +0 -0
- data/db/migrate/20201124183102_create_caffeinate_campaigns.rb +1 -0
- data/db/migrate/20201124183303_create_caffeinate_campaign_subscriptions.rb +6 -3
- data/db/migrate/20201124183419_create_caffeinate_mailings.rb +2 -1
- data/lib/caffeinate.rb +4 -8
- data/lib/caffeinate/action_mailer.rb +4 -4
- data/lib/caffeinate/action_mailer/extension.rb +11 -5
- data/lib/caffeinate/action_mailer/interceptor.rb +4 -2
- data/lib/caffeinate/action_mailer/observer.rb +4 -3
- data/lib/caffeinate/active_record/extension.rb +17 -11
- data/lib/caffeinate/configuration.rb +11 -2
- data/lib/caffeinate/drip.rb +15 -2
- data/lib/caffeinate/drip_evaluator.rb +3 -0
- data/lib/caffeinate/dripper/base.rb +12 -5
- data/lib/caffeinate/dripper/batching.rb +22 -0
- data/lib/caffeinate/dripper/callbacks.rb +89 -6
- data/lib/caffeinate/dripper/campaign.rb +20 -8
- data/lib/caffeinate/dripper/defaults.rb +4 -2
- data/lib/caffeinate/dripper/delivery.rb +8 -8
- data/lib/caffeinate/dripper/drip.rb +3 -42
- data/lib/caffeinate/dripper/drip_collection.rb +62 -0
- data/lib/caffeinate/dripper/inferences.rb +7 -2
- data/lib/caffeinate/dripper/perform.rb +14 -7
- data/lib/caffeinate/dripper/periodical.rb +26 -0
- data/lib/caffeinate/dripper/subscriber.rb +14 -2
- data/lib/caffeinate/dripper_collection.rb +17 -0
- data/lib/caffeinate/engine.rb +6 -4
- data/lib/caffeinate/helpers.rb +3 -0
- data/lib/caffeinate/mail_ext.rb +12 -0
- data/lib/caffeinate/url_helpers.rb +3 -0
- data/lib/caffeinate/version.rb +1 -1
- data/lib/generators/caffeinate/install_generator.rb +5 -1
- data/lib/generators/caffeinate/templates/caffeinate.rb +21 -1
- metadata +22 -4
- data/lib/caffeinate/action_mailer/helpers.rb +0 -12
data/lib/caffeinate/version.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Caffeinate
|
4
4
|
module Generators
|
5
|
-
#
|
5
|
+
# Installs Caffeinate
|
6
6
|
class InstallGenerator < Rails::Generators::Base
|
7
7
|
source_root File.expand_path('templates', __dir__)
|
8
8
|
include ::Rails::Generators::Migration
|
@@ -19,6 +19,10 @@ module Caffeinate
|
|
19
19
|
template 'application_dripper.rb', 'app/drippers/application_dripper.rb'
|
20
20
|
end
|
21
21
|
|
22
|
+
def install_routes
|
23
|
+
inject_into_file 'config/routes.rb', "\n mount ::Caffeinate::Engine => '/caffeinate'", after: /Rails.application.routes.draw do/
|
24
|
+
end
|
25
|
+
|
22
26
|
# :nodoc:
|
23
27
|
def self.next_migration_number(_path)
|
24
28
|
if @prev_migration_nr
|
@@ -6,7 +6,7 @@ Caffeinate.setup do |config|
|
|
6
6
|
# Used for when we set a datetime column to "now" in the database
|
7
7
|
#
|
8
8
|
# Default:
|
9
|
-
# -> { Time.current }
|
9
|
+
# config.now = -> { Time.current }
|
10
10
|
#
|
11
11
|
# config.now = -> { DateTime.now }
|
12
12
|
#
|
@@ -21,4 +21,24 @@ Caffeinate.setup do |config|
|
|
21
21
|
#
|
22
22
|
# config.async_delivery = true
|
23
23
|
# config.mailing_job = 'MyCustomCaffeinateJob'
|
24
|
+
#
|
25
|
+
# == Batching
|
26
|
+
#
|
27
|
+
# When a Dripper is performed and sends the mails, we use `find_in_batches`. Use `batch_size` to set the batch size.
|
28
|
+
# You can set this on a dripper as well for more granular control.
|
29
|
+
#
|
30
|
+
# Default:
|
31
|
+
# config.batch_size = 1_000
|
32
|
+
#
|
33
|
+
# config.batch_size = 100
|
34
|
+
#
|
35
|
+
# == Implicit Campaigns
|
36
|
+
#
|
37
|
+
# Instead of manually having to create a Campaign, you can let Caffeinate do a `find_or_create_by` at runtime.
|
38
|
+
# This is probably dangerous but it hasn't burned me yet so here you go:
|
39
|
+
#
|
40
|
+
# Default:
|
41
|
+
# config.implicit_campaigns = true
|
42
|
+
#
|
43
|
+
# config.implicit_campaigns = false
|
24
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caffeinate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Brody
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11
|
11
|
+
date: 2020-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: sqlite3
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,7 +140,7 @@ files:
|
|
126
140
|
- app/models/caffeinate/mailing.rb
|
127
141
|
- app/views/caffeinate/campaign_subscriptions/subscribe.html.erb
|
128
142
|
- app/views/caffeinate/campaign_subscriptions/unsubscribe.html.erb
|
129
|
-
- app/views/layouts/
|
143
|
+
- app/views/layouts/_caffeinate.html.erb
|
130
144
|
- config/locales/en.yml
|
131
145
|
- config/routes.rb
|
132
146
|
- db/migrate/20201124183102_create_caffeinate_campaigns.rb
|
@@ -135,7 +149,6 @@ files:
|
|
135
149
|
- lib/caffeinate.rb
|
136
150
|
- lib/caffeinate/action_mailer.rb
|
137
151
|
- lib/caffeinate/action_mailer/extension.rb
|
138
|
-
- lib/caffeinate/action_mailer/helpers.rb
|
139
152
|
- lib/caffeinate/action_mailer/interceptor.rb
|
140
153
|
- lib/caffeinate/action_mailer/observer.rb
|
141
154
|
- lib/caffeinate/active_record/extension.rb
|
@@ -144,16 +157,21 @@ files:
|
|
144
157
|
- lib/caffeinate/drip.rb
|
145
158
|
- lib/caffeinate/drip_evaluator.rb
|
146
159
|
- lib/caffeinate/dripper/base.rb
|
160
|
+
- lib/caffeinate/dripper/batching.rb
|
147
161
|
- lib/caffeinate/dripper/callbacks.rb
|
148
162
|
- lib/caffeinate/dripper/campaign.rb
|
149
163
|
- lib/caffeinate/dripper/defaults.rb
|
150
164
|
- lib/caffeinate/dripper/delivery.rb
|
151
165
|
- lib/caffeinate/dripper/drip.rb
|
166
|
+
- lib/caffeinate/dripper/drip_collection.rb
|
152
167
|
- lib/caffeinate/dripper/inferences.rb
|
153
168
|
- lib/caffeinate/dripper/perform.rb
|
169
|
+
- lib/caffeinate/dripper/periodical.rb
|
154
170
|
- lib/caffeinate/dripper/subscriber.rb
|
171
|
+
- lib/caffeinate/dripper_collection.rb
|
155
172
|
- lib/caffeinate/engine.rb
|
156
173
|
- lib/caffeinate/helpers.rb
|
174
|
+
- lib/caffeinate/mail_ext.rb
|
157
175
|
- lib/caffeinate/url_helpers.rb
|
158
176
|
- lib/caffeinate/version.rb
|
159
177
|
- lib/generators/caffeinate/install_generator.rb
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Caffeinate
|
4
|
-
module ActionMailer
|
5
|
-
module Helpers
|
6
|
-
def caffeinate_unsubscribe_url(caffeinate_campaign_subscription, **options)
|
7
|
-
opts = (::ActionMailer::Base.default_url_options || {}).merge(options)
|
8
|
-
Caffeinate::Engine.routes.url_helpers.caffeinate_unsubscribe_url(token: caffeinate_campaign_subscription.token, **opts)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|