gush 2.1.0 → 4.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.
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'active_support'
2
+ require 'active_support/testing/time_helpers'
1
3
  require 'gush'
2
4
  require 'json'
3
5
  require 'pry'
@@ -29,11 +31,16 @@ class TestWorkflow < Gush::Workflow
29
31
  end
30
32
 
31
33
  class ParameterTestWorkflow < Gush::Workflow
32
- def configure(param)
33
- run Prepare if param
34
+ def configure(param, kwarg: false)
35
+ run Prepare if param || kwarg
34
36
  end
35
37
  end
36
38
 
39
+ class WaitableTestWorkflow < Gush::Workflow
40
+ def configure
41
+ run Prepare, wait: 5.minutes
42
+ end
43
+ end
37
44
 
38
45
  REDIS_URL = ENV["REDIS_URL"] || "redis://localhost:6379/12"
39
46
 
@@ -86,7 +93,22 @@ RSpec::Matchers.define :have_no_jobs do |flow, jobs|
86
93
  end
87
94
  end
88
95
 
96
+ RSpec::Matchers.define :have_a_job_enqueued_at do |flow, job, at|
97
+ expected_execution_timestamp = (Time.current.utc + at).to_i
98
+
99
+ match do |actual|
100
+ expected = hash_including(args: include(flow, job), at: expected_execution_timestamp)
101
+
102
+ expect(ActiveJob::Base.queue_adapter.enqueued_jobs).to match_array(expected)
103
+ end
104
+
105
+ failure_message do |actual|
106
+ "expected to have enqueued job #{job} to be executed at #{Time.current.utc + at}, but instead has: #{Time.at(enqueued_jobs.first[:at]).to_datetime.utc}"
107
+ end
108
+ end
109
+
89
110
  RSpec.configure do |config|
111
+ config.include ActiveSupport::Testing::TimeHelpers
90
112
  config.include ActiveJob::TestHelper
91
113
  config.include GushHelpers
92
114
 
@@ -98,11 +120,11 @@ RSpec.configure do |config|
98
120
  clear_enqueued_jobs
99
121
  clear_performed_jobs
100
122
 
101
- Gush.configure do |config|
102
- config.redis_url = REDIS_URL
103
- config.gushfile = GUSHFILE
104
- config.locking_duration = defined?(locking_duration) ? locking_duration : 2
105
- config.polling_interval = defined?(polling_interval) ? polling_interval : 0.3
123
+ Gush.configure do |c|
124
+ c.redis_url = REDIS_URL
125
+ c.gushfile = GUSHFILE
126
+ c.locking_duration = defined?(locking_duration) ? locking_duration : 2
127
+ c.polling_interval = defined?(polling_interval) ? polling_interval : 0.3
106
128
  end
107
129
  end
108
130
 
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gush
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotrek Okoński
8
+ - Michał Krzyżanowski
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2022-09-19 00:00:00.000000000 Z
12
+ date: 2024-09-25 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: activejob
@@ -16,20 +17,20 @@ dependencies:
16
17
  requirements:
17
18
  - - ">="
18
19
  - !ruby/object:Gem::Version
19
- version: 4.2.7
20
+ version: 6.1.0
20
21
  - - "<"
21
22
  - !ruby/object:Gem::Version
22
- version: '7.1'
23
+ version: '7.2'
23
24
  type: :runtime
24
25
  prerelease: false
25
26
  version_requirements: !ruby/object:Gem::Requirement
26
27
  requirements:
27
28
  - - ">="
28
29
  - !ruby/object:Gem::Version
29
- version: 4.2.7
30
+ version: 6.1.0
30
31
  - - "<"
31
32
  - !ruby/object:Gem::Version
32
- version: '7.1'
33
+ version: '7.2'
33
34
  - !ruby/object:Gem::Dependency
34
35
  name: concurrent-ruby
35
36
  requirement: !ruby/object:Gem::Requirement
@@ -67,7 +68,7 @@ dependencies:
67
68
  version: '3.2'
68
69
  - - "<"
69
70
  - !ruby/object:Gem::Version
70
- version: '5'
71
+ version: '6'
71
72
  type: :runtime
72
73
  prerelease: false
73
74
  version_requirements: !ruby/object:Gem::Requirement
@@ -77,7 +78,7 @@ dependencies:
77
78
  version: '3.2'
78
79
  - - "<"
79
80
  - !ruby/object:Gem::Version
80
- version: '5'
81
+ version: '6'
81
82
  - !ruby/object:Gem::Dependency
82
83
  name: redis-mutex
83
84
  requirement: !ruby/object:Gem::Requirement
@@ -208,14 +209,56 @@ dependencies:
208
209
  requirements:
209
210
  - - "~>"
210
211
  - !ruby/object:Gem::Version
