active_job-performs 0.2.0 → 0.3.0

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: afad0c3e092f329deb71fea10b4f2105d1a2fbff2d581eb46304411c8cf5c592
4
- data.tar.gz: ec2db477f5e639b8dd8f4e1958f2f2813e9d32a85b6526693878a10927da6f0a
3
+ metadata.gz: 5741d785f1439dac15d6ec2734d40e5560013f69025977713771309c7f15c4c7
4
+ data.tar.gz: c01e5d7ebe8f599024cd5eba79011a959d2e31c8d5141b787b46d55b1150b73b
5
5
  SHA512:
6
- metadata.gz: 0213fcbdd14ecc60adbbff93d2f515b1ec1dee6f9511d9b69037ac2e85610cbaa9b3458a0b5256cba2f18f2d5e3f814dddf04e2993e89e3b0e44151b0cbc5819
7
- data.tar.gz: 6bf98a858966a833b872643a3fc5b33f23d27d1499eaf8b917f5c470bb43b49cd2e8c68c8f0cad251714a84c7da2a531d4809e72b8db364818a8d76bbe827107
6
+ metadata.gz: 7ea09dcf8da5a0c7c1f5181ed70e07c3a3028d7d12c5c84cece6c6d59ab6a7921ea7ddc05180fd2b8f551332277a2e032bee0c057398a33b4e7f3a645f451c3f
7
+ data.tar.gz: 32899d17334f35819a1aa61ffa56c58a492d1b304a003b1e5d6156a26450087e2ac7083021a312269d2c2ee0519e43ad78d129629c6641036f5ad222130f6c3a
data/Gemfile CHANGED
@@ -9,3 +9,11 @@ gem "rake", "~> 13.0"
9
9
 
10
10
  gem "minitest", "~> 5.0"
11
11
  gem "minitest-sprint"
