caffeinate 0.8.2 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 855b98e11499fe2a9fbf1e589530d60d511363e55ea80cdf1b4322dc92af1f3c
4
- data.tar.gz: ca000ad1c32cb053901e3f69dcc370725044c3529c673839c3f4ef9b43dc5505
3
+ metadata.gz: 3a1b112ae3aa4c5c0d6f5d0754dffe6fc720c025739d3b78487b78754b4bd8fb
4
+ data.tar.gz: a7ede18dbf114ebf23c3c6eba347b60524963574a921687ffba1943885055777
5
5
  SHA512:
6
- metadata.gz: 1d8e13de2b19eb8d7a628ae2e5ca9e0bca0d985f36629994257775a2d3b7b5b0641584fc349929ac6930e65fd6a4958556dbd0ab3604600a37c5879858657720
7
- data.tar.gz: 999a9e763d4e1b7f96a5549f61eca6c0c1e2029e346dadea08281eb00c754ed2ccd1022dcdcbf13b315572446bf1eb5d699dde802604cc441f897cdac5fe5256
6
+ metadata.gz: 83efe161d7aa1885ebd1080b1fe640ea87e21b9dd1dbf494998b361a4ae6f1188a23a4aa509766edec90eabea2fbc9b08d6f8b305592cbaeeaf38343737e16ef
7
+ data.tar.gz: 4c42564577a0321ad57cf7a052645a2ea3fe2670e701789dfb123a1801e95a98dc3754602d318b9d341921b1f41c47cc03d8bfd1a678d4ef3e3b0317d32e29c6
@@ -56,7 +56,7 @@ module Caffeinate
56
56
  def unsubscribe(subscriber, **args)
57
57
  reason = args.delete(:reason)
58
58
  subscription = subscriber(subscriber, **args)
59
- raise ActiveRecord::RecordInvalid, subscription if subscription.nil?
59
+ raise ::ActiveRecord::RecordInvalid, subscription if subscription.nil?
60
60
 
61
61
  subscription.unsubscribe!(reason)
62
62
  end
@@ -16,14 +16,14 @@ module Caffeinate
16
16
  end
17
17
 
18
18
  # Ends the CampaignSubscription
19
- def end!
20
- mailing.caffeinate_campaign_subscription.end!
19
+ def end!(**args)
20
+ mailing.caffeinate_campaign_subscription.end!(**args)
21
21
  false
22
22
  end
23
23
 
24
24
  # Unsubscribes the CampaignSubscription
25
- def unsubscribe!
26
- mailing.caffeinate_campaign_subscription.unsubscribe!
25
+ def unsubscribe!(**args)
26
+ mailing.caffeinate_campaign_subscription.unsubscribe!(**args)
27
27
  false
28
28
  end
29
29
 
@@ -20,7 +20,7 @@ module Caffeinate
20
20
  .upcoming
21
21
  .unsent
22
22
  .joins(:caffeinate_campaign_subscription)
23
- .merge(Caffeinate::CampaignSubscription.active)
23
+ .merge(Caffeinate::CampaignSubscription.active.where(caffeinate_campaign: self.campaign))
24
24
  .in_batches(of: self.class.batch_size)
25
25
  .each do |batch|
26
26
  run_callbacks(:on_perform, self, batch)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Caffeinate
4
- VERSION = '0.8.2'
4
+ VERSION = '0.8.4'
5
5
  end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails/generators/base'
4
+
5
+ module Caffeinate
6
+ module Generators
7
+ module ViewPathTemplates #:nodoc:
8
+ extend ActiveSupport::Concern
9
+
10
+ included do
11
+ public_task :copy_views
12
+ end
13
+
14
+ def copy_views
15
+ view_directory :campaign_subscriptions
16
+ end
17
+
18
+ protected
19
+
20
+ def view_directory(name, _target_path = nil)
21
+ directory name.to_s, _target_path || "#{target_path}/#{name}" do |content|
22
+ content
23
+ end
24
+ end
25
+
26
+ def target_path
27
+ @target_path ||= "app/views/caffeinate"
28
+ end
29
+ end
30
+
31
+ class SharedViewsGenerator < Rails::Generators::Base #:nodoc:
32
+ include ViewPathTemplates
33
+ source_root File.expand_path("../../../../app/views/caffeinate", __FILE__)
34
+ desc "Copies shared Caffeinate views to your application."
35
+ hide!
36
+ end
37
+
38
+ class ViewsGenerator < Rails::Generators::Base
39
+ desc "Copies Caffeinate views to your application."
40
+
41
+ invoke SharedViewsGenerator
42
+ end
43
+ end
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.8.2
4
+ version: 0.8.4
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-12-17 00:00:00.000000000 Z
11
+ date: 2020-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -177,6 +177,7 @@ files:
177
177
  - lib/generators/caffeinate/install_generator.rb
178
178
  - lib/generators/caffeinate/templates/application_dripper.rb
179
179
  - lib/generators/caffeinate/templates/caffeinate.rb
180
+ - lib/generators/caffeinate/views_generator.rb
180
181
  homepage: https://github.com/joshmn/caffeinate
181
182
  licenses:
182
183
  - MIT