211
- version: '10.4'
212
+ version: '12'
212
213
  type: :development
213
214
  prerelease: false
214
215
  version_requirements: !ruby/object:Gem::Requirement
215
216
  requirements:
216
217
  - - "~>"
217
218
  - !ruby/object:Gem::Version
218
- version: '10.4'
219
+ version: '12'
220
+ - !ruby/object:Gem::Dependency
221
+ name: rubocop
222
+ requirement: !ruby/object:Gem::Requirement
223
+ requirements:
224
+ - - "~>"
225
+ - !ruby/object:Gem::Version
226
+ version: 1.65.0
227
+ type: :development
228
+ prerelease: false
229
+ version_requirements: !ruby/object:Gem::Requirement
230
+ requirements:
231
+ - - "~>"
232
+ - !ruby/object:Gem::Version
233
+ version: 1.65.0
234
+ - !ruby/object:Gem::Dependency
235
+ name: rubocop-rake
236
+ requirement: !ruby/object:Gem::Requirement
237
+ requirements:
238
+ - - "~>"
239
+ - !ruby/object:Gem::Version
240
+ version: 0.6.0
241
+ type: :development
242
+ prerelease: false
243
+ version_requirements: !ruby/object:Gem::Requirement
244
+ requirements:
245
+ - - "~>"
246
+ - !ruby/object:Gem::Version
247
+ version: 0.6.0
248
+ - !ruby/object:Gem::Dependency
249
+ name: rubocop-rspec
250
+ requirement: !ruby/object:Gem::Requirement
251
+ requirements:
252
+ - - "~>"
253
+ - !ruby/object:Gem::Version
254
+ version: 3.0.3
255
+ type: :development
256
+ prerelease: false
257
+ version_requirements: !ruby/object:Gem::Requirement
258
+ requirements:
259
+ - - "~>"
260
+ - !ruby/object:Gem::Version
261
+ version: 3.0.3
219
262
  - !ruby/object:Gem::Dependency
220
263
  name: rspec
221
264
  requirement: !ruby/object:Gem::Requirement
@@ -248,6 +291,7 @@ description: Gush is a parallel workflow runner using Redis as storage and Activ
248
291
  for executing jobs.
249
292
  email:
250
293
  - piotrek@okonski.org
294
+ - michal.krzyzanowski+github@gmail.com
251
295
  executables:
252
296
  - gush
253
297
  extensions: []
@@ -256,6 +300,7 @@ files:
256
300
  - ".github/workflows/ruby.yml"
257
301
  - ".gitignore"
258
302
  - ".rspec"
303
+ - ".rubocop.yml"
259
304
  - CHANGELOG.md
260
305
  - Gemfile
261
306
  - LICENSE.txt
@@ -272,6 +317,9 @@ files:
272
317
  - lib/gush/graph.rb
273
318
  - lib/gush/job.rb
274
319
  - lib/gush/json.rb
320
+ - lib/gush/migrate/1_create_gush_workflows_created.rb
321
+ - lib/gush/migration.rb
322
+ - lib/gush/version.rb
275
323
  - lib/gush/worker.rb
276
324
  - lib/gush/workflow.rb
277
325
  - spec/Gushfile
@@ -282,6 +330,8 @@ files:
282
330
  - spec/gush/graph_spec.rb
283
331
  - spec/gush/job_spec.rb
284
332
  - spec/gush/json_spec.rb
333
+ - spec/gush/migrate/1_create_gush_workflows_created_spec.rb
334
+ - spec/gush/migration_spec.rb
285
335
  - spec/gush/worker_spec.rb
286
336
  - spec/gush/workflow_spec.rb
287
337
  - spec/gush_spec.rb
@@ -298,14 +348,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
298
348
  requirements:
299
349
  - - ">="
300
350
  - !ruby/object:Gem::Version
301
- version: '0'
351
+ version: 3.0.0
302
352
  required_rubygems_version: !ruby/object:Gem::Requirement
303
353
  requirements:
304
354
  - - ">="
305
355
  - !ruby/object:Gem::Version
306
356
  version: '0'
307
357
  requirements: []
308
- rubygems_version: 3.3.3
358
+ rubygems_version: 3.4.22
309
359
  signing_key:
310
360
  specification_version: 4
311
361
  summary: Fast and distributed workflow runner based on ActiveJob and Redis
@@ -318,6 +368,8 @@ test_files:
318
368
  - spec/gush/graph_spec.rb
319
369
  - spec/gush/job_spec.rb
320
370
  - spec/gush/json_spec.rb
371
+ - spec/gush/migrate/1_create_gush_workflows_created_spec.rb
372
+ - spec/gush/migration_spec.rb
321
373
  - spec/gush/worker_spec.rb
322
374
  - spec/gush/workflow_spec.rb
323
375
  - spec/gush_spec.rb