12
+
13
+ gem "debug"
14
+
15
+ # Fetch latest Active Job to test `ActiveJob.perform_all_later`
16
+ gem "activejob", ">= 7.1"
17
+ gem "activerecord", ">= 7.1"
18
+
19
+ gem "sqlite3"
data/Gemfile.lock CHANGED
@@ -1,42 +1,82 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- active_job-performs (0.2.0)
4
+ active_job-performs (0.3.0)
5
5
  activejob (>= 6.1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activejob (7.0.4)
11
- activesupport (= 7.0.4)
10
+ activejob (7.1.1)
11
+ activesupport (= 7.1.1)
12
12
  globalid (>= 0.3.6)
13
- activesupport (7.0.4)
13
+ activemodel (7.1.1)
14
+ activesupport (= 7.1.1)
15
+ activerecord (7.1.1)
16
+ activemodel (= 7.1.1)
17
+ activesupport (= 7.1.1)
18
+ timeout (>= 0.4.0)
19
+ activesupport (7.1.1)
20
+ base64
21
+ bigdecimal
14
22
  concurrent-ruby (~> 1.0, >= 1.0.2)
23
+ connection_pool (>= 2.2.5)
24
+ drb
15
25
  i18n (>= 1.6, < 2)
16
26
  minitest (>= 5.1)
27
+ mutex_m
17
28
  tzinfo (~> 2.0)
18
- concurrent-ruby (1.1.10)
19
- globalid (1.0.0)
20
- activesupport (>= 5.0)
21
- i18n (1.12.0)
29
+ base64 (0.1.1)
30
+ bigdecimal (3.1.4)
31
+ concurrent-ruby (1.2.2)
32
+ connection_pool (2.4.1)
33
+ debug (1.8.0)
34
+ irb (>= 1.5.0)
35
+ reline (>= 0.3.1)
36
+ drb (2.1.1)
37
+ ruby2_keywords
38
+ globalid (1.2.1)
39
+ activesupport (>= 6.1)
40
+ i18n (1.14.1)
22
41
  concurrent-ruby (~> 1.0)
42
+ io-console (0.6.0)
43
+ irb (1.8.0)
44
+ rdoc (~> 6.5)
45
+ reline (>= 0.3.6)
23
46
  minitest (5.16.3)
24
47
  minitest-sprint (1.2.2)
25
48
  path_expander (~> 1.1)
49
+ mutex_m (0.1.2)
26
50
  path_expander (1.1.1)
51
+ psych (5.1.0)
52
+ stringio
27
53
  rake (13.0.6)
28
- tzinfo (2.0.5)
54
+ rdoc (6.5.0)
55
+ psych (>= 4.0.0)
56
+ reline (0.3.8)
57
+ io-console (~> 0.5)
58
+ ruby2_keywords (0.0.5)
59
+ sqlite3 (1.6.4-arm64-darwin)
60
+ sqlite3 (1.6.4-x86_64-linux)
61
+ stringio (3.0.8)
62
+ timeout (0.4.0)
63
+ tzinfo (2.0.6)
29
64
  concurrent-ruby (~> 1.0)
30
65
 
31
66
  PLATFORMS
32
67
  arm64-darwin-20
68
+ arm64-darwin-22
33
69
  x86_64-linux
34
70
 
35
71
  DEPENDENCIES
36
72
  active_job-performs!
73
+ activejob (>= 7.1)
74
+ activerecord (>= 7.1)
75
+ debug
37
76
  minitest (~> 5.0)
38
77
  minitest-sprint
39
78
  rake (~> 13.0)
79
+ sqlite3
40
80
 
41
81
  BUNDLED WITH
42
- 2.3.21
82
+ 2.4.19
data/README.md CHANGED
@@ -42,6 +42,14 @@ class Post < ActiveRecord::Base
42
42
  end
43
43
  end
44
44
 
45
+ # On Rails 7.1, where `ActiveJob.perform_all_later` exists, we also generate
46
+ # a bulk method to enqueue many jobs at once. So you can do this:
47
+ #
48
+ # Post.unpublished.in_batches.each(&:publish_later_bulk)
49
+ def self.publish_later_bulk
50
+ ActiveJob.perform_all_later all.map { PublishJob.new(_1) }
51
+ end
52
+
45
53
  # We generate `publish_later` to wrap the job execution.
46
54
  def publish_later(*arguments, **options)
47
55
  PublishJob.perform_later(self, *arguments, **options)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveJob
4
4
  module Performs
5
- VERSION = "0.2.0"
5
+ VERSION = "0.3.0"
6
6
  end
7
7
  end
@@ -46,11 +46,21 @@ module ActiveJob::Performs
46
46
  end
47
47
  RUBY
48
48
 
49
+ if ActiveJob.respond_to?(:perform_all_later) && respond_to?(:all)
50
+ class_eval <<~RUBY, __FILE__, __LINE__ + 1
51
+ def self.#{method}_later_bulk#{suffix}
52
+ ActiveJob.perform_all_later all.map { #{job}.scoped_by_wait(_1).new(_1) }
53
+ end
54
+ RUBY
55
+ end
56
+
49
57
  class_eval <<~RUBY, __FILE__, __LINE__ + 1
50
58
  def #{method}_later#{suffix}(*arguments, **options)
51
59
  #{job}.scoped_by_wait(self).perform_later(self, *arguments, **options)
52
60
  end
53
61
  RUBY
62
+
63
+ [method, :"#{method}_later#{suffix}"] # Ensure `private performs :some_method` privates both names.
54
64
  end
55
65
  end
56
66
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_job-performs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kasper Timm Hansen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-12 00:00:00.000000000 Z
11
+ date: 2023-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
62
  - !ruby/object:Gem::Version
63
63
  version: '0'
64
64
  requirements: []
65
- rubygems_version: 3.4.1
65
+ rubygems_version: 3.4.19
66
66
  signing_key:
67
67
  specification_version: 4
68
68
  summary: ActiveJob::Performs adds the `performs` macro to set up jobs by convention.